Linux SPI subsystem development
 help / color / mirror / Atom feed
* [PATCH 6.12.y] spi: cadence-quadspi: fix unclocked access on unbind
@ 2026-06-10  2:08 Robert Garcia
  2026-06-11  0:45 ` Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: Robert Garcia @ 2026-06-10  2:08 UTC (permalink / raw)
  To: stable, Johan Hovold
  Cc: Mark Brown, Dhruva Gole, Apurva Nandan, Robert Garcia, linux-spi,
	linux-kernel

From: Johan Hovold <johan@kernel.org>

[ Upstream commit 233db2cb14db8b1935dda52a6affd97276462b82 ]

Make sure that the controller is runtime resumed before disabling it
during driver unbind to avoid an unclocked register access.

This issue was flagged by Sashiko when reviewing a controller
deregistration fix.

Fixes: 0578a6dbfe75 ("spi: spi-cadence-quadspi: add runtime pm support")
Cc: stable@vger.kernel.org	# 6.7
Cc: Dhruva Gole <d-gole@ti.com>
Link: https://sashiko.dev/#/patchset/20260414134319.978196-1-johan%40kernel.org?part=2
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260421125354.1534871-4-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
[ Context adaptation performed. ]
Signed-off-by: Robert Garcia <rob_garcia@163.com>
---
 drivers/spi/spi-cadence-quadspi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
index 72262b6fb62b..da8401261bbc 100644
--- a/drivers/spi/spi-cadence-quadspi.c
+++ b/drivers/spi/spi-cadence-quadspi.c
@@ -2013,13 +2013,14 @@ static void cqspi_remove(struct platform_device *pdev)
 		cqspi_wait_idle(cqspi);
 
 	spi_unregister_controller(cqspi->host);
-	cqspi_controller_enable(cqspi, 0);
 
 	if (cqspi->rx_chan)
 		dma_release_channel(cqspi->rx_chan);
 
-	if (pm_runtime_get_sync(&pdev->dev) >= 0)
+	if (pm_runtime_get_sync(&pdev->dev) >= 0) {
+		cqspi_controller_enable(cqspi, 0);
 		clk_disable(cqspi->clk);
+	}
 
 	if (cqspi->is_jh7110)
 		cqspi_jh7110_disable_clk(pdev, cqspi);
-- 
2.44.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 6.12.y] spi: cadence-quadspi: fix unclocked access on unbind
  2026-06-10  2:08 [PATCH 6.12.y] spi: cadence-quadspi: fix unclocked access on unbind Robert Garcia
@ 2026-06-11  0:45 ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2026-06-11  0:45 UTC (permalink / raw)
  To: stable, Johan Hovold
  Cc: Sasha Levin, Mark Brown, Dhruva Gole, Apurva Nandan,
	Robert Garcia, linux-spi, linux-kernel

On Tue, Jun 10, 2026 at 10:08:09AM +0800, Robert Garcia wrote:
> [PATCH 6.12.y] spi: cadence-quadspi: fix unclocked access on unbind

I can't take this into 6.12 on its own. We don't backport a fix to an
older tree while it's missing from a newer one, and 233db2cb14db isn't
in 6.18.y yet.

If you can send a 6.18.y backport as well (adapted to the older
cqspi_remove() there), I'll queue both together; the 6.12 patch itself
looks fine.

--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-11  0:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-10  2:08 [PATCH 6.12.y] spi: cadence-quadspi: fix unclocked access on unbind Robert Garcia
2026-06-11  0:45 ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox