Skip to contentSkip to conversation

Add DMA support for RZ/T2H RSPI

PATCH NAK Cosmin Tanislav 5 participants 12 messages Jan 28 – Mar 18

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

v3 cover Add DMA support for RZ/T2H RSPI

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, and do some other cleanups while touching the same code.

The dts changes in this series depend on the DMA series [1].

[1]: https://lore.kernel.org/lkml/[email protected]/#t

V3:
* impose proper maxItems for each device
* impose maxItems for dmas property

V2:
* drop patches picked up by Mark
* add new dt-bindings patch to allow multiple DMAs
* wire up all DMA controllers for every SPI controller

Cosmin Tanislav (3):
dt-bindings: spi: renesas,rzv2h-rspi: allow multiple DMAs
arm64: dts: renesas: r9a09g077: wire up DMA support for SPI
arm64: dts: renesas: r9a09g087: wire up DMA support for SPI

 .../bindings/spi/renesas,rzv2h-rspi.yaml         | 16 +++++++++++++---
 arch/arm64/boot/dts/renesas/r9a09g077.dtsi       | 16 ++++++++++++++++
 arch/arm64/boot/dts/renesas/r9a09g087.dtsi       | 16 ++++++++++++++++
 3 files changed, 45 insertions(+), 3 deletions(-)
Signature · 1 line
2.52.0
#1 lore raw

PATCH v3 1/3 dt-bindings: spi: renesas,rzv2h-rspi: allow multiple DMAs

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.

---

V3:
* impose proper maxItems for each device
* impose maxItems for dmas property

V2:
* new patch

 .../bindings/spi/renesas,rzv2h-rspi.yaml         | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml +13 -3
index a588b112e11e..cf8b733b766d 100644
@@ -58,12 +58,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
@@ -121,6 +125,12 @@ allOf:
         resets: false
         reset-names: false
 
+        dmas:
+          maxItems: 6
+
+        dma-names:
+          maxItems: 6
+
 unevaluatedProperties: false
 
 examples:
Signature · 1 line
2.52.0
#2 lore raw

Re: [PATCH v3 1/3] dt-bindings: spi: renesas,rzv2h-rspi: allow multiple DMAs

Quoted 18 lines · Cosmin Tanislav

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]

Quoted 5 lines

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.

What's the rationale behind not setting minItems to 6 here

Quoted 3 lines

For RZ/V2H and RZ/V2N SoCs, limit the number of DMA channels to 10, as they have 5 DMA controllers.

and to 10 here? Do any of the spi controllers on these SoCs not have the ability to use all of the available dma controllers?

Quoted 53 lines

---

V3:
* impose proper maxItems for each device
* impose maxItems for dmas property

V2:
* new patch

 .../bindings/spi/renesas,rzv2h-rspi.yaml         | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml +13 -3
index a588b112e11e..cf8b733b766d 100644
@@ -58,12 +58,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
@@ -121,6 +125,12 @@ allOf:
         resets: false
         reset-names: false
 
+        dmas:
+          maxItems: 6
+
+        dma-names:
+          maxItems: 6
+
 unevaluatedProperties: false
 
 examples:
Signature · 1 line
2.52.0
#3 lore raw

RE: [PATCH v3 1/3] dt-bindings: spi: renesas,rzv2h-rspi: allow multiple DMAs

Quoted 28 lines

From: Conor Dooley <[email protected]>
Sent: Thursday, January 29, 2026 7:45 PM

Quoted 18 lines · Cosmin Tanislav

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]

Quoted 5 lines

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.

Quoted 9 lines

What's the rationale behind not setting minItems to 6 here

Quoted 3 lines

For RZ/V2H and RZ/V2N SoCs, limit the number of DMA channels to 10, as they have 5 DMA controllers.

and to 10 here? Do any of the spi controllers on these SoCs not have the ability to use all of the available dma controllers?

I left minItems to 2 in case it is necessary to wire up SPI to only a subset of the DMA controllers, maybe for performance reasons in a board-specific dts?

I know that dts is only supposed to describe the hardware itself, but for now this would be the only way to pre-select which DMA controller is used for a specific IP.

Let me know your thoughts.

Quoted 54 lines
Quoted 8 lines

---

V3:
* impose proper maxItems for each device
* impose maxItems for dmas property

Review

Quoted 7 lines

V2:
* new patch

 .../bindings/spi/renesas,rzv2h-rspi.yaml         | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml

Quoted 38 lines

index a588b112e11e..cf8b733b766d 100644

Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml +13 -4
@@ -58,12 +58,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
@@ -121,6 +125,12 @@ allOf:
         resets: false
         reset-names: false
 
+        dmas:
+          maxItems: 6
+
+        dma-names:
+          maxItems: 6
+
 unevaluatedProperties: false
 
 examples:
--

2.52.0

Acked-by
#4 lore raw

Re: [PATCH v3 1/3] dt-bindings: spi: renesas,rzv2h-rspi: allow multiple DMAs

Quoted 42 lines · Cosmin-Gabriel Tanislav
Quoted 28 lines

