spi: cadence-quadspi: fix suspend-resume implementations
[ Upstream commit2087e85bb6
] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Родитель
6a129c0e99
Коммит
d453f25faf
|
@ -1619,17 +1619,30 @@ static int cqspi_remove(struct platform_device *pdev)
|
|||
static int cqspi_suspend(struct device *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);
|
||||
return 0;
|
||||
|
||||
clk_disable_unprepare(cqspi->clk);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int cqspi_resume(struct device *dev)
|
||||
{
|
||||
struct cqspi_st *cqspi = dev_get_drvdata(dev);
|
||||
struct spi_master *master = dev_get_drvdata(dev);
|
||||
|
||||
cqspi_controller_enable(cqspi, 1);
|
||||
return 0;
|
||||
clk_prepare_enable(cqspi->clk);
|
||||
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 = {
|
||||
|
|
Загрузка…
Ссылка в новой задаче