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: 1406234105
("mtd: spi-nor: Add driver for Cadence Quad SPI Flash Controller")
Signed-off-by: Dhruva Gole <d-gole@ti.com>
Link: https://lore.kernel.org/r/20230417091027.966146-3-d-gole@ti.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
ed5a25ac75
commit
2087e85bb6
1 changed files with 16 additions and 3 deletions
|
@ -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 = {
|
||||||
|
|
Loading…
Add table
Reference in a new issue