Linux SPI subsystem development
 help / color / mirror / Atom feed
* [PATCH 0/7] memory: renesas-rpc-if: Optimize transfer overhead and implement runtime PM autosuspend
@ 2026-07-15 22:24 Prabhakar
  2026-07-15 22:24 ` [PATCH 1/7] memory: renesas-rpc-if: Mark XSPI_CDD1BUF0 as volatile Prabhakar
                   ` (7 more replies)
  0 siblings, 8 replies; 14+ messages in thread
From: Prabhakar @ 2026-07-15 22:24 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Mark Brown, Geert Uytterhoeven
  Cc: linux-renesas-soc, linux-spi, linux-kernel, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Hi all,

This patch series optimizes the Renesas RPC-IF driver by significantly
reducing software overhead in both the direct memory-mapped (dirmap) and
manual transfer paths, maximizing transaction throughput, and introducing
runtime PM autosuspend to prevent aggressive power gating during
consecutive flash operations.

---
Performance Results:

These changes were benchmarked using flash_speed on the RZ/T2H EVK with 
xSPI0/1 interfaces operating in 1S-1S-1S mode for write operations:

xSPI0(MX25LW51245G):
                 Without        With Fixes
  Write Speed:  806 KiB/s       942 KiB/s
  Read Speed:   5333 KiB/s      5361 KiB/s

xSPI1(AT25SF128A):
  Write Speed:  467 KiB/s       501 KiB/s
  Read Speed:   17964 KiB/s     18285 KiB/s


Note:
- Patches have been rebased on top of next-20260714.
- Ive kept patches 6 and 7 separate as they belong
  to different subsystems (SPI and memory) and may
  be applied independently.

Cheers,
Prabhakar

Lad Prabhakar (7):
  memory: renesas-rpc-if: Mark XSPI_CDD1BUF0 as volatile
  memory: renesas-rpc-if: Move static bridge configurations out of
    dirmap hot paths
  memory: renesas-rpc-if: Consolidate XSPI_CDTBUF0 updates in write path
  memory: renesas-rpc-if: Consolidate XSPI_CDTBUF0 updates in read path
  memory: renesas-rpc-if: Consolidate command setup register programming
  spi: spi-rpc-if: Implement 200ms runtime PM autosuspend delay
  memory: renesas-rpc-if: Use runtime PM autosuspend after transfers

 drivers/memory/renesas-rpc-if.c | 87 ++++++++++++++-------------------
 drivers/spi/spi-rpc-if.c        |  4 ++
 2 files changed, 40 insertions(+), 51 deletions(-)

-- 
2.54.0


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

* [PATCH 1/7] memory: renesas-rpc-if: Mark XSPI_CDD1BUF0 as volatile
  2026-07-15 22:24 [PATCH 0/7] memory: renesas-rpc-if: Optimize transfer overhead and implement runtime PM autosuspend Prabhakar
@ 2026-07-15 22:24 ` Prabhakar
  2026-07-15 22:24 ` [PATCH 2/7] memory: renesas-rpc-if: Move static bridge configurations out of dirmap hot paths Prabhakar
                   ` (6 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Prabhakar @ 2026-07-15 22:24 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Mark Brown, Geert Uytterhoeven
  Cc: linux-renesas-soc, linux-spi, linux-kernel, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar, stable

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Add XSPI_CDD1BUF0 to the xSPI regmap volatile register table.

XSPI_CDD1BUF0 is a data buffer register used during manual transfers and,
like XSPI_CDD0BUF0, its contents are transient and should not be cached
by regmap. Mark it as volatile so reads always access the hardware
register.

Fixes: 687cac9559d8 ("memory: renesas-rpc-if: Add RZ/G3E xSPI support")
Cc: stable@vger.kernel.org
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/memory/renesas-rpc-if.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index 3755956ae906..104c28532c20 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -34,6 +34,7 @@ static const struct regmap_access_table rpcif_volatile_table = {
 
 static const struct regmap_range xspi_volatile_ranges[] = {
 	regmap_reg_range(XSPI_CDD0BUF0, XSPI_CDD0BUF0),
+	regmap_reg_range(XSPI_CDD1BUF0, XSPI_CDD1BUF0),
 };
 
 static const struct regmap_access_table xspi_volatile_table = {
-- 
2.54.0


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

* [PATCH 2/7] memory: renesas-rpc-if: Move static bridge configurations out of dirmap hot paths
  2026-07-15 22:24 [PATCH 0/7] memory: renesas-rpc-if: Optimize transfer overhead and implement runtime PM autosuspend Prabhakar
  2026-07-15 22:24 ` [PATCH 1/7] memory: renesas-rpc-if: Mark XSPI_CDD1BUF0 as volatile Prabhakar
@ 2026-07-15 22:24 ` Prabhakar
  2026-07-15 22:24 ` [PATCH 3/7] memory: renesas-rpc-if: Consolidate XSPI_CDTBUF0 updates in write path Prabhakar
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Prabhakar @ 2026-07-15 22:24 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Mark Brown, Geert Uytterhoeven
  Cc: linux-renesas-soc, linux-spi, linux-kernel, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Move the initialization of the xSPI Bridge Control Register 0
(XSPI_BMCTL0) and Bridge Configuration Register (XSPI_BMCFG) from the
dirmap read and write implementations into the hardware initialization
function.

The bridge configuration values remain unchanged across sequential dirmap
transfers. Keeping these regmap_update_bits() calls inside the hot paths
(xspi_dirmap_read_impl and xspi_dirmap_write) introduces significant
software overhead and redundant register locking cycles.

Statically setting CS0ACC to 0x3 during xspi_hw_init_impl() permanently
enables the memory area for both read and write operations.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/memory/renesas-rpc-if.c | 26 ++++++++------------------
 1 file changed, 8 insertions(+), 18 deletions(-)

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index 104c28532c20..50294e5d2bf5 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -312,6 +312,14 @@ static int xspi_hw_init_impl(struct rpcif_priv *xspi, bool hyperflash)
 	regmap_update_bits(xspi->regmap, XSPI_INTE, XSPI_INTE_CMDCMPE,
 			   XSPI_INTE_CMDCMPE);
 
+	regmap_update_bits(xspi->regmap, XSPI_BMCTL0,
+			   XSPI_BMCTL0_CS0ACC(0xff), XSPI_BMCTL0_CS0ACC(0x03));
+
+	regmap_update_bits(xspi->regmap, XSPI_BMCFG,
+			   XSPI_BMCFG_WRMD | XSPI_BMCFG_MWRCOMB |
+			   XSPI_BMCFG_MWRSIZE(0xff) | XSPI_BMCFG_PREEN,
+			   0 | XSPI_BMCFG_MWRCOMB | XSPI_BMCFG_MWRSIZE(0x0f) |
+			   XSPI_BMCFG_PREEN);
 	return 0;
 }
 
@@ -869,15 +877,6 @@ static size_t xspi_dirmap_read_impl(struct rpcif_priv *xspi, u64 offs,
 			   XSPI_CMCFG1_RDCMD_UPPER_BYTE(xspi->command) |
 			   XSPI_CMCFG1_RDLATE(xspi->dummy));
 
-	regmap_update_bits(xspi->regmap, XSPI_BMCTL0, XSPI_BMCTL0_CS0ACC(0xff),
-			   XSPI_BMCTL0_CS0ACC(0x01));
-
-	regmap_update_bits(xspi->regmap, XSPI_BMCFG,
-			   XSPI_BMCFG_WRMD | XSPI_BMCFG_MWRCOMB |
-			   XSPI_BMCFG_MWRSIZE(0xff) | XSPI_BMCFG_PREEN,
-			   0 | XSPI_BMCFG_MWRCOMB | XSPI_BMCFG_MWRSIZE(0x0f) |
-			   XSPI_BMCFG_PREEN);
-
 	regmap_update_bits(xspi->regmap, XSPI_LIOCFGCS0, XSPI_LIOCFG_PRTMD(0x3ff),
 			   XSPI_LIOCFG_PRTMD(xspi->proto));
 
@@ -945,15 +944,6 @@ ssize_t xspi_dirmap_write(struct device *dev, u64 offs, size_t len, const void *
 			   XSPI_CMCFG2_WRCMD_UPPER(xspi->command) |
 			   XSPI_CMCFG2_WRLATE(xspi->dummy));
 
-	regmap_update_bits(xspi->regmap, XSPI_BMCTL0,
-			   XSPI_BMCTL0_CS0ACC(0xff), XSPI_BMCTL0_CS0ACC(0x03));
-
-	regmap_update_bits(xspi->regmap, XSPI_BMCFG,
-			   XSPI_BMCFG_WRMD | XSPI_BMCFG_MWRCOMB |
-			   XSPI_BMCFG_MWRSIZE(0xff) | XSPI_BMCFG_PREEN,
-			   0 | XSPI_BMCFG_MWRCOMB | XSPI_BMCFG_MWRSIZE(0x0f) |
-			   XSPI_BMCFG_PREEN);
-
 	regmap_update_bits(xspi->regmap, XSPI_LIOCFGCS0, XSPI_LIOCFG_PRTMD(0x3ff),
 			   XSPI_LIOCFG_PRTMD(xspi->proto));
 
-- 
2.54.0


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

* [PATCH 3/7] memory: renesas-rpc-if: Consolidate XSPI_CDTBUF0 updates in write path
  2026-07-15 22:24 [PATCH 0/7] memory: renesas-rpc-if: Optimize transfer overhead and implement runtime PM autosuspend Prabhakar
  2026-07-15 22:24 ` [PATCH 1/7] memory: renesas-rpc-if: Mark XSPI_CDD1BUF0 as volatile Prabhakar
  2026-07-15 22:24 ` [PATCH 2/7] memory: renesas-rpc-if: Move static bridge configurations out of dirmap hot paths Prabhakar
@ 2026-07-15 22:24 ` Prabhakar
  2026-07-15 22:24 ` [PATCH 4/7] memory: renesas-rpc-if: Consolidate XSPI_CDTBUF0 updates in read path Prabhakar
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Prabhakar @ 2026-07-15 22:24 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Mark Brown, Geert Uytterhoeven
  Cc: linux-renesas-soc, linux-spi, linux-kernel, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Program the XSPI_CDTBUF0 TRTYPE, DATASIZE and ADDSIZE fields with a
single regmap_update_bits() call in the RPCIF_DATA_OUT transfer path.

The existing code updates these fields through three separate
read-modify-write operations even though all values are known before the
transfer request is issued. Combine the updates into a single register
access to reduce overhead and simplify the configuration sequence.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/memory/renesas-rpc-if.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index 50294e5d2bf5..e406afc42616 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -660,17 +660,12 @@ static int xspi_manual_xfer_impl(struct rpcif_priv *xspi)
 			u32 bytes_left = xspi->xferlen - pos;
 			u32 nbytes, data[2], *p = data;
 
-			regmap_update_bits(xspi->regmap, XSPI_CDTBUF0,
-					   XSPI_CDTBUF_TRTYPE, XSPI_CDTBUF_TRTYPE);
-
 			nbytes = bytes_left >= max ? max : bytes_left;
 
 			regmap_update_bits(xspi->regmap, XSPI_CDTBUF0,
-					   XSPI_CDTBUF_DATASIZE(0xf),
-					   XSPI_CDTBUF_DATASIZE(nbytes));
-
-			regmap_update_bits(xspi->regmap, XSPI_CDTBUF0,
+					   XSPI_CDTBUF_TRTYPE | XSPI_CDTBUF_DATASIZE(0xf) |
 					   XSPI_CDTBUF_ADDSIZE(0x7),
+					   XSPI_CDTBUF_TRTYPE | XSPI_CDTBUF_DATASIZE(nbytes) |
 					   XSPI_CDTBUF_ADDSIZE(xspi->addr_nbytes));
 
 			memcpy(data, xspi->buffer + pos, nbytes);
-- 
2.54.0


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

* [PATCH 4/7] memory: renesas-rpc-if: Consolidate XSPI_CDTBUF0 updates in read path
  2026-07-15 22:24 [PATCH 0/7] memory: renesas-rpc-if: Optimize transfer overhead and implement runtime PM autosuspend Prabhakar
                   ` (2 preceding siblings ...)
  2026-07-15 22:24 ` [PATCH 3/7] memory: renesas-rpc-if: Consolidate XSPI_CDTBUF0 updates in write path Prabhakar
@ 2026-07-15 22:24 ` Prabhakar
  2026-07-15 22:24 ` [PATCH 5/7] memory: renesas-rpc-if: Consolidate command setup register programming Prabhakar
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Prabhakar @ 2026-07-15 22:24 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Mark Brown, Geert Uytterhoeven
  Cc: linux-renesas-soc, linux-spi, linux-kernel, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Program the XSPI_CDTBUF0 fields used by the RPCIF_DATA_IN transfer path
through a single regmap_update_bits() call.

The existing code updates TRTYPE, DATASIZE, ADDSIZE and LATE using
multiple read-modify-write operations on the same register, even though
all field values are known before the transfer starts.

Build the register mask and value first, then perform a single register
update. This reduces register accesses and simplifies the transfer setup
without changing functionality.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/memory/renesas-rpc-if.c | 31 +++++++++++++++++--------------
 1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index e406afc42616..c768e9c18556 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -697,30 +697,33 @@ static int xspi_manual_xfer_impl(struct rpcif_priv *xspi)
 		while (pos < xspi->xferlen) {
 			u32 bytes_left = xspi->xferlen - pos;
 			u32 nbytes, data[2], *p = data;
-
-			regmap_update_bits(xspi->regmap, XSPI_CDTBUF0,
-					   XSPI_CDTBUF_TRTYPE,
-					   ~(u32)XSPI_CDTBUF_TRTYPE);
+			u32 cdtbuf0_mask, cdtbuf0_val;
 
 			/* nbytes can be up to 8 bytes */
 			nbytes = bytes_left >= max ? max : bytes_left;
 
-			regmap_update_bits(xspi->regmap, XSPI_CDTBUF0,
-					   XSPI_CDTBUF_DATASIZE(0xf),
-					   XSPI_CDTBUF_DATASIZE(nbytes));
+			/* clear TRTYPE */
+			cdtbuf0_mask = XSPI_CDTBUF_TRTYPE;
+			cdtbuf0_val = 0;
 
-			regmap_update_bits(xspi->regmap, XSPI_CDTBUF0,
-					   XSPI_CDTBUF_ADDSIZE(0x7),
-					   XSPI_CDTBUF_ADDSIZE(xspi->addr_nbytes));
+			/* program DATASIZE */
+			cdtbuf0_mask |= XSPI_CDTBUF_DATASIZE(0xf);
+			cdtbuf0_val |= XSPI_CDTBUF_DATASIZE(nbytes);
+
+			/* program ADDSIZE */
+			cdtbuf0_mask |= XSPI_CDTBUF_ADDSIZE(0x7);
+			cdtbuf0_val |= XSPI_CDTBUF_ADDSIZE(xspi->addr_nbytes);
+
+			/* program LATE */
+			cdtbuf0_mask |= XSPI_CDTBUF_LATE(0x1f);
+			cdtbuf0_val |= XSPI_CDTBUF_LATE(xspi->dummy);
+
+			regmap_update_bits(xspi->regmap, XSPI_CDTBUF0, cdtbuf0_mask, cdtbuf0_val);
 
 			if (xspi->addr_nbytes)
 				regmap_write(xspi->regmap, XSPI_CDABUF0,
 					     xspi->smadr + pos);
 
-			regmap_update_bits(xspi->regmap, XSPI_CDTBUF0,
-					   XSPI_CDTBUF_LATE(0x1f),
-					   XSPI_CDTBUF_LATE(xspi->dummy));
-
 			regmap_update_bits(xspi->regmap, XSPI_CDCTL0,
 					   XSPI_CDCTL0_TRREQ, XSPI_CDCTL0_TRREQ);
 
-- 
2.54.0


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

* [PATCH 5/7] memory: renesas-rpc-if: Consolidate command setup register programming
  2026-07-15 22:24 [PATCH 0/7] memory: renesas-rpc-if: Optimize transfer overhead and implement runtime PM autosuspend Prabhakar
                   ` (3 preceding siblings ...)
  2026-07-15 22:24 ` [PATCH 4/7] memory: renesas-rpc-if: Consolidate XSPI_CDTBUF0 updates in read path Prabhakar
@ 2026-07-15 22:24 ` Prabhakar
  2026-07-15 22:24 ` [PATCH 6/7] spi: spi-rpc-if: Implement 200ms runtime PM autosuspend delay Prabhakar
                   ` (2 subsequent siblings)
  7 siblings, 0 replies; 14+ messages in thread
From: Prabhakar @ 2026-07-15 22:24 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Mark Brown, Geert Uytterhoeven
  Cc: linux-renesas-soc, linux-spi, linux-kernel, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Simplify the command setup sequence in xspi_manual_xfer_impl() by
combining updates to XSPI_CDCTL0 and XSPI_CDTBUF0.

Clear the TRNUM and TRREQ fields in XSPI_CDCTL0 with a single
regmap_update_bits() call. Likewise, program the command, command size
and address size fields in XSPI_CDTBUF0 with a single regmap_write(),
eliminating the subsequent ADDSIZE update. The intermediate write of
zero to XSPI_CDABUF0 is also redundant, as the register is immediately
programmed with the transfer address.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/memory/renesas-rpc-if.c | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index c768e9c18556..d98991266887 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -636,18 +636,14 @@ static int xspi_manual_xfer_impl(struct rpcif_priv *xspi)
 	u32 pos = 0, max = 8;
 	int ret = 0;
 
-	regmap_update_bits(xspi->regmap, XSPI_CDCTL0, XSPI_CDCTL0_TRNUM(0x3),
+	/* Clear transaction number and request */
+	regmap_update_bits(xspi->regmap, XSPI_CDCTL0,
+			   XSPI_CDCTL0_TRNUM(0x3) | XSPI_CDCTL0_TRREQ,
 			   XSPI_CDCTL0_TRNUM(0));
 
-	regmap_update_bits(xspi->regmap, XSPI_CDCTL0, XSPI_CDCTL0_TRREQ, 0);
-
 	regmap_write(xspi->regmap, XSPI_CDTBUF0,
-		     XSPI_CDTBUF_CMDSIZE(0x1) | XSPI_CDTBUF_CMD_FIELD(xspi->command));
-
-	regmap_write(xspi->regmap, XSPI_CDABUF0, 0);
-
-	regmap_update_bits(xspi->regmap, XSPI_CDTBUF0, XSPI_CDTBUF_ADDSIZE(0x7),
-			   XSPI_CDTBUF_ADDSIZE(xspi->addr_nbytes));
+		     XSPI_CDTBUF_CMDSIZE(0x1) | XSPI_CDTBUF_CMD_FIELD(xspi->command) |
+		     XSPI_CDTBUF_ADDSIZE(xspi->addr_nbytes));
 
 	regmap_write(xspi->regmap, XSPI_CDABUF0, xspi->smadr);
 
-- 
2.54.0


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

* [PATCH 6/7] spi: spi-rpc-if: Implement 200ms runtime PM autosuspend delay
  2026-07-15 22:24 [PATCH 0/7] memory: renesas-rpc-if: Optimize transfer overhead and implement runtime PM autosuspend Prabhakar
                   ` (4 preceding siblings ...)
  2026-07-15 22:24 ` [PATCH 5/7] memory: renesas-rpc-if: Consolidate command setup register programming Prabhakar
@ 2026-07-15 22:24 ` Prabhakar
  2026-07-18 13:14   ` Mark Brown
  2026-07-15 22:24 ` [PATCH 7/7] memory: renesas-rpc-if: Use runtime PM autosuspend after transfers Prabhakar
  2026-07-19 14:42 ` [PATCH 0/7] memory: renesas-rpc-if: Optimize transfer overhead and implement runtime PM autosuspend Krzysztof Kozlowski
  7 siblings, 1 reply; 14+ messages in thread
From: Prabhakar @ 2026-07-15 22:24 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Mark Brown, Geert Uytterhoeven
  Cc: linux-renesas-soc, linux-spi, linux-kernel, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Enable and configure the runtime PM autosuspend infrastructure during
the controller probe sequence to safeguard chunked flash operations.

The underlying hardware controller handles memory-mapped page programming
by dividing data transfers into an automated sequence of consecutive
64-byte chunks. To prevent the power management framework from
aggressively gating the interface between these individual chunk frames
or during immediate out-of-band status checks, an explicit 200ms delay
window is required.

Configure this temporal cushion using pm_runtime_set_autosuspend_delay()
and pm_runtime_use_autosuspend() at probe time, ensuring proper cleanup
via pm_runtime_dont_use_autosuspend() in error and driver removal
pathways. This guarantees interface continuity across the full lifecycle
of a multi-chunk write operation.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/spi/spi-rpc-if.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/spi/spi-rpc-if.c b/drivers/spi/spi-rpc-if.c
index b63c7856e758..9a740342d0f7 100644
--- a/drivers/spi/spi-rpc-if.c
+++ b/drivers/spi/spi-rpc-if.c
@@ -161,6 +161,8 @@ static int rpcif_spi_probe(struct platform_device *pdev)
 
 	ctlr->dev.of_node = parent->of_node;
 
+	pm_runtime_set_autosuspend_delay(rpc->dev, 200);
+	pm_runtime_use_autosuspend(rpc->dev);
 	pm_runtime_enable(rpc->dev);
 
 	ctlr->num_chipselect = 1;
@@ -183,6 +185,7 @@ static int rpcif_spi_probe(struct platform_device *pdev)
 	return 0;
 
 out_disable_rpm:
+	pm_runtime_dont_use_autosuspend(rpc->dev);
 	pm_runtime_disable(rpc->dev);
 	return error;
 }
@@ -193,6 +196,7 @@ static void rpcif_spi_remove(struct platform_device *pdev)
 	struct rpcif *rpc = spi_controller_get_devdata(ctlr);
 
 	spi_unregister_controller(ctlr);
+	pm_runtime_dont_use_autosuspend(rpc->dev);
 	pm_runtime_disable(rpc->dev);
 }
 
-- 
2.54.0


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

* [PATCH 7/7] memory: renesas-rpc-if: Use runtime PM autosuspend after transfers
  2026-07-15 22:24 [PATCH 0/7] memory: renesas-rpc-if: Optimize transfer overhead and implement runtime PM autosuspend Prabhakar
                   ` (5 preceding siblings ...)
  2026-07-15 22:24 ` [PATCH 6/7] spi: spi-rpc-if: Implement 200ms runtime PM autosuspend delay Prabhakar
@ 2026-07-15 22:24 ` Prabhakar
  2026-07-19 14:42 ` [PATCH 0/7] memory: renesas-rpc-if: Optimize transfer overhead and implement runtime PM autosuspend Krzysztof Kozlowski
  7 siblings, 0 replies; 14+ messages in thread
From: Prabhakar @ 2026-07-15 22:24 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Mark Brown, Geert Uytterhoeven
  Cc: linux-renesas-soc, linux-spi, linux-kernel, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Replace pm_runtime_put() with pm_runtime_put_autosuspend() after manual
transfers and direct memory-mapped read/write operations.

Flash page programming may be performed as a sequence of closely spaced
transfer operations. Calling pm_runtime_put() after each operation allows
the runtime PM core to suspend the controller between successive
transfers, introducing unnecessary suspend/resume cycles and potentially
interrupting multi-step transfer sequences.

Use pm_runtime_put_autosuspend() instead so the controller remains
active while transfers continue, allowing it to suspend only after an
idle period.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 drivers/memory/renesas-rpc-if.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/memory/renesas-rpc-if.c b/drivers/memory/renesas-rpc-if.c
index d98991266887..ec901a5a99aa 100644
--- a/drivers/memory/renesas-rpc-if.c
+++ b/drivers/memory/renesas-rpc-if.c
@@ -776,7 +776,7 @@ int rpcif_manual_xfer(struct device *dev)
 
 	ret = rpc->info->impl->manual_xfer(rpc);
 
-	pm_runtime_put(dev);
+	pm_runtime_put_autosuspend(dev);
 
 	return ret;
 }
@@ -891,7 +891,7 @@ ssize_t rpcif_dirmap_read(struct device *dev, u64 offs, size_t len, void *buf)
 
 	read = rpc->info->impl->dirmap_read(rpc, offs, len, buf);
 
-	pm_runtime_put(dev);
+	pm_runtime_put_autosuspend(dev);
 
 	return read;
 }
@@ -948,7 +948,7 @@ ssize_t xspi_dirmap_write(struct device *dev, u64 offs, size_t len, const void *
 		regmap_update_bits(xspi->regmap, XSPI_BMCTL1,
 				   XSPI_BMCTL1_MWRPUSH, XSPI_BMCTL1_MWRPUSH);
 
-	pm_runtime_put(dev);
+	pm_runtime_put_autosuspend(dev);
 
 	return writebytes;
 }
-- 
2.54.0


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

* Re: [PATCH 6/7] spi: spi-rpc-if: Implement 200ms runtime PM autosuspend delay
  2026-07-15 22:24 ` [PATCH 6/7] spi: spi-rpc-if: Implement 200ms runtime PM autosuspend delay Prabhakar
@ 2026-07-18 13:14   ` Mark Brown
  2026-07-20 11:45     ` Lad, Prabhakar
  0 siblings, 1 reply; 14+ messages in thread
From: Mark Brown @ 2026-07-18 13:14 UTC (permalink / raw)
  To: Prabhakar
  Cc: Krzysztof Kozlowski, Geert Uytterhoeven, linux-renesas-soc,
	linux-spi, linux-kernel, Prabhakar, Biju Das, Fabrizio Castro,
	Lad Prabhakar

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

On Wed, Jul 15, 2026 at 11:24:16PM +0100, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> Enable and configure the runtime PM autosuspend infrastructure during
> the controller probe sequence to safeguard chunked flash operations.

Acked-by: Mark Brown <broonie@kernel.org>

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

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

* Re: [PATCH 0/7] memory: renesas-rpc-if: Optimize transfer overhead and implement runtime PM autosuspend
  2026-07-15 22:24 [PATCH 0/7] memory: renesas-rpc-if: Optimize transfer overhead and implement runtime PM autosuspend Prabhakar
                   ` (6 preceding siblings ...)
  2026-07-15 22:24 ` [PATCH 7/7] memory: renesas-rpc-if: Use runtime PM autosuspend after transfers Prabhakar
@ 2026-07-19 14:42 ` Krzysztof Kozlowski
  2026-07-20 11:42   ` Lad, Prabhakar
  7 siblings, 1 reply; 14+ messages in thread
From: Krzysztof Kozlowski @ 2026-07-19 14:42 UTC (permalink / raw)
  To: Prabhakar, Mark Brown, Geert Uytterhoeven
  Cc: linux-renesas-soc, linux-spi, linux-kernel, Prabhakar, Biju Das,
	Fabrizio Castro, Lad Prabhakar

On 16/07/2026 00:24, Prabhakar wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> 
> Hi all,
> 
> This patch series optimizes the Renesas RPC-IF driver by significantly
> reducing software overhead in both the direct memory-mapped (dirmap) and
> manual transfer paths, maximizing transaction throughput, and introducing
> runtime PM autosuspend to prevent aggressive power gating during
> consecutive flash operations.

Why is spi patch in the middle of the set without any explanation of
merging dependencies/order?

Best regards,
Krzysztof

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

* Re: [PATCH 0/7] memory: renesas-rpc-if: Optimize transfer overhead and implement runtime PM autosuspend
  2026-07-19 14:42 ` [PATCH 0/7] memory: renesas-rpc-if: Optimize transfer overhead and implement runtime PM autosuspend Krzysztof Kozlowski
@ 2026-07-20 11:42   ` Lad, Prabhakar
  0 siblings, 0 replies; 14+ messages in thread
From: Lad, Prabhakar @ 2026-07-20 11:42 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Mark Brown, Geert Uytterhoeven, linux-renesas-soc, linux-spi,
	linux-kernel, Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar

Hi Krzysztof,

On Sun, Jul 19, 2026 at 3:42 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> On 16/07/2026 00:24, Prabhakar wrote:
> > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > Hi all,
> >
> > This patch series optimizes the Renesas RPC-IF driver by significantly
> > reducing software overhead in both the direct memory-mapped (dirmap) and
> > manual transfer paths, maximizing transaction throughput, and introducing
> > runtime PM autosuspend to prevent aggressive power gating during
> > consecutive flash operations.
>
> Why is spi patch in the middle of the set without any explanation of
> merging dependencies/order?
>
The rpc-if core driver acts as the low-level controller wrapper used
by spi-rpc-if. In this series, autosuspend is enabled in the SPI
driver, while the corresponding pm_runtime_put_autosuspend() calls are
added in the core wrapper driver.

Apologies for missing this explanation in the cover letter. Since
these changes do not break build or runtime bisectability if applied
independently, the rpc-if and spi-rpc-if patches can safely go through
separate maintainer trees.

Mark has already Acked the SPI patch. I will check if he is OK with
the SPI driver changes going via the memory tree. If not, I will
update the cover letter and split the patches up to send them
separately in v2.

Cheers,
Prabhakar

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

* Re: [PATCH 6/7] spi: spi-rpc-if: Implement 200ms runtime PM autosuspend delay
  2026-07-18 13:14   ` Mark Brown
@ 2026-07-20 11:45     ` Lad, Prabhakar
  2026-07-20 11:51       ` Mark Brown
  0 siblings, 1 reply; 14+ messages in thread
From: Lad, Prabhakar @ 2026-07-20 11:45 UTC (permalink / raw)
  To: Mark Brown, Krzysztof Kozlowski
  Cc: Geert Uytterhoeven, linux-renesas-soc, linux-spi, linux-kernel,
	Prabhakar, Biju Das, Fabrizio Castro, Lad Prabhakar

Hi Mark,

Thank you for the review.

On Sat, Jul 18, 2026 at 2:14 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Wed, Jul 15, 2026 at 11:24:16PM +0100, Prabhakar wrote:
> > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > Enable and configure the runtime PM autosuspend infrastructure during
> > the controller probe sequence to safeguard chunked flash operations.
>
> Acked-by: Mark Brown <broonie@kernel.org>
>
Since there is no strict dependency between the rpc-if core driver and
spi-rpc-if patches, Krzysztof asked about the patch order/routing.

Is it OK with you if this SPI patch goes via the memory subsystem tree
along with the rest of the series?

Cheers,
Prabhakar

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

* Re: [PATCH 6/7] spi: spi-rpc-if: Implement 200ms runtime PM autosuspend delay
  2026-07-20 11:45     ` Lad, Prabhakar
@ 2026-07-20 11:51       ` Mark Brown
  2026-07-20 11:57         ` Lad, Prabhakar
  0 siblings, 1 reply; 14+ messages in thread
From: Mark Brown @ 2026-07-20 11:51 UTC (permalink / raw)
  To: Lad, Prabhakar
  Cc: Krzysztof Kozlowski, Geert Uytterhoeven, linux-renesas-soc,
	linux-spi, linux-kernel, Prabhakar, Biju Das, Fabrizio Castro,
	Lad Prabhakar

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

On Mon, Jul 20, 2026 at 12:45:29PM +0100, Lad, Prabhakar wrote:
> On Sat, Jul 18, 2026 at 2:14 PM Mark Brown <broonie@kernel.org> wrote:

> > On Wed, Jul 15, 2026 at 11:24:16PM +0100, Prabhakar wrote:
> > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

> > > Enable and configure the runtime PM autosuspend infrastructure during
> > > the controller probe sequence to safeguard chunked flash operations.

> > Acked-by: Mark Brown <broonie@kernel.org>

> Since there is no strict dependency between the rpc-if core driver and
> spi-rpc-if patches, Krzysztof asked about the patch order/routing.

> Is it OK with you if this SPI patch goes via the memory subsystem tree
> along with the rest of the series?

That's what an ack menas, though if there's no actual dependency I could
just take it.

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

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

* Re: [PATCH 6/7] spi: spi-rpc-if: Implement 200ms runtime PM autosuspend delay
  2026-07-20 11:51       ` Mark Brown
@ 2026-07-20 11:57         ` Lad, Prabhakar
  0 siblings, 0 replies; 14+ messages in thread
From: Lad, Prabhakar @ 2026-07-20 11:57 UTC (permalink / raw)
  To: Mark Brown
  Cc: Krzysztof Kozlowski, Geert Uytterhoeven, linux-renesas-soc,
	linux-spi, linux-kernel, Prabhakar, Biju Das, Fabrizio Castro,
	Lad Prabhakar

Hi Mark,

On Mon, Jul 20, 2026 at 12:51 PM Mark Brown <broonie@kernel.org> wrote:
>
> On Mon, Jul 20, 2026 at 12:45:29PM +0100, Lad, Prabhakar wrote:
> > On Sat, Jul 18, 2026 at 2:14 PM Mark Brown <broonie@kernel.org> wrote:
>
> > > On Wed, Jul 15, 2026 at 11:24:16PM +0100, Prabhakar wrote:
> > > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> > > > Enable and configure the runtime PM autosuspend infrastructure during
> > > > the controller probe sequence to safeguard chunked flash operations.
>
> > > Acked-by: Mark Brown <broonie@kernel.org>
>
> > Since there is no strict dependency between the rpc-if core driver and
> > spi-rpc-if patches, Krzysztof asked about the patch order/routing.
>
> > Is it OK with you if this SPI patch goes via the memory subsystem tree
> > along with the rest of the series?
>
> That's what an ack menas, though if there's no actual dependency I could
> just take it.
>
Got it, thanks!

Please go ahead and take this SPI patch through the SPI tree. I'll
split the series for v2 and send the remaining core rpc-if patches
through the memory tree via Krzysztof.

Cheers,
Prabhakar

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

end of thread, other threads:[~2026-07-20 11:57 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-15 22:24 [PATCH 0/7] memory: renesas-rpc-if: Optimize transfer overhead and implement runtime PM autosuspend Prabhakar
2026-07-15 22:24 ` [PATCH 1/7] memory: renesas-rpc-if: Mark XSPI_CDD1BUF0 as volatile Prabhakar
2026-07-15 22:24 ` [PATCH 2/7] memory: renesas-rpc-if: Move static bridge configurations out of dirmap hot paths Prabhakar
2026-07-15 22:24 ` [PATCH 3/7] memory: renesas-rpc-if: Consolidate XSPI_CDTBUF0 updates in write path Prabhakar
2026-07-15 22:24 ` [PATCH 4/7] memory: renesas-rpc-if: Consolidate XSPI_CDTBUF0 updates in read path Prabhakar
2026-07-15 22:24 ` [PATCH 5/7] memory: renesas-rpc-if: Consolidate command setup register programming Prabhakar
2026-07-15 22:24 ` [PATCH 6/7] spi: spi-rpc-if: Implement 200ms runtime PM autosuspend delay Prabhakar
2026-07-18 13:14   ` Mark Brown
2026-07-20 11:45     ` Lad, Prabhakar
2026-07-20 11:51       ` Mark Brown
2026-07-20 11:57         ` Lad, Prabhakar
2026-07-15 22:24 ` [PATCH 7/7] memory: renesas-rpc-if: Use runtime PM autosuspend after transfers Prabhakar
2026-07-19 14:42 ` [PATCH 0/7] memory: renesas-rpc-if: Optimize transfer overhead and implement runtime PM autosuspend Krzysztof Kozlowski
2026-07-20 11:42   ` Lad, Prabhakar

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