* [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC
@ 2026-06-17 8:29 Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 01/32] dmaengine: Add devm_dma_request_chan() Tommaso Merciai
` (32 more replies)
0 siblings, 33 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
Dear All,
This patch series adds RSPI support for the Renesas RZ/G3E SoC, which
features three RSPI controllers. The series also enables DMA support in
the RSPI driver, and backports the necessary infrastructure changes
into linux-6.1.y-cip.
The series is structured as follows:
- Clock entries for the three RSPI instances on RZ/G3E SoC
- DT binding updates: document DMA properties and add RZ/G3E compatible
- Device tree nodes for RZ/G3E RSPI controllers and SMARC board enablement
- Driver improvements backported from mainline: DMA support, device-managed
APIs, bug fixes for clock setup and FIFO thresholds
Kind Regards,
Tommaso
Andy Shevchenko (1):
spi: Introduce internal spi_xfer_is_dma_mapped() helper
Bence Csókás (1):
dmaengine: Add devm_dma_request_chan()
Cosmin Tanislav (21):
spi: dt-bindings: renesas,rzv2h-rspi: document optional support for
DMA
spi: dt-bindings: renesas,rzv2h-rspi: allow multiple DMAs
spi: rzv2h-rspi: make resets optional
spi: rzv2h-rspi: make FIFO size chip-specific
spi: rzv2h-rspi: make clocks chip-specific
spi: rzv2h-rspi: move register writes out of rzv2h_rspi_setup_clock()
spi: rzv2h-rspi: avoid recomputing transfer frequency
spi: rzv2h-rspi: make transfer clock rate finding chip-specific
spi: rzv2h-rspi: add support for using PCLK for transfer clock
spi: rzv2h-rspi: add support for variable transfer clock
spi: rzv2h-rspi: add support for loopback mode
spi: rzv2h-rspi: add support for RZ/T2H and RZ/N2H
spi: rzv2h-rspi: fix rzv2h_rspi_transfer_one() indentation
spi: rzv2h-rspi: remove call to spi_finalize_current_transfer()
spi: rzv2h-rspi: use device-managed APIs
spi: rzv2h-rspi: store RX interrupt in state
spi: rzv2h-rspi: set MUST_RX/MUST_TX
spi: rzv2h-rspi: set TX FIFO threshold to 0
spi: rzv2h-rspi: enable TX buffer empty interrupt
spi: rzv2h-rspi: split out PIO transfer
spi: rzv2h-rspi: add support for DMA mode
John Madieu (1):
spi: rzv2h-rspi: Fix silent failure in clock setup error path
Lad Prabhakar (3):
spi: rzv2h-rspi: Fix max_speed_hz advertising prohibited bit rate
spi: rzv2h-rspi: Fix invalid SPR=0/BRDV=0 clock configuration
spi: rzv2h-rspi: Simplify clock rate search function signatures
Tommaso Merciai (5):
clk: renesas: r9a09g047: Add entries for the RSPIs
spi: dt-bindings: renesas,rzv2h-rspi: Document dmas property
spi: dt-bindings: renesas,rzv2h-rspi: Document RZ/G3E SoC support
arm64: dts: renesas: r9a09g047: Add RSPI nodes
arm64: dts: renesas: r9a09g047e57-smarc: Enable RSPI0
.../bindings/spi/renesas,rzv2h-rspi.yaml | 19 +-
arch/arm64/boot/dts/renesas/r9a09g047.dtsi | 84 +++
.../boot/dts/renesas/r9a09g047e57-smarc.dts | 16 +
drivers/clk/renesas/r9a09g047-cpg.c | 24 +
drivers/dma/dmaengine.c | 30 +
drivers/spi/internals.h | 8 +
drivers/spi/spi-rzv2h-rspi.c | 574 +++++++++++++++---
include/linux/dmaengine.h | 7 +
8 files changed, 672 insertions(+), 90 deletions(-)
--
2.54.0
^ permalink raw reply [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 01/32] dmaengine: Add devm_dma_request_chan()
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 02/32] spi: Introduce internal spi_xfer_is_dma_mapped() helper Tommaso Merciai
` (31 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Bence Csókás <csokas.bence@prolan.hu>
commit 08bf1663c21a3e815eda28fa242d84c945ca3b94 upstream.
Expand the arsenal of devm functions for DMA devices, this time for
requesting channels.
Signed-off-by: Bence Csókás <csokas.bence@prolan.hu>
Link: https://lore.kernel.org/r/20250610082256.400492-2-csokas.bence@prolan.hu
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/dma/dmaengine.c | 30 ++++++++++++++++++++++++++++++
include/linux/dmaengine.h | 7 +++++++
2 files changed, 37 insertions(+)
diff --git a/drivers/dma/dmaengine.c b/drivers/dma/dmaengine.c
index 892e8389232e..3911d8d0def4 100644
--- a/drivers/dma/dmaengine.c
+++ b/drivers/dma/dmaengine.c
@@ -926,6 +926,36 @@ void dma_release_channel(struct dma_chan *chan)
}
EXPORT_SYMBOL_GPL(dma_release_channel);
+static void dmaenginem_release_channel(void *chan)
+{
+ dma_release_channel(chan);
+}
+
+/**
+ * devm_dma_request_chan - try to allocate an exclusive slave channel
+ * @dev: pointer to client device structure
+ * @name: slave channel name
+ *
+ * Returns pointer to appropriate DMA channel on success or an error pointer.
+ *
+ * The operation is managed and will be undone on driver detach.
+ */
+
+struct dma_chan *devm_dma_request_chan(struct device *dev, const char *name)
+{
+ struct dma_chan *chan = dma_request_chan(dev, name);
+ int ret = 0;
+
+ if (!IS_ERR(chan))
+ ret = devm_add_action_or_reset(dev, dmaenginem_release_channel, chan);
+
+ if (ret)
+ return ERR_PTR(ret);
+
+ return chan;
+}
+EXPORT_SYMBOL_GPL(devm_dma_request_chan);
+
/**
* dmaengine_get - register interest in dma_channels
*/
diff --git a/include/linux/dmaengine.h b/include/linux/dmaengine.h
index 3576c6e89fea..368a03920c92 100644
--- a/include/linux/dmaengine.h
+++ b/include/linux/dmaengine.h
@@ -1489,6 +1489,7 @@ struct dma_chan *__dma_request_channel(const dma_cap_mask_t *mask,
struct dma_chan *dma_request_chan(struct device *dev, const char *name);
struct dma_chan *dma_request_chan_by_mask(const dma_cap_mask_t *mask);
+struct dma_chan *devm_dma_request_chan(struct device *dev, const char *name);
void dma_release_channel(struct dma_chan *chan);
int dma_get_slave_caps(struct dma_chan *chan, struct dma_slave_caps *caps);
@@ -1525,6 +1526,12 @@ static inline struct dma_chan *dma_request_chan_by_mask(
{
return ERR_PTR(-ENODEV);
}
+
+static inline struct dma_chan *devm_dma_request_chan(struct device *dev, const char *name)
+{
+ return ERR_PTR(-ENODEV);
+}
+
static inline void dma_release_channel(struct dma_chan *chan)
{
}
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 02/32] spi: Introduce internal spi_xfer_is_dma_mapped() helper
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 01/32] dmaengine: Add devm_dma_request_chan() Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 03/32] clk: renesas: r9a09g047: Add entries for the RSPIs Tommaso Merciai
` (30 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
commit 0535cf64e4b1ead224fbbe1c25c81221a298c5e4 upstream.
There are few drivers that use the same pattern to check if the transfer
is DMA mapped or not. Provide a helper.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Neil Armstrong <neil.armstrong@linaro.org> # on SM8650-QRD
Link: https://lore.kernel.org/r/20240531194723.1761567-2-andriy.shevchenko@linux.intel.com
Reviewed-by: Bryan O'Donoghue <bryan.odonoghue@linaro.org>
Reviewed-by: Serge Semin <fancer.lancer@gmail.com>
Tested-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/internals.h | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/spi/internals.h b/drivers/spi/internals.h
index 4a28a8395552..47a87c2a6979 100644
--- a/drivers/spi/internals.h
+++ b/drivers/spi/internals.h
@@ -40,4 +40,12 @@ static inline void spi_unmap_buf(struct spi_controller *ctlr,
}
#endif /* CONFIG_HAS_DMA */
+static inline bool spi_xfer_is_dma_mapped(struct spi_controller *ctlr,
+ struct spi_device *spi,
+ struct spi_transfer *xfer)
+{
+ return ctlr->can_dma && ctlr->can_dma(ctlr, spi, xfer) &&
+ ctlr->cur_msg_mapped;
+}
+
#endif /* __LINUX_SPI_INTERNALS_H */
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 03/32] clk: renesas: r9a09g047: Add entries for the RSPIs
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 01/32] dmaengine: Add devm_dma_request_chan() Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 02/32] spi: Introduce internal spi_xfer_is_dma_mapped() helper Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 04/32] spi: dt-bindings: renesas,rzv2h-rspi: document optional support for DMA Tommaso Merciai
` (29 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
commit 24a51f8bf869053de4927e0798d17dbcda9ea3cf upstream.
Add clock and reset entries for the Renesas RZ/G3E RSPI IPs.
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/ca59fdcc6c32b8f6659aa9218f1a42d2bcd258c3.1771344527.git.tommaso.merciai.xr@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/clk/renesas/r9a09g047-cpg.c | 24 ++++++++++++++++++++++++
1 file changed, 24 insertions(+)
diff --git a/drivers/clk/renesas/r9a09g047-cpg.c b/drivers/clk/renesas/r9a09g047-cpg.c
index 728a72093d87..bca513f48133 100644
--- a/drivers/clk/renesas/r9a09g047-cpg.c
+++ b/drivers/clk/renesas/r9a09g047-cpg.c
@@ -218,6 +218,24 @@ static const struct rzv2h_mod_clk r9a09g047_mod_clks[] __initconst = {
BUS_MSTOP(5, BIT(13))),
DEF_MOD("wdt_3_clk_loco", CLK_QEXTAL, 5, 2, 2, 18,
BUS_MSTOP(5, BIT(13))),
+ DEF_MOD("rspi_0_pclk", CLK_PLLCLN_DIV8, 5, 4, 2, 20,
+ BUS_MSTOP(11, BIT(0))),
+ DEF_MOD("rspi_0_pclk_sfr", CLK_PLLCLN_DIV8, 5, 5, 2, 21,
+ BUS_MSTOP(11, BIT(0))),
+ DEF_MOD("rspi_0_tclk", CLK_PLLCLN_DIV8, 5, 6, 2, 22,
+ BUS_MSTOP(11, BIT(0))),
+ DEF_MOD("rspi_1_pclk", CLK_PLLCLN_DIV8, 5, 7, 2, 23,
+ BUS_MSTOP(11, BIT(1))),
+ DEF_MOD("rspi_1_pclk_sfr", CLK_PLLCLN_DIV8, 5, 8, 2, 24,
+ BUS_MSTOP(11, BIT(1))),
+ DEF_MOD("rspi_1_tclk", CLK_PLLCLN_DIV8, 5, 9, 2, 25,
+ BUS_MSTOP(11, BIT(1))),
+ DEF_MOD("rspi_2_pclk", CLK_PLLCLN_DIV8, 5, 10, 2, 26,
+ BUS_MSTOP(11, BIT(2))),
+ DEF_MOD("rspi_2_pclk_sfr", CLK_PLLCLN_DIV8, 5, 11, 2, 27,
+ BUS_MSTOP(11, BIT(2))),
+ DEF_MOD("rspi_2_tclk", CLK_PLLCLN_DIV8, 5, 12, 2, 28,
+ BUS_MSTOP(11, BIT(2))),
DEF_MOD("rsci0_pclk", CLK_PLLCLN_DIV16, 5, 13, 2, 29,
BUS_MSTOP(11, BIT(3))),
DEF_MOD("rsci0_tclk", CLK_PLLCLN_DIV16, 5, 14, 2, 30,
@@ -441,6 +459,12 @@ static const struct rzv2h_reset r9a09g047_resets[] __initconst = {
DEF_RST(7, 6, 3, 7), /* WDT_1_RESET */
DEF_RST(7, 7, 3, 8), /* WDT_2_RESET */
DEF_RST(7, 8, 3, 9), /* WDT_3_RESET */
+ DEF_RST(7, 11, 3, 12), /* RSPI_0_PRESETN */
+ DEF_RST(7, 12, 3, 13), /* RSPI_0_TRESETN */
+ DEF_RST(7, 13, 3, 14), /* RSPI_1_PRESETN */
+ DEF_RST(7, 14, 3, 15), /* RSPI_1_TRESETN */
+ DEF_RST(7, 15, 3, 16), /* RSPI_2_PRESETN */
+ DEF_RST(8, 0, 3, 17), /* RSPI_2_TRESETN */
DEF_RST(8, 1, 3, 18), /* RSCI0_PRESETN */
DEF_RST(8, 2, 3, 19), /* RSCI0_TRESETN */
DEF_RST(8, 3, 3, 20), /* RSCI1_PRESETN */
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 04/32] spi: dt-bindings: renesas,rzv2h-rspi: document optional support for DMA
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (2 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 03/32] clk: renesas: r9a09g047: Add entries for the RSPIs Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 05/32] spi: dt-bindings: renesas,rzv2h-rspi: allow multiple DMAs Tommaso Merciai
` (28 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit 163345e356722e98ba57cd120787d6e991da7b1d upstream.
The IP supports using DMA for reading and writing data from the FIFO,
document it.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20251201134229.600817-11-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
.../devicetree/bindings/spi/renesas,rzv2h-rspi.yaml | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml b/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml
index 394438b3d680..d7c32eb9b981 100644
--- a/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml
+++ b/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml
@@ -56,6 +56,14 @@ properties:
- const: presetn
- const: tresetn
+ dmas:
+ maxItems: 2
+
+ dma-names:
+ items:
+ - const: rx
+ - const: tx
+
power-domains:
maxItems: 1
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 05/32] spi: dt-bindings: renesas,rzv2h-rspi: allow multiple DMAs
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (3 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 04/32] spi: dt-bindings: renesas,rzv2h-rspi: document optional support for DMA Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 06/32] spi: dt-bindings: renesas,rzv2h-rspi: Document dmas property Tommaso Merciai
` (27 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit 4d28f38f64ef69ab27839069ef3346c3c878d137 upstream.
All supported SoCs have multiple DMA controllers that can be used with
the RSPI peripheral. The current bindings only allow a single pair of RX
and TX DMAs.
The DMA core allows specifying multiple DMAs with the same name, and it
will pick the first available one.
There is an exception in the base dt-schema rules specifically for
allowing this behavior (dtschema/schemas/dma/dma.yaml).
dma-names:
anyOf:
- uniqueItems: true
- items:
# Hack around Renesas bindings which repeat entries to support
# multiple possible DMA providers
enum: [rx, tx]
Allow multiple DMAs to have the same name and only restrict the possible
names of the DMA channels, not their count.
For RZ/T2H and RZ/N2H SoCs, limit the number of DMA channels to 6, as
they have 3 DMA controllers.
For RZ/V2H and RZ/V2N SoCs, limit the number of DMA channels to 10, as
they have 5 DMA controllers.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
Link: https://patch.msgid.link/20260128215132.1353381-2-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
[tm: Removed allOf block to resolve conflicts]
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
.../devicetree/bindings/spi/renesas,rzv2h-rspi.yaml | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml b/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml
index d7c32eb9b981..21f53d9fea66 100644
--- a/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml
+++ b/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml
@@ -57,12 +57,16 @@ properties:
- const: tresetn
dmas:
- maxItems: 2
+ minItems: 2
+ maxItems: 10
dma-names:
+ minItems: 2
+ maxItems: 10
items:
- - const: rx
- - const: tx
+ enum:
+ - rx
+ - tx
power-domains:
maxItems: 1
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 06/32] spi: dt-bindings: renesas,rzv2h-rspi: Document dmas property
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (4 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 05/32] spi: dt-bindings: renesas,rzv2h-rspi: allow multiple DMAs Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 07/32] spi: dt-bindings: renesas,rzv2h-rspi: Document RZ/G3E SoC support Tommaso Merciai
` (26 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
commit c2edd7841f58cf228347b91256f0d9efcc1a1f50 upstream.
Document the dmas property to state it must be specified as TX/RX DMA
specifier pairs.
This clarifies the expected ordering and improves binding readability
without changing behavior.
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/ea6ed3b82c5a326732adfc0fcdb2922bfcad2591.1771344527.git.tommaso.merciai.xr@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml | 3 +++
1 file changed, 3 insertions(+)
diff --git a/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml b/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml
index 21f53d9fea66..0f49d1d697b3 100644
--- a/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml
+++ b/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml
@@ -59,6 +59,9 @@ properties:
dmas:
minItems: 2
maxItems: 10
+ description:
+ Must contain a list of pairs of references to DMA specifiers, one for
+ transmission, and one for reception.
dma-names:
minItems: 2
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 07/32] spi: dt-bindings: renesas,rzv2h-rspi: Document RZ/G3E SoC support
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (5 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 06/32] spi: dt-bindings: renesas,rzv2h-rspi: Document dmas property Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 08/32] spi: rzv2h-rspi: make resets optional Tommaso Merciai
` (25 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
commit 5b7ac8ca0eae522735d24f7c5c2296c8094328b1 upstream.
Document the RSPI controller on the Renesas RZ/G3E SoC. The block is
compatible with the RSPI implementation found on the RZ/V2H(P) family.
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/f6b43f0dc64e13b1c9942c164dea30002d4c4466.1771344527.git.tommaso.merciai.xr@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml b/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml
index 0f49d1d697b3..a96b049b39e2 100644
--- a/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml
+++ b/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml
@@ -17,7 +17,9 @@ properties:
oneOf:
- const: renesas,r9a09g057-rspi # RZ/V2H(P)
- items:
- - const: renesas,r9a09g056-rspi # RZ/V2N
+ - enum:
+ - renesas,r9a09g047-rspi # RZ/G3E
+ - renesas,r9a09g056-rspi # RZ/V2N
- const: renesas,r9a09g057-rspi
reg:
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 08/32] spi: rzv2h-rspi: make resets optional
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (6 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 07/32] spi: dt-bindings: renesas,rzv2h-rspi: Document RZ/G3E SoC support Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 09/32] spi: rzv2h-rspi: make FIFO size chip-specific Tommaso Merciai
` (24 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit aead5ae91e4cbadac817d15737eca3b531237448 upstream.
The Renesas RZ/T2H (R9A09G077) and RZ/N2H (R9A09G087) SoCs don't have
reset lines for the SPI peripheral, make them optional to prepare for
adding support for them.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251119161434.595677-2-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index cf4272f99378..66006d3e7c73 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -381,8 +381,8 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
rspi->resets[0].id = "presetn";
rspi->resets[1].id = "tresetn";
- ret = devm_reset_control_bulk_get_exclusive(dev, RSPI_RESET_NUM,
- rspi->resets);
+ ret = devm_reset_control_bulk_get_optional_exclusive(dev, RSPI_RESET_NUM,
+ rspi->resets);
if (ret)
return dev_err_probe(dev, ret, "cannot get resets\n");
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 09/32] spi: rzv2h-rspi: make FIFO size chip-specific
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (7 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 08/32] spi: rzv2h-rspi: make resets optional Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 10/32] spi: rzv2h-rspi: make clocks chip-specific Tommaso Merciai
` (23 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit 8e89ee6cd2b928a8431bef61e8b851ce5df1ecb0 upstream.
The Renesas RZ/T2H (R9A09G077) and RZ/N2H (R9A09G087) SoCs have a
different FIFO size compared to RZ/V2H. Add a chip-specific structure,
and set the FIFO size inside it, to prepare for adding support for them.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251119161434.595677-3-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index 66006d3e7c73..2914d356292b 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -58,7 +58,6 @@
/* Register SPDCR2 */
#define RSPI_SPDCR2_TTRG GENMASK(11, 8)
#define RSPI_SPDCR2_RTRG GENMASK(3, 0)
-#define RSPI_FIFO_SIZE 16
/* Register SPSR */
#define RSPI_SPSR_SPRF BIT(15)
@@ -69,9 +68,14 @@
#define RSPI_RESET_NUM 2
#define RSPI_CLK_NUM 3
+struct rzv2h_rspi_info {
+ unsigned int fifo_size;
+};
+
struct rzv2h_rspi_priv {
struct reset_control_bulk_data resets[RSPI_RESET_NUM];
struct spi_controller *controller;
+ const struct rzv2h_rspi_info *info;
void __iomem *base;
struct clk *tclk;
wait_queue_head_t wait;
@@ -302,7 +306,7 @@ static int rzv2h_rspi_prepare_message(struct spi_controller *ctlr,
writeb(0, rspi->base + RSPI_SSLP);
/* Setup FIFO thresholds */
- conf16 = FIELD_PREP(RSPI_SPDCR2_TTRG, RSPI_FIFO_SIZE - 1);
+ conf16 = FIELD_PREP(RSPI_SPDCR2_TTRG, rspi->info->fifo_size - 1);
conf16 |= FIELD_PREP(RSPI_SPDCR2_RTRG, 0);
writew(conf16, rspi->base + RSPI_SPDCR2);
@@ -359,6 +363,8 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
rspi->controller = controller;
+ rspi->info = device_get_match_data(dev);
+
rspi->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(rspi->base))
return PTR_ERR(rspi->base);
@@ -444,8 +450,12 @@ static int rzv2h_rspi_remove(struct platform_device *pdev)
return 0;
}
+static const struct rzv2h_rspi_info rzv2h_info = {
+ .fifo_size = 16,
+};
+
static const struct of_device_id rzv2h_rspi_match[] = {
- { .compatible = "renesas,r9a09g057-rspi" },
+ { .compatible = "renesas,r9a09g057-rspi", &rzv2h_info },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, rzv2h_rspi_match);
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 10/32] spi: rzv2h-rspi: make clocks chip-specific
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (8 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 09/32] spi: rzv2h-rspi: make FIFO size chip-specific Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 11/32] spi: rzv2h-rspi: move register writes out of rzv2h_rspi_setup_clock() Tommaso Merciai
` (22 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit ebd7d6ae0dc7d65e21460c928519f40ccf95f3b9 upstream.
The Renesas RZ/T2H (R9A09G077) and RZ/N2H (R9A09G087) SoCs have
different clocks compared to RZ/V2H. Set the number of clocks and the
name of the transfer clock in the chip-specific structure to prepare for
adding support for them.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251119161434.595677-4-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index 2914d356292b..4f8c653579ac 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -66,10 +66,11 @@
#define RSPI_SPSRC_CLEAR 0xfd80
#define RSPI_RESET_NUM 2
-#define RSPI_CLK_NUM 3
struct rzv2h_rspi_info {
+ const char *tclk_name;
unsigned int fifo_size;
+ unsigned int num_clks;
};
struct rzv2h_rspi_priv {
@@ -370,11 +371,11 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
return PTR_ERR(rspi->base);
ret = devm_clk_bulk_get_all_enabled(dev, &clks);
- if (ret != RSPI_CLK_NUM)
+ if (ret != rspi->info->num_clks)
return dev_err_probe(dev, ret >= 0 ? -EINVAL : ret,
"cannot get clocks\n");
- for (i = 0; i < RSPI_CLK_NUM; i++) {
- if (!strcmp(clks[i].id, "tclk")) {
+ for (i = 0; i < rspi->info->num_clks; i++) {
+ if (!strcmp(clks[i].id, rspi->info->tclk_name)) {
rspi->tclk = clks[i].clk;
break;
}
@@ -451,7 +452,9 @@ static int rzv2h_rspi_remove(struct platform_device *pdev)
}
static const struct rzv2h_rspi_info rzv2h_info = {
+ .tclk_name = "tclk",
.fifo_size = 16,
+ .num_clks = 3,
};
static const struct of_device_id rzv2h_rspi_match[] = {
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 11/32] spi: rzv2h-rspi: move register writes out of rzv2h_rspi_setup_clock()
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (9 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 10/32] spi: rzv2h-rspi: make clocks chip-specific Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 12/32] spi: rzv2h-rspi: avoid recomputing transfer frequency Tommaso Merciai
` (21 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit 1b7ce968ab2579702ea9dbc2fb599e540bbd8c88 upstream.
In preparation for caching the last requested transfer frequency, move
register writes outside of rzv2h_rspi_setup_clock().
The transfer list is iterated to determine the speed of the transfer
and the bits per word.
The speed of the transfer is used to compute SPR and BRDV inside
rzv2h_rspi_setup_clock().
BRDV and SPB are stored in the SPCMD register.
Move the transfer iteration earlier, move the SPR and BRDV writing out
of rzv2h_rspi_setup_clock(), consolidate writing BRDV and SPB into the
initial write to the SPCMD register.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251119161434.595677-5-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 45 ++++++++++++++++++++----------------
1 file changed, 25 insertions(+), 20 deletions(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index 4f8c653579ac..e61289877eff 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -83,6 +83,8 @@ struct rzv2h_rspi_priv {
unsigned int bytes_per_word;
u32 freq;
u16 status;
+ u8 spr;
+ u8 brdv;
};
#define RZV2H_RSPI_TX(func, type) \
@@ -260,8 +262,8 @@ static u32 rzv2h_rspi_setup_clock(struct rzv2h_rspi_priv *rspi, u32 hz)
return 0;
clock_found:
- rzv2h_rspi_reg_rmw(rspi, RSPI_SPCMD, RSPI_SPCMD_BRDV, brdv);
- writeb(spr, rspi->base + RSPI_SPBR);
+ rspi->spr = spr;
+ rspi->brdv = brdv;
return rzv2h_rspi_calc_bitrate(tclk_rate, spr, brdv);
}
@@ -280,6 +282,25 @@ static int rzv2h_rspi_prepare_message(struct spi_controller *ctlr,
/* Make sure SPCR.SPE is 0 before amending the configuration */
rzv2h_rspi_spe_disable(rspi);
+ list_for_each_entry(xfer, &message->transfers, transfer_list) {
+ if (!xfer->speed_hz)
+ continue;
+
+ speed_hz = min(xfer->speed_hz, speed_hz);
+ bits_per_word = xfer->bits_per_word;
+ }
+
+ if (speed_hz == U32_MAX)
+ return -EINVAL;
+
+ rspi->bytes_per_word = roundup_pow_of_two(BITS_TO_BYTES(bits_per_word));
+
+ rspi->freq = rzv2h_rspi_setup_clock(rspi, speed_hz);
+ if (!rspi->freq)
+ return -EINVAL;
+
+ writeb(rspi->spr, rspi->base + RSPI_SPBR);
+
/* Configure the device to work in "host" mode */
conf32 = RSPI_SPCR_MSTR;
@@ -298,6 +319,8 @@ static int rzv2h_rspi_prepare_message(struct spi_controller *ctlr,
conf32 = FIELD_PREP(RSPI_SPCMD_CPOL, !!(spi->mode & SPI_CPOL));
conf32 |= FIELD_PREP(RSPI_SPCMD_CPHA, !!(spi->mode & SPI_CPHA));
conf32 |= FIELD_PREP(RSPI_SPCMD_LSBF, !!(spi->mode & SPI_LSB_FIRST));
+ conf32 |= FIELD_PREP(RSPI_SPCMD_SPB, bits_per_word - 1);
+ conf32 |= FIELD_PREP(RSPI_SPCMD_BRDV, rspi->brdv);
conf32 |= FIELD_PREP(RSPI_SPCMD_SSLKP, 1);
conf32 |= FIELD_PREP(RSPI_SPCMD_SSLA, spi_get_chipselect(spi, 0));
writel(conf32, rspi->base + RSPI_SPCMD);
@@ -313,24 +336,6 @@ static int rzv2h_rspi_prepare_message(struct spi_controller *ctlr,
rzv2h_rspi_clear_fifos(rspi);
- list_for_each_entry(xfer, &message->transfers, transfer_list) {
- if (!xfer->speed_hz)
- continue;
-
- speed_hz = min(xfer->speed_hz, speed_hz);
- bits_per_word = xfer->bits_per_word;
- }
-
- if (speed_hz == U32_MAX)
- return -EINVAL;
-
- rspi->bytes_per_word = roundup_pow_of_two(BITS_TO_BYTES(bits_per_word));
- rzv2h_rspi_reg_rmw(rspi, RSPI_SPCMD, RSPI_SPCMD_SPB, bits_per_word - 1);
-
- rspi->freq = rzv2h_rspi_setup_clock(rspi, speed_hz);
- if (!rspi->freq)
- return -EINVAL;
-
rzv2h_rspi_spe_enable(rspi);
return 0;
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 12/32] spi: rzv2h-rspi: avoid recomputing transfer frequency
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (10 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 11/32] spi: rzv2h-rspi: move register writes out of rzv2h_rspi_setup_clock() Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 13/32] spi: rzv2h-rspi: make transfer clock rate finding chip-specific Tommaso Merciai
` (20 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit 88782493204512fcf4e020e2385bca3e3c5bd4c0 upstream.
Renesas RZ/T2H (R9A09G077) and RZ/N2H (R9A09G087) SoCs have a more
complicated algorithm for calculating the optimal SPI transfer frequency
compared to RZ/V2H, as the clock from which the SPI frequency is
generated supports multiple dividers.
Cache the requested transfer frequency and skip calling
rzv2h_rspi_setup_clock() if it matches the last used one to prepare for
adding support for variable clock frequency handling.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251119161434.595677-6-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index e61289877eff..f22f418325d8 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -81,6 +81,7 @@ struct rzv2h_rspi_priv {
struct clk *tclk;
wait_queue_head_t wait;
unsigned int bytes_per_word;
+ u32 last_speed_hz;
u32 freq;
u16 status;
u8 spr;
@@ -295,9 +296,13 @@ static int rzv2h_rspi_prepare_message(struct spi_controller *ctlr,
rspi->bytes_per_word = roundup_pow_of_two(BITS_TO_BYTES(bits_per_word));
- rspi->freq = rzv2h_rspi_setup_clock(rspi, speed_hz);
- if (!rspi->freq)
- return -EINVAL;
+ if (speed_hz != rspi->last_speed_hz) {
+ rspi->freq = rzv2h_rspi_setup_clock(rspi, speed_hz);
+ if (!rspi->freq)
+ return -EINVAL;
+
+ rspi->last_speed_hz = speed_hz;
+ }
writeb(rspi->spr, rspi->base + RSPI_SPBR);
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 13/32] spi: rzv2h-rspi: make transfer clock rate finding chip-specific
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (11 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 12/32] spi: rzv2h-rspi: avoid recomputing transfer frequency Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 14/32] spi: rzv2h-rspi: add support for using PCLK for transfer clock Tommaso Merciai
` (19 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit 77d931584dd38916b66c65320c80a65cbef4b122 upstream.
The Renesas RZ/T2H (R9A09G077) and RZ/N2H (R9A09G087) SoCs have a more
complicated clocking setup for the SPI transfer clock than RZ/V2H, as
the clock from which it is generated supports multiple dividers.
To prepare for adding support for these SoCs, split out the logic for
finding the SPR and BRDV for a fixed clock into
rzv2h_rspi_find_rate_fixed(), and add and use a .find_tclk_rate()
callback into the chip-specific structure.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251119161434.595677-7-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 62 ++++++++++++++++++++++++++++++------
1 file changed, 53 insertions(+), 9 deletions(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index f22f418325d8..fc0957d2bb2a 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -67,7 +67,18 @@
#define RSPI_RESET_NUM 2
+struct rzv2h_rspi_best_clock {
+ struct clk *clk;
+ unsigned long clk_rate;
+ unsigned long error;
+ u32 actual_hz;
+ u8 brdv;
+ u8 spr;
+};
+
struct rzv2h_rspi_info {
+ void (*find_tclk_rate)(struct clk *clk, u32 hz, u8 spr_min, u8 spr_max,
+ struct rzv2h_rspi_best_clock *best_clk);
const char *tclk_name;
unsigned int fifo_size;
unsigned int num_clks;
@@ -237,9 +248,13 @@ static inline u32 rzv2h_rspi_calc_bitrate(unsigned long tclk_rate, u8 spr,
return DIV_ROUND_UP(tclk_rate, (2 * (spr + 1) * (1 << brdv)));
}
-static u32 rzv2h_rspi_setup_clock(struct rzv2h_rspi_priv *rspi, u32 hz)
+static void rzv2h_rspi_find_rate_fixed(struct clk *clk, u32 hz,
+ u8 spr_min, u8 spr_max,
+ struct rzv2h_rspi_best_clock *best)
{
- unsigned long tclk_rate;
+ unsigned long clk_rate;
+ unsigned long error;
+ u32 actual_hz;
int spr;
u8 brdv;
@@ -252,21 +267,49 @@ static u32 rzv2h_rspi_setup_clock(struct rzv2h_rspi_priv *rspi, u32 hz)
* * n = SPR - is RSPI_SPBR.SPR (from 0 to 255)
* * N = BRDV - is RSPI_SPCMD.BRDV (from 0 to 3)
*/
- tclk_rate = clk_get_rate(rspi->tclk);
+ clk_rate = clk_get_rate(clk);
for (brdv = RSPI_SPCMD_BRDV_MIN; brdv <= RSPI_SPCMD_BRDV_MAX; brdv++) {
- spr = DIV_ROUND_UP(tclk_rate, hz * (1 << (brdv + 1)));
+ spr = DIV_ROUND_UP(clk_rate, hz * (1 << (brdv + 1)));
spr--;
- if (spr >= RSPI_SPBR_SPR_MIN && spr <= RSPI_SPBR_SPR_MAX)
+ if (spr >= spr_min && spr <= spr_max)
goto clock_found;
}
- return 0;
+ return;
clock_found:
- rspi->spr = spr;
- rspi->brdv = brdv;
+ actual_hz = rzv2h_rspi_calc_bitrate(clk_rate, spr, brdv);
+ error = abs((long)hz - (long)actual_hz);
+
+ if (error >= best->error)
+ return;
+
+ *best = (struct rzv2h_rspi_best_clock) {
+ .clk = clk,
+ .clk_rate = clk_rate,
+ .error = error,
+ .actual_hz = actual_hz,
+ .brdv = brdv,
+ .spr = spr,
+ };
+}
+
+static u32 rzv2h_rspi_setup_clock(struct rzv2h_rspi_priv *rspi, u32 hz)
+{
+ struct rzv2h_rspi_best_clock best_clock = {
+ .error = ULONG_MAX,
+ };
+
+ rspi->info->find_tclk_rate(rspi->tclk, hz, RSPI_SPBR_SPR_MIN,
+ RSPI_SPBR_SPR_MAX, &best_clock);
+
+ if (!best_clock.clk_rate)
+ return -EINVAL;
+
+ rspi->spr = best_clock.spr;
+ rspi->brdv = best_clock.brdv;
- return rzv2h_rspi_calc_bitrate(tclk_rate, spr, brdv);
+ return best_clock.actual_hz;
}
static int rzv2h_rspi_prepare_message(struct spi_controller *ctlr,
@@ -462,6 +505,7 @@ static int rzv2h_rspi_remove(struct platform_device *pdev)
}
static const struct rzv2h_rspi_info rzv2h_info = {
+ .find_tclk_rate = rzv2h_rspi_find_rate_fixed,
.tclk_name = "tclk",
.fifo_size = 16,
.num_clks = 3,
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 14/32] spi: rzv2h-rspi: add support for using PCLK for transfer clock
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (12 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 13/32] spi: rzv2h-rspi: make transfer clock rate finding chip-specific Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 15/32] spi: rzv2h-rspi: add support for variable " Tommaso Merciai
` (18 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit 1ce3e8adc7d0038e59a7c9f5c9e5f399ba0db5d6 upstream.
The Renesas RZ/T2H (R9A09G077) and RZ/N2H (R9A09G087) SoCs support
generating the SPI transfer clock from PCLK, with the quirk that SPR 0
is not supported, causing the highest achievable SPI transfer frequency
to be 31.25MHz.
Add support for generating the SPI transfer clock from PCLK.
Renesas RZ/V2H (R9A09G057) also has the BPEN bit used to enable this
option in the datasheet, but it is not explicitly documented and there's
no details about its limitations as there are on RZ/T2H.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251119161434.595677-8-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 22 +++++++++++++++++++++-
1 file changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index fc0957d2bb2a..786be6d533eb 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -34,6 +34,7 @@
#define RSPI_SPFCR 0x6c
/* Register SPCR */
+#define RSPI_SPCR_BPEN BIT(31)
#define RSPI_SPCR_MSTR BIT(30)
#define RSPI_SPCR_SPRIE BIT(17)
#define RSPI_SPCR_SCKASE BIT(12)
@@ -41,6 +42,7 @@
/* Register SPBR */
#define RSPI_SPBR_SPR_MIN 0
+#define RSPI_SPBR_SPR_PCLK_MIN 1
#define RSPI_SPBR_SPR_MAX 255
/* Register SPCMD */
@@ -79,6 +81,8 @@ struct rzv2h_rspi_best_clock {
struct rzv2h_rspi_info {
void (*find_tclk_rate)(struct clk *clk, u32 hz, u8 spr_min, u8 spr_max,
struct rzv2h_rspi_best_clock *best_clk);
+ void (*find_pclk_rate)(struct clk *clk, u32 hz, u8 spr_low, u8 spr_high,
+ struct rzv2h_rspi_best_clock *best_clk);
const char *tclk_name;
unsigned int fifo_size;
unsigned int num_clks;
@@ -90,6 +94,7 @@ struct rzv2h_rspi_priv {
const struct rzv2h_rspi_info *info;
void __iomem *base;
struct clk *tclk;
+ struct clk *pclk;
wait_queue_head_t wait;
unsigned int bytes_per_word;
u32 last_speed_hz;
@@ -97,6 +102,7 @@ struct rzv2h_rspi_priv {
u16 status;
u8 spr;
u8 brdv;
+ bool use_pclk;
};
#define RZV2H_RSPI_TX(func, type) \
@@ -303,9 +309,18 @@ static u32 rzv2h_rspi_setup_clock(struct rzv2h_rspi_priv *rspi, u32 hz)
rspi->info->find_tclk_rate(rspi->tclk, hz, RSPI_SPBR_SPR_MIN,
RSPI_SPBR_SPR_MAX, &best_clock);
+ /*
+ * T2H and N2H can also use PCLK as a source, which is 125MHz, but not
+ * when both SPR and BRDV are 0.
+ */
+ if (best_clock.error && rspi->info->find_pclk_rate)
+ rspi->info->find_pclk_rate(rspi->pclk, hz, RSPI_SPBR_SPR_PCLK_MIN,
+ RSPI_SPBR_SPR_MAX, &best_clock);
+
if (!best_clock.clk_rate)
return -EINVAL;
+ rspi->use_pclk = best_clock.clk == rspi->pclk;
rspi->spr = best_clock.spr;
rspi->brdv = best_clock.brdv;
@@ -358,6 +373,9 @@ static int rzv2h_rspi_prepare_message(struct spi_controller *ctlr,
/* SPI receive buffer full interrupt enable */
conf32 |= RSPI_SPCR_SPRIE;
+ /* Bypass synchronization circuit */
+ conf32 |= FIELD_PREP(RSPI_SPCR_BPEN, rspi->use_pclk);
+
writel(conf32, rspi->base + RSPI_SPCR);
/* Use SPCMD0 only */
@@ -430,7 +448,9 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
for (i = 0; i < rspi->info->num_clks; i++) {
if (!strcmp(clks[i].id, rspi->info->tclk_name)) {
rspi->tclk = clks[i].clk;
- break;
+ } else if (rspi->info->find_pclk_rate &&
+ !strcmp(clks[i].id, "pclk")) {
+ rspi->pclk = clks[i].clk;
}
}
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 15/32] spi: rzv2h-rspi: add support for variable transfer clock
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (13 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 14/32] spi: rzv2h-rspi: add support for using PCLK for transfer clock Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 16/32] spi: rzv2h-rspi: add support for loopback mode Tommaso Merciai
` (17 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit 9c9bf4fdc5e5d09d5f4280ed2c582df6e1f837d9 upstream.
The Renesas RZ/T2H (R9A09G077) and RZ/N2H (R9A09G087) SoCs have a more
complicated clocking setup for the SPI transfer clock than RZ/V2H, as
the clock from which it is generated supports multiple dividers.
To prepare for adding support for these SoCs, do the following changes.
Use the minimum frequency of SPI clock to calculate the SPI
controller's min_speed_hz, and the maximum frequency to calculate
max_speed_hz.
Apply the clock rate found by the .find_tclk_rate() to the found clock.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251119161434.595677-9-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 23 ++++++++++++++++++++---
1 file changed, 20 insertions(+), 3 deletions(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index 786be6d533eb..11721a1c75e5 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -305,6 +305,7 @@ static u32 rzv2h_rspi_setup_clock(struct rzv2h_rspi_priv *rspi, u32 hz)
struct rzv2h_rspi_best_clock best_clock = {
.error = ULONG_MAX,
};
+ int ret;
rspi->info->find_tclk_rate(rspi->tclk, hz, RSPI_SPBR_SPR_MIN,
RSPI_SPBR_SPR_MAX, &best_clock);
@@ -320,6 +321,10 @@ static u32 rzv2h_rspi_setup_clock(struct rzv2h_rspi_priv *rspi, u32 hz)
if (!best_clock.clk_rate)
return -EINVAL;
+ ret = clk_set_rate(best_clock.clk, best_clock.clk_rate);
+ if (ret)
+ return 0;
+
rspi->use_pclk = best_clock.clk == rspi->pclk;
rspi->spr = best_clock.spr;
rspi->brdv = best_clock.brdv;
@@ -423,8 +428,8 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
struct device *dev = &pdev->dev;
struct rzv2h_rspi_priv *rspi;
struct clk_bulk_data *clks;
- unsigned long tclk_rate;
int irq_rx, ret, i;
+ long tclk_rate;
controller = devm_spi_alloc_host(dev, sizeof(*rspi));
if (!controller)
@@ -457,8 +462,6 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
if (!rspi->tclk)
return dev_err_probe(dev, -EINVAL, "Failed to get tclk\n");
- tclk_rate = clk_get_rate(rspi->tclk);
-
rspi->resets[0].id = "presetn";
rspi->resets[1].id = "tresetn";
ret = devm_reset_control_bulk_get_optional_exclusive(dev, RSPI_RESET_NUM,
@@ -490,9 +493,23 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
controller->unprepare_message = rzv2h_rspi_unprepare_message;
controller->num_chipselect = 4;
controller->transfer_one = rzv2h_rspi_transfer_one;
+
+ tclk_rate = clk_round_rate(rspi->tclk, 0);
+ if (tclk_rate < 0) {
+ ret = tclk_rate;
+ goto quit_resets;
+ }
+
controller->min_speed_hz = rzv2h_rspi_calc_bitrate(tclk_rate,
RSPI_SPBR_SPR_MAX,
RSPI_SPCMD_BRDV_MAX);
+
+ tclk_rate = clk_round_rate(rspi->tclk, ULONG_MAX);
+ if (tclk_rate < 0) {
+ ret = tclk_rate;
+ goto quit_resets;
+ }
+
controller->max_speed_hz = rzv2h_rspi_calc_bitrate(tclk_rate,
RSPI_SPBR_SPR_MIN,
RSPI_SPCMD_BRDV_MIN);
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 16/32] spi: rzv2h-rspi: add support for loopback mode
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (14 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 15/32] spi: rzv2h-rspi: add support for variable " Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 17/32] spi: rzv2h-rspi: add support for RZ/T2H and RZ/N2H Tommaso Merciai
` (16 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit bc4f0b1e39035b9bb3d5d9692074702110f5e2b1 upstream.
Add support for loopback mode for debugging purposes, allowing us to
test the SPI controller at the maximum SPI transfer clock without being
limited by external wiring.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251119161434.595677-10-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index 11721a1c75e5..3c1cb76bc7b4 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -24,6 +24,7 @@
/* Registers */
#define RSPI_SPDR 0x00
#define RSPI_SPCR 0x08
+#define RSPI_SPPCR 0x0e
#define RSPI_SSLP 0x10
#define RSPI_SPBR 0x11
#define RSPI_SPSCR 0x13
@@ -40,6 +41,9 @@
#define RSPI_SPCR_SCKASE BIT(12)
#define RSPI_SPCR_SPE BIT(0)
+/* Register SPPCR */
+#define RSPI_SPPCR_SPLP2 BIT(1)
+
/* Register SPBR */
#define RSPI_SPBR_SPR_MIN 0
#define RSPI_SPBR_SPR_PCLK_MIN 1
@@ -342,6 +346,7 @@ static int rzv2h_rspi_prepare_message(struct spi_controller *ctlr,
u8 bits_per_word;
u32 conf32;
u16 conf16;
+ u8 conf8;
/* Make sure SPCR.SPE is 0 before amending the configuration */
rzv2h_rspi_spe_disable(rspi);
@@ -386,6 +391,10 @@ static int rzv2h_rspi_prepare_message(struct spi_controller *ctlr,
/* Use SPCMD0 only */
writeb(0x0, rspi->base + RSPI_SPSCR);
+ /* Setup loopback */
+ conf8 = FIELD_PREP(RSPI_SPPCR_SPLP2, !!(spi->mode & SPI_LOOP));
+ writeb(conf8, rspi->base + RSPI_SPPCR);
+
/* Setup mode */
conf32 = FIELD_PREP(RSPI_SPCMD_CPOL, !!(spi->mode & SPI_CPOL));
conf32 |= FIELD_PREP(RSPI_SPCMD_CPHA, !!(spi->mode & SPI_CPHA));
@@ -487,7 +496,7 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
}
controller->mode_bits = SPI_CPHA | SPI_CPOL | SPI_CS_HIGH |
- SPI_LSB_FIRST;
+ SPI_LSB_FIRST | SPI_LOOP;
controller->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
controller->prepare_message = rzv2h_rspi_prepare_message;
controller->unprepare_message = rzv2h_rspi_unprepare_message;
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 17/32] spi: rzv2h-rspi: add support for RZ/T2H and RZ/N2H
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (15 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 16/32] spi: rzv2h-rspi: add support for loopback mode Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 18/32] spi: rzv2h-rspi: fix rzv2h_rspi_transfer_one() indentation Tommaso Merciai
` (15 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit 0cc8cd824b9fb7fb087a2ec6b0c80d812cc4fde7 upstream.
Compared to the previously supported RZ/V2H, the Renesas RZ/T2H
(R9A09G077) and RZ/N2H (R9A09G087) SoCs have a smaller FIFO, no resets,
and only two clocks: PCLKSPIn and PCLK. PCLKSPIn, being the clock from
which the SPI transfer clock is generated, is the equivalent of the TCLK
clock from RZ/V2H. They also support generating the SPI transfer clock
from PCLK.
PCLKSPIn supports multiple dividers, generating multiple possible
frequencies from its parent. To handle this, do the following changes.
Use the minimum frequency of SPI clock to calculate the SPI controller's
min_speed_hz, and the maximum frequency to calculate max_speed_hz.
Add a new function, rzv2h_rspi_find_rate_variable(), which is used for
the .find_tclk_rate() callback, and which supports handling clocks with
a variable rate, with the following overall logic.
Iterate through all possible BRDV values.
For each BRDV, calculate two different SPRs, one for the clock's minimum
frequency, and one for the maxmimum, and iterate through each SPR
between them.
If the minimum SPR is higher than the upper SPR limit, the minimum rate
is too high to achieve the requested SPI frequency, skip to the next
BRDV.
For each SPR, calculate a rate and let the clock framework round it to
the closest supported rate of the clock.
The rate and SPR that generate a transfer frequency closest to the
requested SPI transfer frequency will be picked.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251119161434.595677-12-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 108 +++++++++++++++++++++++++++++++++++
1 file changed, 108 insertions(+)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index 3c1cb76bc7b4..2f4feaedaf97 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -258,6 +258,105 @@ static inline u32 rzv2h_rspi_calc_bitrate(unsigned long tclk_rate, u8 spr,
return DIV_ROUND_UP(tclk_rate, (2 * (spr + 1) * (1 << brdv)));
}
+static void rzv2h_rspi_find_rate_variable(struct clk *clk, u32 hz,
+ u8 spr_min, u8 spr_max,
+ struct rzv2h_rspi_best_clock *best)
+{
+ long clk_rate, clk_min_rate, clk_max_rate;
+ int min_rate_spr, max_rate_spr;
+ unsigned long error;
+ u32 actual_hz;
+ u8 brdv;
+ int spr;
+
+ /*
+ * On T2H / N2H, the source for the SPI clock is PCLKSPIn, which is a
+ * 1/32, 1/30, 1/25 or 1/24 divider of PLL4, which is 2400MHz,
+ * resulting in either 75MHz, 80MHz, 96MHz or 100MHz.
+ */
+ clk_min_rate = clk_round_rate(clk, 0);
+ if (clk_min_rate < 0)
+ return;
+
+ clk_max_rate = clk_round_rate(clk, ULONG_MAX);
+ if (clk_max_rate < 0)
+ return;
+
+ /*
+ * From the manual:
+ * Bit rate = f(PCLKSPIn) / (2 * (n + 1) * 2^N)
+ *
+ * If we adapt it to the current context, we get the following:
+ * hz = rate / ((spr + 1) * (1 << (brdv + 1)))
+ *
+ * This can be written in multiple forms depending on what we want to
+ * determine.
+ *
+ * To find the rate, having hz, spr and brdv:
+ * rate = hz * (spr + 1) * (1 << (brdv + 1)
+ *
+ * To find the spr, having rate, hz, and spr:
+ * spr = rate / (hz * (1 << (brdv + 1)) - 1
+ */
+
+ for (brdv = RSPI_SPCMD_BRDV_MIN; brdv <= RSPI_SPCMD_BRDV_MAX; brdv++) {
+ /* Calculate the divisor needed to find the SPR from a rate. */
+ u32 rate_div = hz * (1 << (brdv + 1));
+
+ /*
+ * If the SPR for the minimum rate is greater than the maximum
+ * allowed value skip this BRDV. The divisor increases with each
+ * BRDV iteration, so the following BRDV might result in a
+ * minimum SPR that is in the valid range.
+ */
+ min_rate_spr = DIV_ROUND_CLOSEST(clk_min_rate, rate_div) - 1;
+ if (min_rate_spr > spr_max)
+ continue;
+
+ /*
+ * If the SPR for the maximum rate is less than the minimum
+ * allowed value, exit. The divisor only increases with each
+ * BRDV iteration, so the following BRDV cannot result in a
+ * maximum SPR that is in the valid range.
+ */
+ max_rate_spr = DIV_ROUND_CLOSEST(clk_max_rate, rate_div) - 1;
+ if (max_rate_spr < spr_min)
+ break;
+
+ if (min_rate_spr < spr_min)
+ min_rate_spr = spr_min;
+
+ if (max_rate_spr > spr_max)
+ max_rate_spr = spr_max;
+
+ for (spr = min_rate_spr; spr <= max_rate_spr; spr++) {
+ clk_rate = (spr + 1) * rate_div;
+
+ clk_rate = clk_round_rate(clk, clk_rate);
+ if (clk_rate <= 0)
+ continue;
+
+ actual_hz = rzv2h_rspi_calc_bitrate(clk_rate, spr, brdv);
+ error = abs((long)hz - (long)actual_hz);
+
+ if (error >= best->error)
+ continue;
+
+ *best = (struct rzv2h_rspi_best_clock) {
+ .clk = clk,
+ .clk_rate = clk_rate,
+ .error = error,
+ .actual_hz = actual_hz,
+ .brdv = brdv,
+ .spr = spr,
+ };
+
+ if (!error)
+ return;
+ }
+ }
+}
+
static void rzv2h_rspi_find_rate_fixed(struct clk *clk, u32 hz,
u8 spr_min, u8 spr_max,
struct rzv2h_rspi_best_clock *best)
@@ -557,8 +656,17 @@ static const struct rzv2h_rspi_info rzv2h_info = {
.num_clks = 3,
};
+static const struct rzv2h_rspi_info rzt2h_info = {
+ .find_tclk_rate = rzv2h_rspi_find_rate_variable,
+ .find_pclk_rate = rzv2h_rspi_find_rate_fixed,
+ .tclk_name = "pclkspi",
+ .fifo_size = 4,
+ .num_clks = 2,
+};
+
static const struct of_device_id rzv2h_rspi_match[] = {
{ .compatible = "renesas,r9a09g057-rspi", &rzv2h_info },
+ { .compatible = "renesas,r9a09g077-rspi", &rzt2h_info },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, rzv2h_rspi_match);
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 18/32] spi: rzv2h-rspi: fix rzv2h_rspi_transfer_one() indentation
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (16 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 17/32] spi: rzv2h-rspi: add support for RZ/T2H and RZ/N2H Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 19/32] spi: rzv2h-rspi: remove call to spi_finalize_current_transfer() Tommaso Merciai
` (14 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit fb0140774aff45b8dc326987cc1da89484ecb081 upstream.
Add the missing space to align to open pararenthesis.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251201134229.600817-2-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index 2f4feaedaf97..d0c8e6fce025 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -225,8 +225,8 @@ static int rzv2h_rspi_receive(struct rzv2h_rspi_priv *rspi, void *rxbuf,
}
static int rzv2h_rspi_transfer_one(struct spi_controller *controller,
- struct spi_device *spi,
- struct spi_transfer *transfer)
+ struct spi_device *spi,
+ struct spi_transfer *transfer)
{
struct rzv2h_rspi_priv *rspi = spi_controller_get_devdata(controller);
unsigned int words_to_transfer, i;
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 19/32] spi: rzv2h-rspi: remove call to spi_finalize_current_transfer()
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (17 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 18/32] spi: rzv2h-rspi: fix rzv2h_rspi_transfer_one() indentation Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 20/32] spi: rzv2h-rspi: use device-managed APIs Tommaso Merciai
` (13 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit 9e4830b35dc0d522f45e1ec3ee5b1ff1648afe1b upstream.
A call to spi_finalize_current_transfer() is only needed when the SPI
transfer is completed outside of the current context, when the
.transfer_one() implementation returns > 0.
Since the SPI transfer is completed in the current context, and we
return 0 from .transfer_one(), the SPI core assumes that the transfer
has completed and it does not wait for the completion variable that
would be set by a call to spi_finalize_current_transfer().
Remove the call to spi_finalize_current_transfer().
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251201134229.600817-3-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index d0c8e6fce025..62ca0d7eed98 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -247,8 +247,6 @@ static int rzv2h_rspi_transfer_one(struct spi_controller *controller,
rzv2h_rspi_clear_all_irqs(rspi);
- spi_finalize_current_transfer(controller);
-
return ret;
}
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 20/32] spi: rzv2h-rspi: use device-managed APIs
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (18 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 19/32] spi: rzv2h-rspi: remove call to spi_finalize_current_transfer() Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 21/32] spi: rzv2h-rspi: store RX interrupt in state Tommaso Merciai
` (12 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit b73ac782828f27c2217a17bd26aa8710769f032d upstream.
Non-device-managed APIs were initially used here to avoid the buggy
interaction between PM domains and device-managed actions.
Commit f99508074e78 ("PM: domains: Detach on device_unbind_cleanup()")
fixed the interaction between PM domains and device-managed actions.
Simplify the code by using device-managed actions to unregister the SPI
controller and to assert and release the resets.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251201134229.600817-5-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
[tm: Use devm_reset_control_get_optional_exclusive() +
reset_control_deassert() + devm_reset_control_get_optional_exclusive()
instead of devm_reset_control_get_optional_exclusive_deasserted()]
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 77 +++++++++++++++++-------------------
1 file changed, 37 insertions(+), 40 deletions(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index 62ca0d7eed98..1153f2aba44a 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -93,7 +93,6 @@ struct rzv2h_rspi_info {
};
struct rzv2h_rspi_priv {
- struct reset_control_bulk_data resets[RSPI_RESET_NUM];
struct spi_controller *controller;
const struct rzv2h_rspi_info *info;
void __iomem *base;
@@ -528,11 +527,17 @@ static int rzv2h_rspi_unprepare_message(struct spi_controller *ctlr,
return 0;
}
+static void rzv2h_rspi_reset_assert(void *data)
+{
+ reset_control_assert(data);
+}
+
static int rzv2h_rspi_probe(struct platform_device *pdev)
{
struct spi_controller *controller;
struct device *dev = &pdev->dev;
struct rzv2h_rspi_priv *rspi;
+ struct reset_control *reset;
struct clk_bulk_data *clks;
int irq_rx, ret, i;
long tclk_rate;
@@ -568,28 +573,43 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
if (!rspi->tclk)
return dev_err_probe(dev, -EINVAL, "Failed to get tclk\n");
- rspi->resets[0].id = "presetn";
- rspi->resets[1].id = "tresetn";
- ret = devm_reset_control_bulk_get_optional_exclusive(dev, RSPI_RESET_NUM,
- rspi->resets);
+ reset = devm_reset_control_get_optional_exclusive(&pdev->dev, "presetn");
+ if (IS_ERR(reset))
+ return dev_err_probe(&pdev->dev, PTR_ERR(reset),
+ "cannot get presetn reset\n");
+
+ ret = reset_control_deassert(reset);
if (ret)
- return dev_err_probe(dev, ret, "cannot get resets\n");
+ return ret;
+
+ ret = devm_add_action_or_reset(&pdev->dev, rzv2h_rspi_reset_assert, reset);
+ if (ret)
+ return ret;
+
+ reset = devm_reset_control_get_optional_exclusive(&pdev->dev, "tresetn");
+ if (IS_ERR(reset))
+ return dev_err_probe(&pdev->dev, PTR_ERR(reset),
+ "cannot get tresetn reset\n");
+
+ ret = reset_control_deassert(reset);
+ if (ret)
+ return ret;
+
+ ret = devm_add_action_or_reset(&pdev->dev, rzv2h_rspi_reset_assert, reset);
+ if (ret)
+ return ret;
irq_rx = platform_get_irq_byname(pdev, "rx");
if (irq_rx < 0)
return dev_err_probe(dev, irq_rx, "cannot get IRQ 'rx'\n");
- ret = reset_control_bulk_deassert(RSPI_RESET_NUM, rspi->resets);
- if (ret)
- return dev_err_probe(dev, ret, "failed to deassert resets\n");
-
init_waitqueue_head(&rspi->wait);
ret = devm_request_irq(dev, irq_rx, rzv2h_rx_irq_handler, 0,
dev_name(dev), rspi);
if (ret) {
dev_err(dev, "cannot request `rx` IRQ\n");
- goto quit_resets;
+ return ret;
}
controller->mode_bits = SPI_CPHA | SPI_CPOL | SPI_CS_HIGH |
@@ -601,20 +621,16 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
controller->transfer_one = rzv2h_rspi_transfer_one;
tclk_rate = clk_round_rate(rspi->tclk, 0);
- if (tclk_rate < 0) {
- ret = tclk_rate;
- goto quit_resets;
- }
+ if (tclk_rate < 0)
+ return tclk_rate;
controller->min_speed_hz = rzv2h_rspi_calc_bitrate(tclk_rate,
RSPI_SPBR_SPR_MAX,
RSPI_SPCMD_BRDV_MAX);
tclk_rate = clk_round_rate(rspi->tclk, ULONG_MAX);
- if (tclk_rate < 0) {
- ret = tclk_rate;
- goto quit_resets;
- }
+ if (tclk_rate < 0)
+ return tclk_rate;
controller->max_speed_hz = rzv2h_rspi_calc_bitrate(tclk_rate,
RSPI_SPBR_SPR_MIN,
@@ -622,31 +638,13 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
device_set_node(&controller->dev, dev_fwnode(dev));
- ret = spi_register_controller(controller);
- if (ret) {
+ ret = devm_spi_register_controller(dev, controller);
+ if (ret)
dev_err(dev, "register controller failed\n");
- goto quit_resets;
- }
-
- return 0;
-
-quit_resets:
- reset_control_bulk_assert(RSPI_RESET_NUM, rspi->resets);
return ret;
}
-static int rzv2h_rspi_remove(struct platform_device *pdev)
-{
- struct rzv2h_rspi_priv *rspi = platform_get_drvdata(pdev);
-
- spi_unregister_controller(rspi->controller);
-
- reset_control_bulk_assert(RSPI_RESET_NUM, rspi->resets);
-
- return 0;
-}
-
static const struct rzv2h_rspi_info rzv2h_info = {
.find_tclk_rate = rzv2h_rspi_find_rate_fixed,
.tclk_name = "tclk",
@@ -671,7 +669,6 @@ MODULE_DEVICE_TABLE(of, rzv2h_rspi_match);
static struct platform_driver rzv2h_rspi_drv = {
.probe = rzv2h_rspi_probe,
- .remove = rzv2h_rspi_remove,
.driver = {
.name = "rzv2h_rspi",
.of_match_table = rzv2h_rspi_match,
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 21/32] spi: rzv2h-rspi: store RX interrupt in state
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (19 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 20/32] spi: rzv2h-rspi: use device-managed APIs Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 22/32] spi: rzv2h-rspi: set MUST_RX/MUST_TX Tommaso Merciai
` (11 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit 28b590bd4c6a051ec61cf286a46a8b14846e6fcf upstream.
In preparation for implementing DMA support, store the RX interrupt
number in the private state, to allow disabling it during DMA.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251201134229.600817-6-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index 1153f2aba44a..df1eab16cefd 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -100,6 +100,7 @@ struct rzv2h_rspi_priv {
struct clk *pclk;
wait_queue_head_t wait;
unsigned int bytes_per_word;
+ int irq_rx;
u32 last_speed_hz;
u32 freq;
u16 status;
@@ -539,8 +540,8 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
struct rzv2h_rspi_priv *rspi;
struct reset_control *reset;
struct clk_bulk_data *clks;
- int irq_rx, ret, i;
long tclk_rate;
+ int ret, i;
controller = devm_spi_alloc_host(dev, sizeof(*rspi));
if (!controller)
@@ -599,13 +600,13 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
if (ret)
return ret;
- irq_rx = platform_get_irq_byname(pdev, "rx");
- if (irq_rx < 0)
- return dev_err_probe(dev, irq_rx, "cannot get IRQ 'rx'\n");
+ rspi->irq_rx = platform_get_irq_byname(pdev, "rx");
+ if (rspi->irq_rx < 0)
+ return dev_err_probe(dev, rspi->irq_rx, "cannot get IRQ 'rx'\n");
init_waitqueue_head(&rspi->wait);
- ret = devm_request_irq(dev, irq_rx, rzv2h_rx_irq_handler, 0,
+ ret = devm_request_irq(dev, rspi->irq_rx, rzv2h_rx_irq_handler, 0,
dev_name(dev), rspi);
if (ret) {
dev_err(dev, "cannot request `rx` IRQ\n");
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 22/32] spi: rzv2h-rspi: set MUST_RX/MUST_TX
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (20 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 21/32] spi: rzv2h-rspi: store RX interrupt in state Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 23/32] spi: rzv2h-rspi: set TX FIFO threshold to 0 Tommaso Merciai
` (10 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit 6f9026b5a18acdf190d1622831b100aacfca0eb3 upstream.
In preparation for implementing DMA support, set MUST_RX and MUST_TX
flags on the controller so that we always receive non-NULL buffers.
The PIO mode already handles this manually by checking if rx_buf/tx_buf
are set on the transfer, and doing a dummy read/write if not.
DMA will not be able to implement this special handling, and although
the SPI controller advertises support for transmit-only or receive-only
transfers via SPCR's register TXMD bitfield, it does not seem to work.
Remove the special handling for PIO and let the SPI controller core
handle it.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251201134229.600817-7-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index df1eab16cefd..c5e66d188cc5 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -113,11 +113,7 @@ struct rzv2h_rspi_priv {
static inline void rzv2h_rspi_tx_##type(struct rzv2h_rspi_priv *rspi, \
const void *txbuf, \
unsigned int index) { \
- type buf = 0; \
- \
- if (txbuf) \
- buf = ((type *)txbuf)[index]; \
- \
+ type buf = ((type *)txbuf)[index]; \
func(buf, rspi->base + RSPI_SPDR); \
}
@@ -126,9 +122,7 @@ static inline void rzv2h_rspi_rx_##type(struct rzv2h_rspi_priv *rspi, \
void *rxbuf, \
unsigned int index) { \
type buf = func(rspi->base + RSPI_SPDR); \
- \
- if (rxbuf) \
- ((type *)rxbuf)[index] = buf; \
+ ((type *)rxbuf)[index] = buf; \
}
RZV2H_RSPI_TX(writel, u32)
@@ -615,6 +609,7 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
controller->mode_bits = SPI_CPHA | SPI_CPOL | SPI_CS_HIGH |
SPI_LSB_FIRST | SPI_LOOP;
+ controller->flags = SPI_CONTROLLER_MUST_RX | SPI_CONTROLLER_MUST_TX;
controller->bits_per_word_mask = SPI_BPW_RANGE_MASK(4, 32);
controller->prepare_message = rzv2h_rspi_prepare_message;
controller->unprepare_message = rzv2h_rspi_unprepare_message;
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 23/32] spi: rzv2h-rspi: set TX FIFO threshold to 0
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (21 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 22/32] spi: rzv2h-rspi: set MUST_RX/MUST_TX Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 24/32] spi: rzv2h-rspi: enable TX buffer empty interrupt Tommaso Merciai
` (9 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit a886baaaa6e12a9b7d5a9687d11d3b895f1b87c9 upstream.
In PIO mode we send data word-by-word, and wait for the received data
to be available after each sent word, making no use of the TX interrupt.
In DMA mode, we need to set the RX and TX FIFO thresholds to 0, as
described in the User Manual.
In preparation for implementing DMA support, set TX FIFO threshold to 0,
as RX FIFO threshold is already 0.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251201134229.600817-8-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index c5e66d188cc5..f4ebfcd1470b 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -501,7 +501,7 @@ static int rzv2h_rspi_prepare_message(struct spi_controller *ctlr,
writeb(0, rspi->base + RSPI_SSLP);
/* Setup FIFO thresholds */
- conf16 = FIELD_PREP(RSPI_SPDCR2_TTRG, rspi->info->fifo_size - 1);
+ conf16 = FIELD_PREP(RSPI_SPDCR2_TTRG, 0);
conf16 |= FIELD_PREP(RSPI_SPDCR2_RTRG, 0);
writew(conf16, rspi->base + RSPI_SPDCR2);
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 24/32] spi: rzv2h-rspi: enable TX buffer empty interrupt
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (22 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 23/32] spi: rzv2h-rspi: set TX FIFO threshold to 0 Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 25/32] spi: rzv2h-rspi: split out PIO transfer Tommaso Merciai
` (8 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit d49eea07de5851e1b8941ad6b6179be7ec36a986 upstream.
In preparation for implementing DMA support, enable the transmit buffer
empty interrupt, which is necessary for DMA to write more data to the
FIFO.
This does not affect the PIO mode as we do not even request the TX
interrupt line.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251201134229.600817-9-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index f4ebfcd1470b..ffdf8d8c490c 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -37,6 +37,7 @@
/* Register SPCR */
#define RSPI_SPCR_BPEN BIT(31)
#define RSPI_SPCR_MSTR BIT(30)
+#define RSPI_SPCR_SPTIE BIT(20)
#define RSPI_SPCR_SPRIE BIT(17)
#define RSPI_SPCR_SCKASE BIT(12)
#define RSPI_SPCR_SPE BIT(0)
@@ -474,6 +475,9 @@ static int rzv2h_rspi_prepare_message(struct spi_controller *ctlr,
/* SPI receive buffer full interrupt enable */
conf32 |= RSPI_SPCR_SPRIE;
+ /* SPI transmit buffer empty interrupt enable */
+ conf32 |= RSPI_SPCR_SPTIE;
+
/* Bypass synchronization circuit */
conf32 |= FIELD_PREP(RSPI_SPCR_BPEN, rspi->use_pclk);
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 25/32] spi: rzv2h-rspi: split out PIO transfer
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (23 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 24/32] spi: rzv2h-rspi: enable TX buffer empty interrupt Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 26/32] spi: rzv2h-rspi: add support for DMA mode Tommaso Merciai
` (7 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit 1e5e10df8b9be71ca64435cbe7c96b189e5ee293 upstream.
In preparation for implementing DMA support, split out the PIO transfer
code into its own function.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251201134229.600817-10-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 27 ++++++++++++++++++++-------
1 file changed, 20 insertions(+), 7 deletions(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index ffdf8d8c490c..3191eaddc9d5 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -219,17 +219,14 @@ static int rzv2h_rspi_receive(struct rzv2h_rspi_priv *rspi, void *rxbuf,
return 0;
}
-static int rzv2h_rspi_transfer_one(struct spi_controller *controller,
+static int rzv2h_rspi_transfer_pio(struct rzv2h_rspi_priv *rspi,
struct spi_device *spi,
- struct spi_transfer *transfer)
+ struct spi_transfer *transfer,
+ unsigned int words_to_transfer)
{
- struct rzv2h_rspi_priv *rspi = spi_controller_get_devdata(controller);
- unsigned int words_to_transfer, i;
+ unsigned int i;
int ret = 0;
- transfer->effective_speed_hz = rspi->freq;
- words_to_transfer = transfer->len / rspi->bytes_per_word;
-
for (i = 0; i < words_to_transfer; i++) {
rzv2h_rspi_clear_all_irqs(rspi);
@@ -240,6 +237,22 @@ static int rzv2h_rspi_transfer_one(struct spi_controller *controller,
break;
}
+ return ret;
+}
+
+static int rzv2h_rspi_transfer_one(struct spi_controller *controller,
+ struct spi_device *spi,
+ struct spi_transfer *transfer)
+{
+ struct rzv2h_rspi_priv *rspi = spi_controller_get_devdata(controller);
+ unsigned int words_to_transfer;
+ int ret;
+
+ transfer->effective_speed_hz = rspi->freq;
+ words_to_transfer = transfer->len / rspi->bytes_per_word;
+
+ ret = rzv2h_rspi_transfer_pio(rspi, spi, transfer, words_to_transfer);
+
rzv2h_rspi_clear_all_irqs(rspi);
return ret;
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 26/32] spi: rzv2h-rspi: add support for DMA mode
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (24 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 25/32] spi: rzv2h-rspi: split out PIO transfer Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 27/32] spi: rzv2h-rspi: Fix max_speed_hz advertising prohibited bit rate Tommaso Merciai
` (6 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
commit fa08b566860bca8ebf9300090b85174c34de7ca5 upstream.
The DMA controller can be used to transfer data to and from the SPI
controller without involving the CPU for each word of a SPI transfer.
Add support for DMA mode.
Signed-off-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20251201134229.600817-12-cosmin-gabriel.tanislav.xa@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
[tm: Use dev_warn() equivalent of dev_warn_probe()]
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 171 ++++++++++++++++++++++++++++++++++-
1 file changed, 170 insertions(+), 1 deletion(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index 3191eaddc9d5..623e7683dcf3 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -9,6 +9,7 @@
#include <linux/bitops.h>
#include <linux/bits.h>
#include <linux/clk.h>
+#include <linux/dmaengine.h>
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/limits.h>
@@ -21,6 +22,8 @@
#include <linux/spi/spi.h>
#include <linux/wait.h>
+#include "internals.h"
+
/* Registers */
#define RSPI_SPDR 0x00
#define RSPI_SPCR 0x08
@@ -96,6 +99,7 @@ struct rzv2h_rspi_info {
struct rzv2h_rspi_priv {
struct spi_controller *controller;
const struct rzv2h_rspi_info *info;
+ struct platform_device *pdev;
void __iomem *base;
struct clk *tclk;
struct clk *pclk;
@@ -108,6 +112,7 @@ struct rzv2h_rspi_priv {
u8 spr;
u8 brdv;
bool use_pclk;
+ bool dma_callbacked;
};
#define RZV2H_RSPI_TX(func, type) \
@@ -219,6 +224,20 @@ static int rzv2h_rspi_receive(struct rzv2h_rspi_priv *rspi, void *rxbuf,
return 0;
}
+static bool rzv2h_rspi_can_dma(struct spi_controller *ctlr, struct spi_device *spi,
+ struct spi_transfer *xfer)
+{
+ struct rzv2h_rspi_priv *rspi = spi_controller_get_devdata(ctlr);
+
+ if (ctlr->fallback)
+ return false;
+
+ if (!ctlr->dma_tx || !ctlr->dma_rx)
+ return false;
+
+ return xfer->len > rspi->info->fifo_size;
+}
+
static int rzv2h_rspi_transfer_pio(struct rzv2h_rspi_priv *rspi,
struct spi_device *spi,
struct spi_transfer *transfer,
@@ -240,21 +259,149 @@ static int rzv2h_rspi_transfer_pio(struct rzv2h_rspi_priv *rspi,
return ret;
}
+static void rzv2h_rspi_dma_complete(void *arg)
+{
+ struct rzv2h_rspi_priv *rspi = arg;
+
+ rspi->dma_callbacked = 1;
+ wake_up_interruptible(&rspi->wait);
+}
+
+static struct dma_async_tx_descriptor *
+rzv2h_rspi_setup_dma_channel(struct rzv2h_rspi_priv *rspi,
+ struct dma_chan *chan, struct sg_table *sg,
+ enum dma_slave_buswidth width,
+ enum dma_transfer_direction direction)
+{
+ struct dma_slave_config config = {
+ .dst_addr = rspi->pdev->resource->start + RSPI_SPDR,
+ .src_addr = rspi->pdev->resource->start + RSPI_SPDR,
+ .dst_addr_width = width,
+ .src_addr_width = width,
+ .direction = direction,
+ };
+ struct dma_async_tx_descriptor *desc;
+ int ret;
+
+ ret = dmaengine_slave_config(chan, &config);
+ if (ret)
+ return ERR_PTR(ret);
+
+ desc = dmaengine_prep_slave_sg(chan, sg->sgl, sg->nents, direction,
+ DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
+ if (!desc)
+ return ERR_PTR(-EAGAIN);
+
+ if (direction == DMA_DEV_TO_MEM) {
+ desc->callback = rzv2h_rspi_dma_complete;
+ desc->callback_param = rspi;
+ }
+
+ return desc;
+}
+
+static enum dma_slave_buswidth
+rzv2h_rspi_dma_width(struct rzv2h_rspi_priv *rspi)
+{
+ switch (rspi->bytes_per_word) {
+ case 4:
+ return DMA_SLAVE_BUSWIDTH_4_BYTES;
+ case 2:
+ return DMA_SLAVE_BUSWIDTH_2_BYTES;
+ case 1:
+ return DMA_SLAVE_BUSWIDTH_1_BYTE;
+ default:
+ return DMA_SLAVE_BUSWIDTH_UNDEFINED;
+ }
+}
+
+static int rzv2h_rspi_transfer_dma(struct rzv2h_rspi_priv *rspi,
+ struct spi_device *spi,
+ struct spi_transfer *transfer,
+ unsigned int words_to_transfer)
+{
+ struct dma_async_tx_descriptor *tx_desc = NULL, *rx_desc = NULL;
+ enum dma_slave_buswidth width;
+ dma_cookie_t cookie;
+ int ret;
+
+ width = rzv2h_rspi_dma_width(rspi);
+ if (width == DMA_SLAVE_BUSWIDTH_UNDEFINED)
+ return -EINVAL;
+
+ rx_desc = rzv2h_rspi_setup_dma_channel(rspi, rspi->controller->dma_rx,
+ &transfer->rx_sg, width,
+ DMA_DEV_TO_MEM);
+ if (IS_ERR(rx_desc))
+ return PTR_ERR(rx_desc);
+
+ tx_desc = rzv2h_rspi_setup_dma_channel(rspi, rspi->controller->dma_tx,
+ &transfer->tx_sg, width,
+ DMA_MEM_TO_DEV);
+ if (IS_ERR(tx_desc))
+ return PTR_ERR(tx_desc);
+
+ cookie = dmaengine_submit(rx_desc);
+ if (dma_submit_error(cookie))
+ return cookie;
+
+ cookie = dmaengine_submit(tx_desc);
+ if (dma_submit_error(cookie)) {
+ dmaengine_terminate_sync(rspi->controller->dma_rx);
+ return cookie;
+ }
+
+ /*
+ * DMA transfer does not need IRQs to be enabled.
+ * For PIO, we only use RX IRQ, so disable that.
+ */
+ disable_irq(rspi->irq_rx);
+
+ rspi->dma_callbacked = 0;
+
+ dma_async_issue_pending(rspi->controller->dma_rx);
+ dma_async_issue_pending(rspi->controller->dma_tx);
+ rzv2h_rspi_clear_all_irqs(rspi);
+
+ ret = wait_event_interruptible_timeout(rspi->wait, rspi->dma_callbacked, HZ);
+ if (ret) {
+ dmaengine_synchronize(rspi->controller->dma_tx);
+ dmaengine_synchronize(rspi->controller->dma_rx);
+ ret = 0;
+ } else {
+ dmaengine_terminate_sync(rspi->controller->dma_tx);
+ dmaengine_terminate_sync(rspi->controller->dma_rx);
+ ret = -ETIMEDOUT;
+ }
+
+ enable_irq(rspi->irq_rx);
+
+ return ret;
+}
+
static int rzv2h_rspi_transfer_one(struct spi_controller *controller,
struct spi_device *spi,
struct spi_transfer *transfer)
{
struct rzv2h_rspi_priv *rspi = spi_controller_get_devdata(controller);
+ bool is_dma = spi_xfer_is_dma_mapped(controller, spi, transfer);
unsigned int words_to_transfer;
int ret;
transfer->effective_speed_hz = rspi->freq;
words_to_transfer = transfer->len / rspi->bytes_per_word;
- ret = rzv2h_rspi_transfer_pio(rspi, spi, transfer, words_to_transfer);
+ if (is_dma)
+ ret = rzv2h_rspi_transfer_dma(rspi, spi, transfer, words_to_transfer);
+ else
+ ret = rzv2h_rspi_transfer_pio(rspi, spi, transfer, words_to_transfer);
rzv2h_rspi_clear_all_irqs(rspi);
+ if (is_dma && ret == -EAGAIN)
+ /* Retry with PIO */
+ transfer->error = SPI_TRANS_FAIL_NO_START;
+
return ret;
}
@@ -562,6 +709,7 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, rspi);
rspi->controller = controller;
+ rspi->pdev = pdev;
rspi->info = device_get_match_data(dev);
@@ -632,6 +780,7 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
controller->unprepare_message = rzv2h_rspi_unprepare_message;
controller->num_chipselect = 4;
controller->transfer_one = rzv2h_rspi_transfer_one;
+ controller->can_dma = rzv2h_rspi_can_dma;
tclk_rate = clk_round_rate(rspi->tclk, 0);
if (tclk_rate < 0)
@@ -649,6 +798,26 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
RSPI_SPBR_SPR_MIN,
RSPI_SPCMD_BRDV_MIN);
+ controller->dma_tx = devm_dma_request_chan(dev, "tx");
+ if (IS_ERR(controller->dma_tx)) {
+ ret = PTR_ERR(controller->dma_tx);
+ if (ret == -EPROBE_DEFER)
+ return ret;
+ dev_warn(dev, "error %pe: failed to request TX DMA channel\n",
+ ERR_PTR(ret));
+ controller->dma_tx = NULL;
+ }
+
+ controller->dma_rx = devm_dma_request_chan(dev, "rx");
+ if (IS_ERR(controller->dma_rx)) {
+ ret = PTR_ERR(controller->dma_rx);
+ if (ret == -EPROBE_DEFER)
+ return ret;
+ dev_warn(dev, "error %pe: failed to request RX DMA channel\n",
+ ERR_PTR(ret));
+ controller->dma_rx = NULL;
+ }
+
device_set_node(&controller->dev, dev_fwnode(dev));
ret = devm_spi_register_controller(dev, controller);
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 27/32] spi: rzv2h-rspi: Fix max_speed_hz advertising prohibited bit rate
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (25 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 26/32] spi: rzv2h-rspi: add support for DMA mode Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 28/32] spi: rzv2h-rspi: Fix invalid SPR=0/BRDV=0 clock configuration Tommaso Merciai
` (5 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
commit 4e292cbf3890657db2f2692942cb0f168c80167e upstream.
On RZ/V2H(P), RZ/G3E and RZ/G3L, RSPI_n_TCLK is fixed at 200MHz.
The max_speed_hz was computed using clk_round_rate(tclk, ULONG_MAX)
with SPR=0 and BRDV=0, resulting in 100Mbps - the exact combination
prohibited on these SoCs. This could cause the SPI framework to request
a speed that rzv2h_rspi_find_rate_fixed() would skip, potentially
leading to a clock selection failure.
On RZ/T2H and RZ/N2H the max_speed_hz was correctly calculated as
50Mbps for both the variable PCLKSPIn and fixed PCLK clock sources.
Since the maximum supported bit rate is 50Mbps across all supported SoC
variants, replace the clk_round_rate() based calculation with a define
RSPI_MAX_SPEED_HZ set to 50MHz and use it directly for max_speed_hz.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://patch.msgid.link/20260410080517.2405700-2-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index 623e7683dcf3..1b3127812d50 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -77,6 +77,8 @@
#define RSPI_RESET_NUM 2
+#define RSPI_MAX_SPEED_HZ 50000000
+
struct rzv2h_rspi_best_clock {
struct clk *clk;
unsigned long clk_rate;
@@ -790,13 +792,7 @@ static int rzv2h_rspi_probe(struct platform_device *pdev)
RSPI_SPBR_SPR_MAX,
RSPI_SPCMD_BRDV_MAX);
- tclk_rate = clk_round_rate(rspi->tclk, ULONG_MAX);
- if (tclk_rate < 0)
- return tclk_rate;
-
- controller->max_speed_hz = rzv2h_rspi_calc_bitrate(tclk_rate,
- RSPI_SPBR_SPR_MIN,
- RSPI_SPCMD_BRDV_MIN);
+ controller->max_speed_hz = RSPI_MAX_SPEED_HZ;
controller->dma_tx = devm_dma_request_chan(dev, "tx");
if (IS_ERR(controller->dma_tx)) {
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 28/32] spi: rzv2h-rspi: Fix invalid SPR=0/BRDV=0 clock configuration
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (26 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 27/32] spi: rzv2h-rspi: Fix max_speed_hz advertising prohibited bit rate Tommaso Merciai
@ 2026-06-17 8:29 ` Tommaso Merciai
2026-06-17 8:30 ` [PATCH 6.1.y-cip 29/32] spi: rzv2h-rspi: Simplify clock rate search function signatures Tommaso Merciai
` (4 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:29 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
commit 0335767dd8e7ade8a8e3028d08c4621515d47388 upstream.
The combination of SPR=0 and BRDV=0 results in the minimum division
ratio of 2, producing the maximum possible bit rate for a given clock
source. This combination is not supported in two cases:
- On RZ/G3E, RZ/G3L, RZ/V2H(P) and RZ/V2N, RSPI_n_TCLK is fixed at
200MHz, which would yield 100Mbps. The next hardware manual update
will explicitly state that since the maximum frequency of the
RSPICKn clock signal is 50MHz, settings with N=0 and n=0 resulting
in 100Mbps are prohibited.
- On RZ/T2H and RZ/N2H, when PCLK (125MHz) is used as the clock
source, SPR=0 and BRDV=0 is explicitly listed as unsupported in
the hardware manual (Table 36.7).
Skip the SPR=0/BRDV=0 combination in rzv2h_rspi_find_rate_fixed() to
prevent the driver from selecting an invalid clock configuration on the
affected SoCs.
Additionally, remove the now redundant RSPI_SPBR_SPR_PCLK_MIN define
which was previously set to 1 to work around the PCLK restriction, but
was overly broad as it incorrectly blocked valid combinations such as
SPR=0/BRDV=1 (31.25Mbps on PCLK=125MHz).
Fixes: 8b61c8919dff ("spi: Add driver for the RZ/V2H(P) RSPI IP")
Fixes: 1ce3e8adc7d0 ("spi: rzv2h-rspi: add support for using PCLK for transfer clock")
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://patch.msgid.link/20260410080517.2405700-3-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index 1b3127812d50..fec389233d42 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -50,7 +50,6 @@
/* Register SPBR */
#define RSPI_SPBR_SPR_MIN 0
-#define RSPI_SPBR_SPR_PCLK_MIN 1
#define RSPI_SPBR_SPR_MAX 255
/* Register SPCMD */
@@ -535,6 +534,17 @@ static void rzv2h_rspi_find_rate_fixed(struct clk *clk, u32 hz,
for (brdv = RSPI_SPCMD_BRDV_MIN; brdv <= RSPI_SPCMD_BRDV_MAX; brdv++) {
spr = DIV_ROUND_UP(clk_rate, hz * (1 << (brdv + 1)));
spr--;
+ /*
+ * Skip SPR=0 and BRDV=0 as it is not a valid combination:
+ * - On RZ/G3E, RZ/G3L, RZ/V2H(P) and RZ/V2N, RSPI_n_TCLK is
+ * fixed at 200MHz and SPR=0 and BRDV=0 results in the maximum
+ * bit rate of 100Mbps which is prohibited.
+ * - On RZ/T2H and RZ/N2H, when PCLK (125MHz) is used as
+ * the clock source, SPR=0 and BRDV=0 is explicitly listed
+ * as unsupported in the hardware manual (Table 36.7).
+ */
+ if (!spr && !brdv)
+ continue;
if (spr >= spr_min && spr <= spr_max)
goto clock_found;
}
@@ -568,12 +578,8 @@ static u32 rzv2h_rspi_setup_clock(struct rzv2h_rspi_priv *rspi, u32 hz)
rspi->info->find_tclk_rate(rspi->tclk, hz, RSPI_SPBR_SPR_MIN,
RSPI_SPBR_SPR_MAX, &best_clock);
- /*
- * T2H and N2H can also use PCLK as a source, which is 125MHz, but not
- * when both SPR and BRDV are 0.
- */
if (best_clock.error && rspi->info->find_pclk_rate)
- rspi->info->find_pclk_rate(rspi->pclk, hz, RSPI_SPBR_SPR_PCLK_MIN,
+ rspi->info->find_pclk_rate(rspi->pclk, hz, RSPI_SPBR_SPR_MIN,
RSPI_SPBR_SPR_MAX, &best_clock);
if (!best_clock.clk_rate)
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 29/32] spi: rzv2h-rspi: Simplify clock rate search function signatures
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (27 preceding siblings ...)
2026-06-17 8:29 ` [PATCH 6.1.y-cip 28/32] spi: rzv2h-rspi: Fix invalid SPR=0/BRDV=0 clock configuration Tommaso Merciai
@ 2026-06-17 8:30 ` Tommaso Merciai
2026-06-17 8:30 ` [PATCH 6.1.y-cip 30/32] spi: rzv2h-rspi: Fix silent failure in clock setup error path Tommaso Merciai
` (3 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:30 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
commit c958bb67b2dfd87b09d725a60162d13674fc5fd9 upstream.
The spr_min and spr_max parameters passed to
rzv2h_rspi_find_rate_variable() and rzv2h_rspi_find_rate_fixed() were
always called with RSPI_SPBR_SPR_MIN and RSPI_SPBR_SPR_MAX respectively.
There is no need to pass these as parameters since the valid SPR range
is fixed by the hardware.
Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
Link: https://patch.msgid.link/20260410080517.2405700-4-prabhakar.mahadev-lad.rj@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index fec389233d42..09d80a31ed4e 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -88,9 +88,9 @@ struct rzv2h_rspi_best_clock {
};
struct rzv2h_rspi_info {
- void (*find_tclk_rate)(struct clk *clk, u32 hz, u8 spr_min, u8 spr_max,
+ void (*find_tclk_rate)(struct clk *clk, u32 hz,
struct rzv2h_rspi_best_clock *best_clk);
- void (*find_pclk_rate)(struct clk *clk, u32 hz, u8 spr_low, u8 spr_high,
+ void (*find_pclk_rate)(struct clk *clk, u32 hz,
struct rzv2h_rspi_best_clock *best_clk);
const char *tclk_name;
unsigned int fifo_size;
@@ -413,7 +413,6 @@ static inline u32 rzv2h_rspi_calc_bitrate(unsigned long tclk_rate, u8 spr,
}
static void rzv2h_rspi_find_rate_variable(struct clk *clk, u32 hz,
- u8 spr_min, u8 spr_max,
struct rzv2h_rspi_best_clock *best)
{
long clk_rate, clk_min_rate, clk_max_rate;
@@ -464,7 +463,7 @@ static void rzv2h_rspi_find_rate_variable(struct clk *clk, u32 hz,
* minimum SPR that is in the valid range.
*/
min_rate_spr = DIV_ROUND_CLOSEST(clk_min_rate, rate_div) - 1;
- if (min_rate_spr > spr_max)
+ if (min_rate_spr > RSPI_SPBR_SPR_MAX)
continue;
/*
@@ -474,14 +473,14 @@ static void rzv2h_rspi_find_rate_variable(struct clk *clk, u32 hz,
* maximum SPR that is in the valid range.
*/
max_rate_spr = DIV_ROUND_CLOSEST(clk_max_rate, rate_div) - 1;
- if (max_rate_spr < spr_min)
+ if (max_rate_spr < RSPI_SPBR_SPR_MIN)
break;
- if (min_rate_spr < spr_min)
- min_rate_spr = spr_min;
+ if (min_rate_spr < RSPI_SPBR_SPR_MIN)
+ min_rate_spr = RSPI_SPBR_SPR_MIN;
- if (max_rate_spr > spr_max)
- max_rate_spr = spr_max;
+ if (max_rate_spr > RSPI_SPBR_SPR_MAX)
+ max_rate_spr = RSPI_SPBR_SPR_MAX;
for (spr = min_rate_spr; spr <= max_rate_spr; spr++) {
clk_rate = (spr + 1) * rate_div;
@@ -512,7 +511,6 @@ static void rzv2h_rspi_find_rate_variable(struct clk *clk, u32 hz,
}
static void rzv2h_rspi_find_rate_fixed(struct clk *clk, u32 hz,
- u8 spr_min, u8 spr_max,
struct rzv2h_rspi_best_clock *best)
{
unsigned long clk_rate;
@@ -545,7 +543,7 @@ static void rzv2h_rspi_find_rate_fixed(struct clk *clk, u32 hz,
*/
if (!spr && !brdv)
continue;
- if (spr >= spr_min && spr <= spr_max)
+ if (spr >= RSPI_SPBR_SPR_MIN && spr <= RSPI_SPBR_SPR_MAX)
goto clock_found;
}
@@ -575,12 +573,10 @@ static u32 rzv2h_rspi_setup_clock(struct rzv2h_rspi_priv *rspi, u32 hz)
};
int ret;
- rspi->info->find_tclk_rate(rspi->tclk, hz, RSPI_SPBR_SPR_MIN,
- RSPI_SPBR_SPR_MAX, &best_clock);
+ rspi->info->find_tclk_rate(rspi->tclk, hz, &best_clock);
if (best_clock.error && rspi->info->find_pclk_rate)
- rspi->info->find_pclk_rate(rspi->pclk, hz, RSPI_SPBR_SPR_MIN,
- RSPI_SPBR_SPR_MAX, &best_clock);
+ rspi->info->find_pclk_rate(rspi->pclk, hz, &best_clock);
if (!best_clock.clk_rate)
return -EINVAL;
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 30/32] spi: rzv2h-rspi: Fix silent failure in clock setup error path
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (28 preceding siblings ...)
2026-06-17 8:30 ` [PATCH 6.1.y-cip 29/32] spi: rzv2h-rspi: Simplify clock rate search function signatures Tommaso Merciai
@ 2026-06-17 8:30 ` Tommaso Merciai
2026-06-17 8:30 ` [PATCH 6.1.y-cip 31/32] arm64: dts: renesas: r9a09g047: Add RSPI nodes Tommaso Merciai
` (2 subsequent siblings)
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:30 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
From: John Madieu <john.madieu.xa@bp.renesas.com>
commit 54900126ae0a2671f8790a7f95706b9ea95fac4e upstream.
rzv2h_rspi_setup_clock() is declared to return u32 but returns -EINVAL
when no valid clock parameters are found. Cast to u32, -EINVAL becomes
0xffffffea, which is a non-zero value. The caller in
rzv2h_rspi_prepare_message() guards against failure with:
rspi->freq = rzv2h_rspi_setup_clock(rspi, speed_hz);
if (!rspi->freq)
return -EINVAL;
Because 0xffffffea is non-zero, the check is bypassed and the controller
proceeds to program SPBR/SPCMD with stale values, leading to an unknown
bit rate.
Return 0 on the failed-search path, consistent with the existing
clk_set_rate() failure path which already returns 0.
Fixes: 77d931584dd3 ("spi: rzv2h-rspi: make transfer clock rate finding chip-specific")
Signed-off-by: John Madieu <john.madieu.xa@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Reviewed-by: Cosmin Tanislav <cosmin-gabriel.tanislav.xa@renesas.com>
Link: https://patch.msgid.link/20260425024725.2393632-1-john.madieu.xa@bp.renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
drivers/spi/spi-rzv2h-rspi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/spi/spi-rzv2h-rspi.c b/drivers/spi/spi-rzv2h-rspi.c
index 09d80a31ed4e..3049521ec61f 100644
--- a/drivers/spi/spi-rzv2h-rspi.c
+++ b/drivers/spi/spi-rzv2h-rspi.c
@@ -579,7 +579,7 @@ static u32 rzv2h_rspi_setup_clock(struct rzv2h_rspi_priv *rspi, u32 hz)
rspi->info->find_pclk_rate(rspi->pclk, hz, &best_clock);
if (!best_clock.clk_rate)
- return -EINVAL;
+ return 0;
ret = clk_set_rate(best_clock.clk, best_clock.clk_rate);
if (ret)
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 31/32] arm64: dts: renesas: r9a09g047: Add RSPI nodes
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (29 preceding siblings ...)
2026-06-17 8:30 ` [PATCH 6.1.y-cip 30/32] spi: rzv2h-rspi: Fix silent failure in clock setup error path Tommaso Merciai
@ 2026-06-17 8:30 ` Tommaso Merciai
2026-06-17 8:30 ` [PATCH 6.1.y-cip 32/32] arm64: dts: renesas: r9a09g047e57-smarc: Enable RSPI0 Tommaso Merciai
2026-06-22 9:15 ` [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Pavel Machek
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:30 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
commit d2c3353ddbebd07b27ded9813a665557cc0f96d7 upstream.
Add nodes for the RSPI IPs found in the Renesas RZ/G3E SoC.
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/c8df5202caf4e36ee5beafe78ad0940643edcbb6.1771344527.git.tommaso.merciai.xr@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
arch/arm64/boot/dts/renesas/r9a09g047.dtsi | 84 ++++++++++++++++++++++
1 file changed, 84 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/r9a09g047.dtsi b/arch/arm64/boot/dts/renesas/r9a09g047.dtsi
index cc0dc3df9e7f..10b7b8a5c236 100644
--- a/arch/arm64/boot/dts/renesas/r9a09g047.dtsi
+++ b/arch/arm64/boot/dts/renesas/r9a09g047.dtsi
@@ -591,6 +591,90 @@ channel5 {
};
};
+ rspi0: spi@12800000 {
+ compatible = "renesas,r9a09g047-rspi", "renesas,r9a09g057-rspi";
+ reg = <0x0 0x12800000 0x0 0x400>;
+ interrupts = <GIC_SPI 105 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 106 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 107 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 500 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 501 IRQ_TYPE_EDGE_RISING>;
+ interrupt-names = "idle", "error", "end", "rx", "tx";
+ clocks = <&cpg CPG_MOD 0x54>,
+ <&cpg CPG_MOD 0x55>,
+ <&cpg CPG_MOD 0x56>;
+ clock-names = "pclk", "pclk_sfr", "tclk";
+ resets = <&cpg 0x7b>, <&cpg 0x7c>;
+ reset-names = "presetn", "tresetn";
+ dmas = <&dmac0 0x448c>, <&dmac0 0x448d>,
+ <&dmac1 0x448c>, <&dmac1 0x448d>,
+ <&dmac2 0x448c>, <&dmac2 0x448d>,
+ <&dmac3 0x448c>, <&dmac3 0x448d>,
+ <&dmac4 0x448c>, <&dmac4 0x448d>;
+ dma-names = "rx", "tx", "rx", "tx", "rx", "tx",
+ "rx", "tx", "rx", "tx";
+ power-domains = <&cpg>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "disabled";
+ };
+
+ rspi1: spi@12800400 {
+ compatible = "renesas,r9a09g047-rspi", "renesas,r9a09g057-rspi";
+ reg = <0x0 0x12800400 0x0 0x400>;
+ interrupts = <GIC_SPI 108 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 109 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 110 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 502 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 503 IRQ_TYPE_EDGE_RISING>;
+ interrupt-names = "idle", "error", "end", "rx", "tx";
+ clocks = <&cpg CPG_MOD 0x57>,
+ <&cpg CPG_MOD 0x58>,
+ <&cpg CPG_MOD 0x59>;
+ clock-names = "pclk", "pclk_sfr", "tclk";
+ resets = <&cpg 0x7d>, <&cpg 0x7e>;
+ reset-names = "presetn", "tresetn";
+ dmas = <&dmac0 0x448e>, <&dmac0 0x448f>,
+ <&dmac1 0x448e>, <&dmac1 0x448f>,
+ <&dmac2 0x448e>, <&dmac2 0x448f>,
+ <&dmac3 0x448e>, <&dmac3 0x448f>,
+ <&dmac4 0x448e>, <&dmac4 0x448f>;
+ dma-names = "rx", "tx", "rx", "tx", "rx", "tx",
+ "rx", "tx", "rx", "tx";
+ power-domains = <&cpg>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "disabled";
+ };
+
+ rspi2: spi@12800800 {
+ compatible = "renesas,r9a09g047-rspi", "renesas,r9a09g057-rspi";
+ reg = <0x0 0x12800800 0x0 0x400>;
+ interrupts = <GIC_SPI 111 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 112 IRQ_TYPE_LEVEL_HIGH>,
+ <GIC_SPI 113 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 504 IRQ_TYPE_EDGE_RISING>,
+ <GIC_SPI 505 IRQ_TYPE_EDGE_RISING>;
+ interrupt-names = "idle", "error", "end", "rx", "tx";
+ clocks = <&cpg CPG_MOD 0x5a>,
+ <&cpg CPG_MOD 0x5b>,
+ <&cpg CPG_MOD 0x5c>;
+ clock-names = "pclk", "pclk_sfr", "tclk";
+ resets = <&cpg 0x7f>, <&cpg 0x80>;
+ reset-names = "presetn", "tresetn";
+ dmas = <&dmac0 0x4490>, <&dmac0 0x4491>,
+ <&dmac1 0x4490>, <&dmac1 0x4491>,
+ <&dmac2 0x4490>, <&dmac2 0x4491>,
+ <&dmac3 0x4490>, <&dmac3 0x4491>,
+ <&dmac4 0x4490>, <&dmac4 0x4491>;
+ dma-names = "rx", "tx", "rx", "tx", "rx", "tx",
+ "rx", "tx", "rx", "tx";
+ power-domains = <&cpg>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "disabled";
+ };
+
rsci0: serial@12800c00 {
compatible = "renesas,r9a09g047-rsci";
reg = <0 0x12800c00 0 0x400>;
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* [PATCH 6.1.y-cip 32/32] arm64: dts: renesas: r9a09g047e57-smarc: Enable RSPI0
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (30 preceding siblings ...)
2026-06-17 8:30 ` [PATCH 6.1.y-cip 31/32] arm64: dts: renesas: r9a09g047: Add RSPI nodes Tommaso Merciai
@ 2026-06-17 8:30 ` Tommaso Merciai
2026-06-22 9:15 ` [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Pavel Machek
32 siblings, 0 replies; 34+ messages in thread
From: Tommaso Merciai @ 2026-06-17 8:30 UTC (permalink / raw)
To: cip-dev, Nobuhiro Iwamatsu, Pavel Machek
Cc: Biju Das, Lad Prabhakar, tomm.merciai
commit 19ca423f61b66ee3328b6a2f35fbb3ff2c8566f5 upstream.
Enable RSPI0 on the RZ/G3E SMARC EVK, where it is accessible on the
PMOD0 connector.
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Link: https://patch.msgid.link/b634c10e632fed07b5652c11de060deca27ead90.1771344527.git.tommaso.merciai.xr@bp.renesas.com
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
.../boot/dts/renesas/r9a09g047e57-smarc.dts | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts b/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts
index c303f7c66e42..7563e641b862 100644
--- a/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts
+++ b/arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts
@@ -191,6 +191,13 @@ rsci9_pins: rsci9 {
bias-pull-up;
};
+ rspi0_pins: rspi0 {
+ pinmux = <RZG3E_PORT_PINMUX(M, 4, 2)>, /* MISOA */
+ <RZG3E_PORT_PINMUX(M, 5, 2)>, /* MOSIA */
+ <RZG3E_PORT_PINMUX(M, 6, 2)>, /* RSPCKA */
+ <RZG3E_PORT_PINMUX(M, 7, 2)>; /* SSLA0 */
+ };
+
scif_pins: scif {
pins = "SCIF_TXD", "SCIF_RXD";
renesas,output-impedance = <1>;
@@ -258,6 +265,15 @@ &rsci9 {
};
#endif
+&rspi0 {
+ pinctrl-0 = <&rspi0_pins>;
+ pinctrl-names = "default";
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ status = "okay";
+};
+
&scif0 {
pinctrl-0 = <&scif_pins>;
pinctrl-names = "default";
--
2.54.0
^ permalink raw reply related [flat|nested] 34+ messages in thread
* Re: [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
` (31 preceding siblings ...)
2026-06-17 8:30 ` [PATCH 6.1.y-cip 32/32] arm64: dts: renesas: r9a09g047e57-smarc: Enable RSPI0 Tommaso Merciai
@ 2026-06-22 9:15 ` Pavel Machek
32 siblings, 0 replies; 34+ messages in thread
From: Pavel Machek @ 2026-06-22 9:15 UTC (permalink / raw)
To: Tommaso Merciai
Cc: cip-dev, Nobuhiro Iwamatsu, Pavel Machek, Biju Das, Lad Prabhakar,
tomm.merciai
[-- Attachment #1: Type: text/plain, Size: 904 bytes --]
Hi!
> This patch series adds RSPI support for the Renesas RZ/G3E SoC, which
> features three RSPI controllers. The series also enables DMA support in
> the RSPI driver, and backports the necessary infrastructure changes
> into linux-6.1.y-cip.
>
> The series is structured as follows:
> - Clock entries for the three RSPI instances on RZ/G3E SoC
> - DT binding updates: document DMA properties and add RZ/G3E compatible
> - Device tree nodes for RZ/G3E RSPI controllers and SMARC board enablement
> - Driver improvements backported from mainline: DMA support, device-managed
> APIs, bug fixes for clock setup and FIFO thresholds
I'm still reviewing this, and will have some comments, but it looks
good so far. I will likely apply this, if it passes testing and there
are no other comments.
Best regards,
Pavel
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
^ permalink raw reply [flat|nested] 34+ messages in thread
end of thread, other threads:[~2026-06-22 9:15 UTC | newest]
Thread overview: 34+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-17 8:29 [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 01/32] dmaengine: Add devm_dma_request_chan() Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 02/32] spi: Introduce internal spi_xfer_is_dma_mapped() helper Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 03/32] clk: renesas: r9a09g047: Add entries for the RSPIs Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 04/32] spi: dt-bindings: renesas,rzv2h-rspi: document optional support for DMA Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 05/32] spi: dt-bindings: renesas,rzv2h-rspi: allow multiple DMAs Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 06/32] spi: dt-bindings: renesas,rzv2h-rspi: Document dmas property Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 07/32] spi: dt-bindings: renesas,rzv2h-rspi: Document RZ/G3E SoC support Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 08/32] spi: rzv2h-rspi: make resets optional Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 09/32] spi: rzv2h-rspi: make FIFO size chip-specific Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 10/32] spi: rzv2h-rspi: make clocks chip-specific Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 11/32] spi: rzv2h-rspi: move register writes out of rzv2h_rspi_setup_clock() Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 12/32] spi: rzv2h-rspi: avoid recomputing transfer frequency Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 13/32] spi: rzv2h-rspi: make transfer clock rate finding chip-specific Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 14/32] spi: rzv2h-rspi: add support for using PCLK for transfer clock Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 15/32] spi: rzv2h-rspi: add support for variable " Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 16/32] spi: rzv2h-rspi: add support for loopback mode Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 17/32] spi: rzv2h-rspi: add support for RZ/T2H and RZ/N2H Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 18/32] spi: rzv2h-rspi: fix rzv2h_rspi_transfer_one() indentation Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 19/32] spi: rzv2h-rspi: remove call to spi_finalize_current_transfer() Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 20/32] spi: rzv2h-rspi: use device-managed APIs Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 21/32] spi: rzv2h-rspi: store RX interrupt in state Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 22/32] spi: rzv2h-rspi: set MUST_RX/MUST_TX Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 23/32] spi: rzv2h-rspi: set TX FIFO threshold to 0 Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 24/32] spi: rzv2h-rspi: enable TX buffer empty interrupt Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 25/32] spi: rzv2h-rspi: split out PIO transfer Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 26/32] spi: rzv2h-rspi: add support for DMA mode Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 27/32] spi: rzv2h-rspi: Fix max_speed_hz advertising prohibited bit rate Tommaso Merciai
2026-06-17 8:29 ` [PATCH 6.1.y-cip 28/32] spi: rzv2h-rspi: Fix invalid SPR=0/BRDV=0 clock configuration Tommaso Merciai
2026-06-17 8:30 ` [PATCH 6.1.y-cip 29/32] spi: rzv2h-rspi: Simplify clock rate search function signatures Tommaso Merciai
2026-06-17 8:30 ` [PATCH 6.1.y-cip 30/32] spi: rzv2h-rspi: Fix silent failure in clock setup error path Tommaso Merciai
2026-06-17 8:30 ` [PATCH 6.1.y-cip 31/32] arm64: dts: renesas: r9a09g047: Add RSPI nodes Tommaso Merciai
2026-06-17 8:30 ` [PATCH 6.1.y-cip 32/32] arm64: dts: renesas: r9a09g047e57-smarc: Enable RSPI0 Tommaso Merciai
2026-06-22 9:15 ` [PATCH 6.1.y-cip 00/32] Add RSPI support for RZ/G3E SoC Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox