From: Johan Hovold <johan@kernel.org>
To: Mark Brown <broonie@kernel.org>
Cc: Miquel Raynal <miquel.raynal@bootlin.com>,
Anurag Dutta <a-dutta@ti.com>, Apurva Nandan <a-nandan@ti.com>,
Dhruva Gole <d-gole@ti.com>,
linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
Johan Hovold <johan@kernel.org>,
Khairul Anuar Romli <khairul.anuar.romli@altera.com>,
Adrian Ng Ho Yin <adrianhoyin.ng@altera.com>,
Niravkumar L Rabara <nirav.rabara@altera.com>,
Matthew Gerlach <matthew.gerlach@altera.com>
Subject: [PATCH 5/6] spi: cadence-quadspi: clean up disable runtime pm quirk
Date: Tue, 21 Apr 2026 14:53:53 +0200 [thread overview]
Message-ID: <20260421125354.1534871-6-johan@kernel.org> (raw)
In-Reply-To: <20260421125354.1534871-1-johan@kernel.org>
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>
---
drivers/spi/spi-cadence-quadspi.c | 47 +++++++++++++------------------
1 file changed, 19 insertions(+), 28 deletions(-)
diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
index 1b0d6186c7ef..f9f2313413cb 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);
@@ -1961,13 +1957,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;
@@ -1997,12 +1991,11 @@ static int cqspi_probe(struct platform_device *pdev)
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);
@@ -2037,12 +2030,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)
--
2.52.0
next prev parent reply other threads:[~2026-04-21 12:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-21 12:53 [PATCH 0/6] spi: cadence-quadspi: runtime PM fixes Johan Hovold
2026-04-21 12:53 ` [PATCH 1/6] spi: cadence-quadspi: fix runtime pm disable imbalance on probe failure Johan Hovold
2026-04-22 8:27 ` Miquel Raynal
2026-04-21 12:53 ` [PATCH 2/6] spi: cadence-quadspi: fix clock " Johan Hovold
2026-04-21 12:53 ` [PATCH 3/6] spi: cadence-quadspi: fix unclocked access on unbind Johan Hovold
2026-04-21 12:53 ` [PATCH 4/6] spi: cadence-quadspi: fix runtime pm and clock imbalance " Johan Hovold
2026-04-21 12:53 ` Johan Hovold [this message]
2026-04-21 12:53 ` [PATCH 6/6] spi: cadence-quadspi: drop redundant match data lookup Johan Hovold
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260421125354.1534871-6-johan@kernel.org \
--to=johan@kernel.org \
--cc=a-dutta@ti.com \
--cc=a-nandan@ti.com \
--cc=adrianhoyin.ng@altera.com \
--cc=broonie@kernel.org \
--cc=d-gole@ti.com \
--cc=khairul.anuar.romli@altera.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=matthew.gerlach@altera.com \
--cc=miquel.raynal@bootlin.com \
--cc=nirav.rabara@altera.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox