linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] spi: cadence-quadspi: Fix pm_runtime unbalance on dma EPROBE_DEFER
@ 2025-10-09  7:10 Mattijs Korpershoek
  2025-10-09  7:37 ` Dan Carpenter
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Mattijs Korpershoek @ 2025-10-09  7:10 UTC (permalink / raw)
  To: Mark Brown, Khairul Anuar Romli, Dan Carpenter
  Cc: linux-spi, linux-kernel, Mattijs Korpershoek

In csqspi_probe(), when cqspi_request_mmap_dma() returns -EPROBE_DEFER,
we handle the error by jumping to probe_setup_failed.
In that label, we call pm_runtime_disable(), even if we never called
pm_runtime_enable() before.

Because of this, the driver cannot probe:

[    2.690018] cadence-qspi 47040000.spi: No Rx DMA available
[    2.699735] spi-nor spi0.0: resume failed with -13
[    2.699741] spi-nor: probe of spi0.0 failed with error -13

Only call pm_runtime_disable() if it was enabled by adding a new
label to handle cqspi_request_mmap_dma() failures.

Fixes: b07f349d1864 ("spi: spi-cadence-quadspi: Fix pm runtime unbalance")
Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
---
This has been tested on a AM69 SK board.
---
Changes in v2:
- Updated message to use correct Fixes tag (Dan)
- Link to v1: https://lore.kernel.org/r/20251008-cadence-quadspi-fix-pm-runtime-v1-1-33bcb4b83a2e@kernel.org
---
 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 8fb13df8ff8714d2ad5a019f0ae0ec3ee38833bb..81017402bc5661d08ff4e75017db954fda19ba2a 100644
--- a/drivers/spi/spi-cadence-quadspi.c
+++ b/drivers/spi/spi-cadence-quadspi.c
@@ -1995,7 +1995,7 @@ static int cqspi_probe(struct platform_device *pdev)
 	if (cqspi->use_direct_mode) {
 		ret = cqspi_request_mmap_dma(cqspi);
 		if (ret == -EPROBE_DEFER)
-			goto probe_setup_failed;
+			goto probe_dma_failed;
 	}
 
 	if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) {
@@ -2019,9 +2019,10 @@ static int cqspi_probe(struct platform_device *pdev)
 
 	return 0;
 probe_setup_failed:
-	cqspi_controller_enable(cqspi, 0);
 	if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM)))
 		pm_runtime_disable(dev);
+probe_dma_failed:
+	cqspi_controller_enable(cqspi, 0);
 probe_reset_failed:
 	if (cqspi->is_jh7110)
 		cqspi_jh7110_disable_clk(pdev, cqspi);

---
base-commit: 0d97f2067c166eb495771fede9f7b73999c67f66
change-id: 20251008-cadence-quadspi-fix-pm-runtime-bf8df9104577

Best regards,
-- 
Mattijs Korpershoek <mkorpershoek@kernel.org>


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

* Re: [PATCH v2] spi: cadence-quadspi: Fix pm_runtime unbalance on dma EPROBE_DEFER
  2025-10-09  7:10 [PATCH v2] spi: cadence-quadspi: Fix pm_runtime unbalance on dma EPROBE_DEFER Mattijs Korpershoek
@ 2025-10-09  7:37 ` Dan Carpenter
  2025-10-13 10:22 ` Mark Brown
  2025-10-15 13:09 ` Mark Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2025-10-09  7:37 UTC (permalink / raw)
  To: Mattijs Korpershoek
  Cc: Mark Brown, Khairul Anuar Romli, linux-spi, linux-kernel

On Thu, Oct 09, 2025 at 09:10:38AM +0200, Mattijs Korpershoek wrote:
> In csqspi_probe(), when cqspi_request_mmap_dma() returns -EPROBE_DEFER,
> we handle the error by jumping to probe_setup_failed.
> In that label, we call pm_runtime_disable(), even if we never called
> pm_runtime_enable() before.
> 
> Because of this, the driver cannot probe:
> 
> [    2.690018] cadence-qspi 47040000.spi: No Rx DMA available
> [    2.699735] spi-nor spi0.0: resume failed with -13
> [    2.699741] spi-nor: probe of spi0.0 failed with error -13
> 
> Only call pm_runtime_disable() if it was enabled by adding a new
> label to handle cqspi_request_mmap_dma() failures.
> 
> Fixes: b07f349d1864 ("spi: spi-cadence-quadspi: Fix pm runtime unbalance")
> Signed-off-by: Mattijs Korpershoek <mkorpershoek@kernel.org>
> ---
> This has been tested on a AM69 SK board.
> ---
> Changes in v2:
> - Updated message to use correct Fixes tag (Dan)
> - Link to v1: https://lore.kernel.org/r/20251008-cadence-quadspi-fix-pm-runtime-v1-1-33bcb4b83a2e@kernel.org

Thanks!

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

regards,
dan carpenter


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

* Re: [PATCH v2] spi: cadence-quadspi: Fix pm_runtime unbalance on dma EPROBE_DEFER
  2025-10-09  7:10 [PATCH v2] spi: cadence-quadspi: Fix pm_runtime unbalance on dma EPROBE_DEFER Mattijs Korpershoek
  2025-10-09  7:37 ` Dan Carpenter
@ 2025-10-13 10:22 ` Mark Brown
  2025-10-13 11:20   ` Mattijs Korpershoek
  2025-10-15 13:09 ` Mark Brown
  2 siblings, 1 reply; 5+ messages in thread
From: Mark Brown @ 2025-10-13 10:22 UTC (permalink / raw)
  To: Mattijs Korpershoek
  Cc: Khairul Anuar Romli, Dan Carpenter, linux-spi, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 367 bytes --]

On Thu, Oct 09, 2025 at 09:10:38AM +0200, Mattijs Korpershoek wrote:
> In csqspi_probe(), when cqspi_request_mmap_dma() returns -EPROBE_DEFER,
> we handle the error by jumping to probe_setup_failed.
> In that label, we call pm_runtime_disable(), even if we never called
> pm_runtime_enable() before.

This doesn't apply against current code, please check and resend.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

* Re: [PATCH v2] spi: cadence-quadspi: Fix pm_runtime unbalance on dma EPROBE_DEFER
  2025-10-13 10:22 ` Mark Brown
@ 2025-10-13 11:20   ` Mattijs Korpershoek
  0 siblings, 0 replies; 5+ messages in thread
From: Mattijs Korpershoek @ 2025-10-13 11:20 UTC (permalink / raw)
  To: Mark Brown, Mattijs Korpershoek
  Cc: Khairul Anuar Romli, Dan Carpenter, linux-spi, linux-kernel

On Mon, Oct 13, 2025 at 11:22, Mark Brown <broonie@kernel.org> wrote:

> On Thu, Oct 09, 2025 at 09:10:38AM +0200, Mattijs Korpershoek wrote:
>> In csqspi_probe(), when cqspi_request_mmap_dma() returns -EPROBE_DEFER,
>> we handle the error by jumping to probe_setup_failed.
>> In that label, we call pm_runtime_disable(), even if we never called
>> pm_runtime_enable() before.
>
> This doesn't apply against current code, please check and resend.

Ah, sorry about that. I based this on master. I confirm it does not
apply on for-6.18.

Will resend shortly.

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

* Re: [PATCH v2] spi: cadence-quadspi: Fix pm_runtime unbalance on dma EPROBE_DEFER
  2025-10-09  7:10 [PATCH v2] spi: cadence-quadspi: Fix pm_runtime unbalance on dma EPROBE_DEFER Mattijs Korpershoek
  2025-10-09  7:37 ` Dan Carpenter
  2025-10-13 10:22 ` Mark Brown
@ 2025-10-15 13:09 ` Mark Brown
  2 siblings, 0 replies; 5+ messages in thread
From: Mark Brown @ 2025-10-15 13:09 UTC (permalink / raw)
  To: Khairul Anuar Romli, Dan Carpenter, Mattijs Korpershoek
  Cc: linux-spi, linux-kernel

On Thu, 09 Oct 2025 09:10:38 +0200, Mattijs Korpershoek wrote:
> In csqspi_probe(), when cqspi_request_mmap_dma() returns -EPROBE_DEFER,
> we handle the error by jumping to probe_setup_failed.
> In that label, we call pm_runtime_disable(), even if we never called
> pm_runtime_enable() before.
> 
> Because of this, the driver cannot probe:
> 
> [...]

Applied to

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

Thanks!

[1/1] spi: cadence-quadspi: Fix pm_runtime unbalance on dma EPROBE_DEFER
      commit: 8735696acea24ac1f9d4490992418c71941ca68c

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


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

end of thread, other threads:[~2025-10-15 13:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-09  7:10 [PATCH v2] spi: cadence-quadspi: Fix pm_runtime unbalance on dma EPROBE_DEFER Mattijs Korpershoek
2025-10-09  7:37 ` Dan Carpenter
2025-10-13 10:22 ` Mark Brown
2025-10-13 11:20   ` Mattijs Korpershoek
2025-10-15 13:09 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).