spi: xilinx: Fix broken PM suspend/resume
Subsystems (2)
PATCH 1/1 spi: xilinx: Fix broken PM suspend/resume
From: Martin Tůma <[email protected]>
Add the missing PM suspend/resume callbacks that properly reconfigure the xilinx spi HW on PCIe suspend/resume.
This is required in cases where the HW is on a PCIe card connected using one of the Xilinx PCIe cores (e.g. XDMA) like in the case of the Digiteq Automotive FG4 grabber card (mgb4 module).
Signed-off-by Martin Tůma <[email protected]>
--- drivers/spi/spi-xilinx.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/spi/spi-xilinx.c +28 -0
@@ -528,15 +528,43 @@ static void xilinx_spi_remove(struct platform_device *pdev) xspi->write_fn (0 , regs_base +XIPIF_V123B_DGIER_OFFSET ); } +static int xilinx_spi_suspend (struct device *dev) +{ +struct spi_controller *host =dev_get_drvdata (dev); +struct xilinx_spi *xspi =spi_controller_get_devdata (host); +void __iomem *regs_base = xspi->regs; + + xspi->write_fn (0 , regs_base +XIPIF_V123B_IIER_OFFSET ); + xspi->write_fn (0 , regs_base +XIPIF_V123B_DGIER_OFFSET ); + +return 0 ; +} + +static int xilinx_spi_resume (struct device *dev) +{ +struct spi_controller *host =dev_get_drvdata (dev); +struct xilinx_spi *xspi =spi_controller_get_devdata (host); + +xspi_init_hw (xspi); + +return 0 ; +} +/* work with hotplug and coldplug */ MODULE_ALIAS ("platform:" XILINX_SPI_NAME ); +static const struct dev_pm_ops xilinx_spi_dev_pm_ops = { +SET_NOIRQ_SYSTEM_SLEEP_PM_OPS (xilinx_spi_suspend, + xilinx_spi_resume) +}; +static struct platform_driver xilinx_spi_driver = { .probe = xilinx_spi_probe, .remove = xilinx_spi_remove, .driver = { .name =XILINX_SPI_NAME , .of_match_table = xilinx_spi_of_match, + .pm = &xilinx_spi_dev_pm_ops, }, };module_platform_driver (xilinx_spi_driver);
base-commit: fe6ff8d5d675c01793b9f051d16055dd4aa75244
Signature · 1 line
2.56.1