diff options
| author | Johan Hovold <johan@kernel.org> | 2026-04-21 15:53:53 +0300 |
|---|---|---|
| committer | Mark Brown <broonie@kernel.org> | 2026-04-27 02:26:38 +0300 |
| commit | edbaae583ead2c06aea756b0fafd5fa7a1e89fc1 (patch) | |
| tree | 9857a373fc1c8e3f7ffb191630688ef20d6d4ffe | |
| parent | 5e8bb0cc72f1d52d8ac2a88f4c952e2e98056aed (diff) | |
| download | linux-edbaae583ead2c06aea756b0fafd5fa7a1e89fc1.tar.xz | |
spi: cadence-quadspi: clean up disable runtime pm quirk
Commit 30dbc1c8d50f ("spi: cadence-qspi: defer runtime support on
socfpga if reset bit is enabled") fixed a warm reset issue on SoCFPGA by
disabling runtime PM on that platform.
Clean up the quirk implementation by never dropping the runtime PM usage
count on probe instead of sprinkling conditionals throughout the driver
which makes the code unnecessarily hard to read and maintain.
Cc: Khairul Anuar Romli <khairul.anuar.romli@altera.com>
Cc: Adrian Ng Ho Yin <adrianhoyin.ng@altera.com>
Cc: Niravkumar L Rabara <nirav.rabara@altera.com>
Cc: Matthew Gerlach <matthew.gerlach@altera.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
Link: https://patch.msgid.link/20260421125354.1534871-6-johan@kernel.org
Signed-off-by: Mark Brown <broonie@kernel.org>
| -rw-r--r-- | drivers/spi/spi-cadence-quadspi.c | 47 |
1 files changed, 19 insertions, 28 deletions
diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c index 057381e56a7f..348236ea503d 100644 --- a/drivers/spi/spi-cadence-quadspi.c +++ b/drivers/spi/spi-cadence-quadspi.c @@ -1478,7 +1478,6 @@ static int cqspi_exec_mem_op(struct spi_mem *mem, const struct spi_mem_op *op) int ret; struct cqspi_st *cqspi = spi_controller_get_devdata(mem->spi->controller); struct device *dev = &cqspi->pdev->dev; - const struct cqspi_driver_platdata *ddata = of_device_get_match_data(dev); if (refcount_read(&cqspi->inflight_ops) == 0) return -ENODEV; @@ -1494,18 +1493,15 @@ static int cqspi_exec_mem_op(struct spi_mem *mem, const struct spi_mem_op *op) return -EBUSY; } - if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) { - ret = pm_runtime_resume_and_get(dev); - if (ret) { - dev_err(&mem->spi->dev, "resume failed with %d\n", ret); - goto dec_inflight_refcount; - } + ret = pm_runtime_resume_and_get(dev); + if (ret) { + dev_err(&mem->spi->dev, "resume failed with %d\n", ret); + goto dec_inflight_refcount; } ret = cqspi_mem_process(mem, op); - if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) - pm_runtime_put_autosuspend(dev); + pm_runtime_put_autosuspend(dev); if (ret) dev_err(&mem->spi->dev, "operation failed with %d\n", ret); @@ -1957,13 +1953,11 @@ static int cqspi_probe(struct platform_device *pdev) cqspi->current_cs = -1; cqspi->sclk = 0; - if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) { - pm_runtime_set_autosuspend_delay(dev, CQSPI_AUTOSUSPEND_TIMEOUT); - pm_runtime_use_autosuspend(dev); - pm_runtime_get_noresume(dev); - pm_runtime_set_active(dev); - pm_runtime_enable(dev); - } + pm_runtime_set_autosuspend_delay(dev, CQSPI_AUTOSUSPEND_TIMEOUT); + pm_runtime_use_autosuspend(dev); + pm_runtime_get_noresume(dev); + pm_runtime_set_active(dev); + pm_runtime_enable(dev); host->num_chipselect = cqspi->num_chipselect; @@ -1993,12 +1987,11 @@ release_dma_chan: if (cqspi->rx_chan) dma_release_channel(cqspi->rx_chan); disable_rpm: - if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) { - pm_runtime_disable(dev); - pm_runtime_set_suspended(dev); - pm_runtime_put_noidle(dev); - pm_runtime_dont_use_autosuspend(dev); - } + pm_runtime_disable(dev); + pm_runtime_set_suspended(dev); + pm_runtime_put_noidle(dev); + pm_runtime_dont_use_autosuspend(dev); + cqspi_controller_enable(cqspi, 0); disable_clks: clk_bulk_disable_unprepare(CLK_QSPI_NUM, cqspi->clks); @@ -2033,12 +2026,10 @@ static void cqspi_remove(struct platform_device *pdev) clk_bulk_disable_unprepare(CLK_QSPI_NUM, cqspi->clks); } - if (!(ddata && (ddata->quirks & CQSPI_DISABLE_RUNTIME_PM))) { - pm_runtime_disable(&pdev->dev); - pm_runtime_set_suspended(&pdev->dev); - pm_runtime_put_noidle(&pdev->dev); - pm_runtime_dont_use_autosuspend(&pdev->dev); - } + pm_runtime_disable(&pdev->dev); + pm_runtime_set_suspended(&pdev->dev); + pm_runtime_put_noidle(&pdev->dev); + pm_runtime_dont_use_autosuspend(&pdev->dev); } static int cqspi_runtime_suspend(struct device *dev) |
