Skip to contentSkip to conversation

spi: spi-cadence-quadspi: Fix OSPI NOR failures during system resume

PATCH In review Vignesh Raghavendra 2 participants 3 messages Aug 14, 2024 – Aug 15, 2024 SPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 spi: spi-cadence-quadspi: Fix OSPI NOR failures during system resume

Its necessary to call pm_runtime_force_*() hooks as part of system suspend/resume calls so that the runtime_pm hooks get called. This ensures latest state of the IP is cached and restored during system sleep. This is especially true if runtime autosuspend is enabled as runtime suspend hooks may not be called at all before system sleeps.

Without this patch, OSPI NOR enumeration (READ_ID) fails during resume as context saved during suspend path is inconsistent.

Fixes 6d35eef2f868 ("spi: cadence-qspi: add system-wide suspend and resume callbacks")
---
 drivers/spi/spi-cadence-quadspi.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/spi/spi-cadence-quadspi.c +13 -1
index 05ebb03d319f..d4607cb89c48 100644
@@ -2000,13 +2000,25 @@ static int cqspi_runtime_resume(struct device *dev)
 static int cqspi_suspend(struct device *dev)
 {
 	struct cqspi_st *cqspi = dev_get_drvdata(dev);
+	int ret;
 
-	return spi_controller_suspend(cqspi->host);
+	ret = spi_controller_suspend(cqspi->host);
+	if (ret)
+		return ret;
+
+	return pm_runtime_force_suspend(dev);
 }
 
 static int cqspi_resume(struct device *dev)
 {
 	struct cqspi_st *cqspi = dev_get_drvdata(dev);
+	int ret;
+
+	ret = pm_runtime_force_resume(dev);
+	if (ret) {
+		dev_err(dev, "pm_runtime_force_resume failed on resume\n");
+		return ret;
+	}
 
 	return spi_controller_resume(cqspi->host);
 }
Signature · 1 line
2.46.0
maintainer
#1 lore raw
Quoted 5 lines · Vignesh Raghavendra

Without this patch, OSPI NOR enumeration (READ_ID) fails during resume as context saved during suspend path is inconsistent.

Fixes 6d35eef2f868 ("spi: cadence-qspi: add system-wide suspend and resume callbacks")

This commit isn't in mainline or my tree...

maintainer
#2 lore raw
In reply to Vignesh Raghavendra
Quoted 10 lines · Vignesh Raghavendra

Its necessary to call pm_runtime_force_*() hooks as part of system suspend/resume calls so that the runtime_pm hooks get called. This ensures latest state of the IP is cached and restored during system sleep. This is especially true if runtime autosuspend is enabled as runtime suspend hooks may not be called at all before system sleeps.

Without this patch, OSPI NOR enumeration (READ_ID) fails during resume as context saved during suspend path is inconsistent.

[...]

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-next

Thanks!

[1/1] spi: spi-cadence-quadspi: Fix OSPI NOR failures during system resume

      commit: 57d5af2660e9443b081eeaf1c373b3ce48477828

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark