struct cdns_xspi_dev {
struct platform_device *pdev;
+ struct spi_controller *host;
struct device *dev;
void __iomem *iobase;
}
host->bus_num = -1;
- platform_set_drvdata(pdev, host);
+ platform_set_drvdata(pdev, cdns_xspi);
cdns_xspi->pdev = pdev;
+ cdns_xspi->host = host;
cdns_xspi->dev = &pdev->dev;
cdns_xspi->cur_cs = 0;
return 0;
}
+static int cdns_xspi_suspend(struct device *dev)
+{
+ struct cdns_xspi_dev *cdns_xspi = dev_get_drvdata(dev);
+
+ return spi_controller_suspend(cdns_xspi->host);
+}
+
+static int cdns_xspi_resume(struct device *dev)
+{
+ struct cdns_xspi_dev *cdns_xspi = dev_get_drvdata(dev);
+
+ if (cdns_xspi->driver_data->mrvl_hw_overlay) {
+ cdns_mrvl_xspi_setup_clock(cdns_xspi, MRVL_DEFAULT_CLK);
+ cdns_xspi_configure_phy(cdns_xspi);
+ }
+
+ cdns_xspi->set_interrupts_handler(cdns_xspi, false);
+
+ return spi_controller_resume(cdns_xspi->host);
+}
+
+static DEFINE_SIMPLE_DEV_PM_OPS(cdns_xspi_pm_ops,
+ cdns_xspi_suspend, cdns_xspi_resume);
+
static const struct of_device_id cdns_xspi_of_match[] = {
{
.compatible = "cdns,xspi-nor",
.driver = {
.name = CDNS_XSPI_NAME,
.of_match_table = cdns_xspi_of_match,
+ .pm = pm_sleep_ptr(&cdns_xspi_pm_ops),
},
};