On 13:28-20251204, Mark Brown wrote:
On Thu, Dec 04, 2025 at 10:13:35AM +0100, Francesco Dolcini wrote:
Unless I did some stupid mistake testing the patch, it does not fix the issue. Here the log with v6.18 + this patch
Yeah, I'm pretty sure it didn't work. I've managed to find a system which instantiates the IP so hopefully I can modify it to trigger the issue and test directly rather than working blind, I've also noticed that we're getting
[ 15.430306] cadence-qspi 13010000.spi: Runtime PM usage count underflow!
even in normal operation (on that system anyway) so the runtime PM handling is definitely unhappy.
Hit the same issue on J721E platform [1], the following seems to help in my local testing [2]. I am no expert.. but do see if this makes sense
The clock is already turned off by the runtime-PM suspend callback, so an extra clk_disable*_unprepare() is only correct when runtime-PM support is not in use.
[1] https://dashboard.kernelci.org/log-viewer?itemId=ti%3A4db11a5806594ef99c7c28...
[2] https://gist.github.com/nmenon/1ebaa7cf18e7df49ab59aaa7eb798a68
diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c index af6d050da1c8..3678e971d6d9 100644 --- a/drivers/spi/spi-cadence-quadspi.c +++ b/drivers/spi/spi-cadence-quadspi.c @@ -2024,7 +2024,9 @@ static int cqspi_probe(struct platform_device *pdev) probe_reset_failed: if (cqspi->is_jh7110) cqspi_jh7110_disable_clk(pdev, cqspi); - clk_disable_unprepare(cqspi->clk); + /* Runtime-PM suspend already disables the core clock. */ + if (ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM)) + clk_disable_unprepare(cqspi->clk); probe_clk_failed: return ret; } @@ -2048,9 +2050,11 @@ static void cqspi_remove(struct platform_device *pdev) if (cqspi->rx_chan) dma_release_channel(cqspi->rx_chan);
- if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) - if (pm_runtime_get_sync(&pdev->dev) >= 0) - clk_disable(cqspi->clk); + if (ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM)) + clk_disable_unprepare(cqspi->clk); + else + /* Balance the later pm_runtime_put_sync() */ + pm_runtime_get_sync(&pdev->dev);
if (cqspi->is_jh7110) cqspi_jh7110_disable_clk(pdev, cqspi);