From: Conor Dooley <[email protected]>
Sent: Thursday, January 29, 2026 7:45 PM

Quoted 18 lines · Cosmin Tanislav

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]

Quoted 5 lines

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.

Quoted 9 lines

What's the rationale behind not setting minItems to 6 here

Quoted 3 lines

For RZ/V2H and RZ/V2N SoCs, limit the number of DMA channels to 10, as they have 5 DMA controllers.

and to 10 here? Do any of the spi controllers on these SoCs not have the ability to use all of the available dma controllers?

I left minItems to 2 in case it is necessary to wire up SPI to only a subset of the DMA controllers, maybe for performance reasons in a board-specific dts?

Quoted 5 lines

I know that dts is only supposed to describe the hardware itself, but for now this would be the only way to pre-select which DMA controller is used for a specific IP.

Let me know your thoughts.

Yeah, I can buy that argument.

pw-bot: not-applicable

#5 lore raw

Re: [PATCH v3 1/3] dt-bindings: spi: renesas,rzv2h-rspi: allow multiple DMAs

In reply to Cosmin Tanislav
Quoted 45 lines · Cosmin Tanislav

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.

---

V3:
* impose proper maxItems for each device
* impose maxItems for dmas property

V2:
* new patch

 .../bindings/spi/renesas,rzv2h-rspi.yaml         | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)
Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml +0 -0
index a588b112e11e..cf8b733b766d 100644

Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml properties: · line 62

Quoted 6 lines
Documentation/devicetree/bindings/spi/renesas,rzv2h-rspi.yaml +2 -1
@@ -58,12 +58,16 @@ properties:
       - const: tresetn
 
   dmas:
-    maxItems: 2
+    minItems: 2
+    maxItems: 10

As pointed out by Renesas, this is not correct or finished.

I don't understand why Renesas people don't review THEIR own code instead, but send a patch correcting other un-merged patch.

Really, start working on each other submissions.

NAK

Best regards,
Krzysztof

Reviewed-by on v3 1/3
#6 lore raw

Re: [PATCH v3 1/3] dt-bindings: spi: renesas,rzv2h-rspi: allow multiple DMAs

In reply to Cosmin Tanislav
Quoted 27 lines · Cosmin Tanislav

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.

Quoted 6 lines

---

V3:
* impose proper maxItems for each device
* impose maxItems for dmas property

FTR

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#7 lore raw

PATCH v3 2/3 arm64: dts: renesas: r9a09g077: wire up DMA support for SPI

In reply to Cosmin Tanislav

RZ/T2H (R9A09G077) has three DMA controllers that can be used by peripherals like SPI to offload data transfers from the CPU.

Wire up the DMA channels for the SPI peripherals.

---

V3:
* no changes

V2:
* wire up all DMA controllers

 arch/arm64/boot/dts/renesas/r9a09g077.dtsi | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm64/boot/dts/renesas/r9a09g077.dtsi +16 -0
index 14d7fb6f8952..0e44b01a56c7 100644
@@ -200,6 +200,10 @@ rspi0: spi@80007000 {
 			clocks = <&cpg CPG_CORE R9A09G077_CLK_PCLKM>,
 				 <&cpg CPG_MOD 104>;
 			clock-names = "pclk", "pclkspi";
+			dmas = <&dmac0 0x267a>, <&dmac0 0x267b>,
+			       <&dmac1 0x267a>, <&dmac1 0x267b>,
+			       <&dmac2 0x267a>, <&dmac2 0x267b>;
+			dma-names = "rx", "tx", "rx", "tx", "rx", "tx";
 			power-domains = <&cpg>;
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -218,6 +222,10 @@ rspi1: spi@80007400 {
 			clocks = <&cpg CPG_CORE R9A09G077_CLK_PCLKM>,
 				 <&cpg CPG_MOD 105>;
 			clock-names = "pclk", "pclkspi";
+			dmas = <&dmac0 0x267f>, <&dmac0 0x2680>,
+			       <&dmac1 0x267f>, <&dmac1 0x2680>,
+			       <&dmac2 0x267f>, <&dmac2 0x2680>;
+			dma-names = "rx", "tx", "rx", "tx", "rx", "tx";
 			power-domains = <&cpg>;
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -236,6 +244,10 @@ rspi2: spi@80007800 {
 			clocks = <&cpg CPG_CORE R9A09G077_CLK_PCLKM>,
 				 <&cpg CPG_MOD 106>;
 			clock-names = "pclk", "pclkspi";
+			dmas = <&dmac0 0x2684>, <&dmac0 0x2685>,
+			       <&dmac1 0x2684>, <&dmac1 0x2685>,
+			       <&dmac2 0x2684>, <&dmac2 0x2685>;
+			dma-names = "rx", "tx", "rx", "tx", "rx", "tx";
 			power-domains = <&cpg>;
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -254,6 +266,10 @@ rspi3: spi@81007000 {
 			clocks = <&cpg CPG_CORE R9A09G077_CLK_PCLKM>,
 				 <&cpg CPG_MOD 602>;
 			clock-names = "pclk", "pclkspi";
+			dmas = <&dmac0 0x2689>, <&dmac0 0x268a>,
+			       <&dmac1 0x2689>, <&dmac1 0x268a>,
+			       <&dmac2 0x2689>, <&dmac2 0x268a>;
+			dma-names = "rx", "tx", "rx", "tx", "rx", "tx";
 			power-domains = <&cpg>;
 			#address-cells = <1>;
 			#size-cells = <0>;
Signature · 1 line
2.52.0
Reviewed-by on v3 2/3
#8 lore raw

Re: [PATCH v3 2/3] arm64: dts: renesas: r9a09g077: wire up DMA support for SPI

Quoted 7 lines · Cosmin Tanislav

RZ/T2H (R9A09G077) has three DMA controllers that can be used by peripherals like SPI to offload data transfers from the CPU.

Wire up the DMA channels for the SPI peripherals.

i.e. will queue in renesas-devel for v7.1.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
#9 lore raw

PATCH v3 3/3 arm64: dts: renesas: r9a09g087: wire up DMA support for SPI

In reply to Cosmin Tanislav

RZ/N2H (R9A09G087) has three DMA controllers that can be used by peripherals like SPI to offload data transfers from the CPU.

Wire up the DMA channels for the SPI peripherals.

---

V3:
* no changes

V2:
* wire up all DMA controllers

 arch/arm64/boot/dts/renesas/r9a09g087.dtsi | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
arch/arm64/boot/dts/renesas/r9a09g087.dtsi +16 -0
index 4a1339561332..7d1c669ad262 100644
@@ -200,6 +200,10 @@ rspi0: spi@80007000 {
 			clocks = <&cpg CPG_CORE R9A09G087_CLK_PCLKM>,
 				 <&cpg CPG_MOD 104>;
 			clock-names = "pclk", "pclkspi";
+			dmas = <&dmac0 0x267a>, <&dmac0 0x267b>,
+			       <&dmac1 0x267a>, <&dmac1 0x267b>,
+			       <&dmac2 0x267a>, <&dmac2 0x267b>;
+			dma-names = "rx", "tx", "rx", "tx", "rx", "tx";
 			power-domains = <&cpg>;
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -218,6 +222,10 @@ rspi1: spi@80007400 {
 			clocks = <&cpg CPG_CORE R9A09G087_CLK_PCLKM>,
 				 <&cpg CPG_MOD 105>;
 			clock-names = "pclk", "pclkspi";
+			dmas = <&dmac0 0x267f>, <&dmac0 0x2680>,
+			       <&dmac1 0x267f>, <&dmac1 0x2680>,
+			       <&dmac2 0x267f>, <&dmac2 0x2680>;
+			dma-names = "rx", "tx", "rx", "tx", "rx", "tx";
 			power-domains = <&cpg>;
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -236,6 +244,10 @@ rspi2: spi@80007800 {
 			clocks = <&cpg CPG_CORE R9A09G087_CLK_PCLKM>,
 				 <&cpg CPG_MOD 106>;
 			clock-names = "pclk", "pclkspi";
+			dmas = <&dmac0 0x2684>, <&dmac0 0x2685>,
+			       <&dmac1 0x2684>, <&dmac1 0x2685>,
+			       <&dmac2 0x2684>, <&dmac2 0x2685>;
+			dma-names = "rx", "tx", "rx", "tx", "rx", "tx";
 			power-domains = <&cpg>;
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -254,6 +266,10 @@ rspi3: spi@81007000 {
 			clocks = <&cpg CPG_CORE R9A09G087_CLK_PCLKM>,
 				 <&cpg CPG_MOD 602>;
 			clock-names = "pclk", "pclkspi";
+			dmas = <&dmac0 0x2689>, <&dmac0 0x268a>,
+			       <&dmac1 0x2689>, <&dmac1 0x268a>,
+			       <&dmac2 0x2689>, <&dmac2 0x268a>;
+			dma-names = "rx", "tx", "rx", "tx", "rx", "tx";
 			power-domains = <&cpg>;
 			#address-cells = <1>;
 			#size-cells = <0>;
Signature · 1 line
2.52.0
#10 lore raw

Re: [PATCH v3 3/3] arm64: dts: renesas: r9a09g087: wire up DMA support for SPI

Quoted 7 lines · Cosmin Tanislav

RZ/N2H (R9A09G087) has three DMA controllers that can be used by peripherals like SPI to offload data transfers from the CPU.

Wire up the DMA channels for the SPI peripherals.

Thanks, will queue in renesas-devel for v7.1.

Gr{oetje,eeting}s,

Geert

Signature · 5 lines
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
maintainer
#11 lore raw

Re: (subset) [PATCH v3 0/3] Add DMA support for RZ/T2H RSPI

In reply to Cosmin Tanislav
Quoted 9 lines · Cosmin Tanislav

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, and do some other cleanups while touching the same code.

The dts changes in this series depend on the DMA series [1].

[...]

Applied to

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

Thanks!

[1/3] dt-bindings: spi: renesas,rzv2h-rspi: allow multiple DMAs

      commit: 4d28f38f64ef69ab27839069ef3346c3c878d137

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark