Commit 2087e85b authored by Dhruva Gole's avatar Dhruva Gole Committed by Mark Brown

spi: cadence-quadspi: fix suspend-resume implementations

The cadence QSPI driver misbehaves after performing a full system suspend
resume:
...
spi-nor spi0.0: resume() failed
...
This results in a flash connected via OSPI interface after system suspend-
resume to be unusable.
fix these suspend and resume functions.

Fixes: 14062341 ("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller")
Signed-off-by: default avatarDhruva Gole <d-gole@ti.com>
Link: https://lore.kernel.org/r/20230417091027.966146-3-d-gole@ti.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent ed5a25ac
...@@ -1824,17 +1824,30 @@ static void cqspi_remove(struct platform_device *pdev) ...@@ -1824,17 +1824,30 @@ static void cqspi_remove(struct platform_device *pdev)
static int cqspi_suspend(struct device *dev) static int cqspi_suspend(struct device *dev)
{ {
struct cqspi_st *cqspi = dev_get_drvdata(dev); struct cqspi_st *cqspi = dev_get_drvdata(dev);
struct spi_master *master = dev_get_drvdata(dev);
int ret;
ret = spi_master_suspend(master);
cqspi_controller_enable(cqspi, 0); cqspi_controller_enable(cqspi, 0);
return 0;
clk_disable_unprepare(cqspi->clk);
return ret;
} }
static int cqspi_resume(struct device *dev) static int cqspi_resume(struct device *dev)
{ {
struct cqspi_st *cqspi = dev_get_drvdata(dev); struct cqspi_st *cqspi = dev_get_drvdata(dev);
struct spi_master *master = dev_get_drvdata(dev);
cqspi_controller_enable(cqspi, 1); clk_prepare_enable(cqspi->clk);
return 0; cqspi_wait_idle(cqspi);
cqspi_controller_init(cqspi);
cqspi->current_cs = -1;
cqspi->sclk = 0;
return spi_master_resume(master);
} }
static const struct dev_pm_ops cqspi__dev_pm_ops = { static const struct dev_pm_ops cqspi__dev_pm_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment