[PATCH 1/2] arm64: dts: renesas: r9a09g056: Add DMA support for RSPI channels

Prabhakar posted 2 patches 1 month, 3 weeks ago
[PATCH 1/2] arm64: dts: renesas: r9a09g056: Add DMA support for RSPI channels
Posted by Prabhakar 1 month, 3 weeks ago
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Enable DMA support for RSPI channels.

Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
---
 arch/arm64/boot/dts/renesas/r9a09g056.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm64/boot/dts/renesas/r9a09g056.dtsi b/arch/arm64/boot/dts/renesas/r9a09g056.dtsi
index 4d37d02138ad..5740f04a6222 100644
--- a/arch/arm64/boot/dts/renesas/r9a09g056.dtsi
+++ b/arch/arm64/boot/dts/renesas/r9a09g056.dtsi
@@ -679,6 +679,8 @@ rspi0: spi@12800000 {
 			clock-names = "pclk", "pclk_sfr", "tclk";
 			resets = <&cpg 0x7b>, <&cpg 0x7c>;
 			reset-names = "presetn", "tresetn";
+			dmas = <&dmac0 0x448c>, <&dmac0 0x448d>;
+			dma-names = "rx", "tx";
 			power-domains = <&cpg>;
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -700,6 +702,8 @@ rspi1: spi@12800400 {
 			clock-names = "pclk", "pclk_sfr", "tclk";
 			resets = <&cpg 0x7d>, <&cpg 0x7e>;
 			reset-names = "presetn", "tresetn";
+			dmas = <&dmac0 0x448e>, <&dmac0 0x448f>;
+			dma-names = "rx", "tx";
 			power-domains = <&cpg>;
 			#address-cells = <1>;
 			#size-cells = <0>;
@@ -721,6 +725,8 @@ rspi2: spi@12800800 {
 			clock-names = "pclk", "pclk_sfr", "tclk";
 			resets = <&cpg 0x7f>, <&cpg 0x80>;
 			reset-names = "presetn", "tresetn";
+			dmas = <&dmac0 0x4490>, <&dmac0 0x4491>;
+			dma-names = "rx", "tx";
 			power-domains = <&cpg>;
 			#address-cells = <1>;
 			#size-cells = <0>;
-- 
2.52.0
Re: [PATCH 1/2] arm64: dts: renesas: r9a09g056: Add DMA support for RSPI channels
Posted by Geert Uytterhoeven 1 month ago
Hi Prabhakar,

On Mon, 15 Dec 2025 at 17:34, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Enable DMA support for RSPI channels.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Thanks for your patch!

> --- a/arch/arm64/boot/dts/renesas/r9a09g056.dtsi
> +++ b/arch/arm64/boot/dts/renesas/r9a09g056.dtsi
> @@ -679,6 +679,8 @@ rspi0: spi@12800000 {
>                         clock-names = "pclk", "pclk_sfr", "tclk";
>                         resets = <&cpg 0x7b>, <&cpg 0x7c>;
>                         reset-names = "presetn", "tresetn";
> +                       dmas = <&dmac0 0x448c>, <&dmac0 0x448d>;
> +                       dma-names = "rx", "tx";

RZ/V2N does not seem to have restrictions about which DMA controllers
can be used by which SPI instance.  Hence shouldn't these point to
all five DMA controllers?

    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";

Note that this requires updating the DT bindings, as they currently
restrict dma to two entries.

>                         power-domains = <&cpg>;
>                         #address-cells = <1>;
>                         #size-cells = <0>;

The actual DMA specifier values are OK, so
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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
Re: [PATCH 1/2] arm64: dts: renesas: r9a09g056: Add DMA support for RSPI channels
Posted by Lad, Prabhakar 1 month ago
Hi Geert,

Thank you for the review.

On Thu, Jan 8, 2026 at 1:18 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Prabhakar,
>
> On Mon, 15 Dec 2025 at 17:34, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > Enable DMA support for RSPI channels.
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Thanks for your patch!
>
> > --- a/arch/arm64/boot/dts/renesas/r9a09g056.dtsi
> > +++ b/arch/arm64/boot/dts/renesas/r9a09g056.dtsi
> > @@ -679,6 +679,8 @@ rspi0: spi@12800000 {
> >                         clock-names = "pclk", "pclk_sfr", "tclk";
> >                         resets = <&cpg 0x7b>, <&cpg 0x7c>;
> >                         reset-names = "presetn", "tresetn";
> > +                       dmas = <&dmac0 0x448c>, <&dmac0 0x448d>;
> > +                       dma-names = "rx", "tx";
>
> RZ/V2N does not seem to have restrictions about which DMA controllers
> can be used by which SPI instance.  Hence shouldn't these point to
> all five DMA controllers?
>
>     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";
>
So the driver would choose the DMA channel based on the available one?
For example if all the 16 channels are consumed for dmac0 the driver
would switch to the next available one dmacX? and this would be the
job of a consumer driver? Or do we want to let the board user
choose/override in board DTS based on the available DMAC channels?

> Note that this requires updating the DT bindings, as they currently
> restrict dma to two entries.
>
Agreed.

Cheers,
Prabhakar

> >                         power-domains = <&cpg>;
> >                         #address-cells = <1>;
> >                         #size-cells = <0>;
>
> The actual DMA specifier values are OK, so
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> Gr{oetje,eeting}s,
>
>                         Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
>
> 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
Re: [PATCH 1/2] arm64: dts: renesas: r9a09g056: Add DMA support for RSPI channels
Posted by Geert Uytterhoeven 1 month ago
Hi Prabhakar,

On Thu, 8 Jan 2026 at 14:26, Lad, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> On Thu, Jan 8, 2026 at 1:18 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Mon, 15 Dec 2025 at 17:34, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > >
> > > Enable DMA support for RSPI channels.
> > >
> > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > Thanks for your patch!
> >
> > > --- a/arch/arm64/boot/dts/renesas/r9a09g056.dtsi
> > > +++ b/arch/arm64/boot/dts/renesas/r9a09g056.dtsi
> > > @@ -679,6 +679,8 @@ rspi0: spi@12800000 {
> > >                         clock-names = "pclk", "pclk_sfr", "tclk";
> > >                         resets = <&cpg 0x7b>, <&cpg 0x7c>;
> > >                         reset-names = "presetn", "tresetn";
> > > +                       dmas = <&dmac0 0x448c>, <&dmac0 0x448d>;
> > > +                       dma-names = "rx", "tx";
> >
> > RZ/V2N does not seem to have restrictions about which DMA controllers
> > can be used by which SPI instance.  Hence shouldn't these point to
> > all five DMA controllers?
> >
> >     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";
> >
> So the driver would choose the DMA channel based on the available one?
> For example if all the 16 channels are consumed for dmac0 the driver
> would switch to the next available one dmacX? and this would be the
> job of a consumer driver? Or do we want to let the board user
> choose/override in board DTS based on the available DMAC channels?

When there are multiple dmas entries with the same dma, the DMA
subsystem picks a (random?) available channel.  This is clearly
visible on e.g. Salvator-XS, where the mapping from I2C channels
to DMA controllers changes on almost every boot
(see /sys/kernel/debug/dmaengine/summary).

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

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
Re: [PATCH 1/2] arm64: dts: renesas: r9a09g056: Add DMA support for RSPI channels
Posted by Lad, Prabhakar 1 month ago
Hi Geert,

On Thu, Jan 8, 2026 at 1:44 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Prabhakar,
>
> On Thu, 8 Jan 2026 at 14:26, Lad, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> > On Thu, Jan 8, 2026 at 1:18 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > > On Mon, 15 Dec 2025 at 17:34, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> > > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > > >
> > > > Enable DMA support for RSPI channels.
> > > >
> > > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > >
> > > Thanks for your patch!
> > >
> > > > --- a/arch/arm64/boot/dts/renesas/r9a09g056.dtsi
> > > > +++ b/arch/arm64/boot/dts/renesas/r9a09g056.dtsi
> > > > @@ -679,6 +679,8 @@ rspi0: spi@12800000 {
> > > >                         clock-names = "pclk", "pclk_sfr", "tclk";
> > > >                         resets = <&cpg 0x7b>, <&cpg 0x7c>;
> > > >                         reset-names = "presetn", "tresetn";
> > > > +                       dmas = <&dmac0 0x448c>, <&dmac0 0x448d>;
> > > > +                       dma-names = "rx", "tx";
> > >
> > > RZ/V2N does not seem to have restrictions about which DMA controllers
> > > can be used by which SPI instance.  Hence shouldn't these point to
> > > all five DMA controllers?
> > >
> > >     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";
> > >
> > So the driver would choose the DMA channel based on the available one?
> > For example if all the 16 channels are consumed for dmac0 the driver
> > would switch to the next available one dmacX? and this would be the
> > job of a consumer driver? Or do we want to let the board user
> > choose/override in board DTS based on the available DMAC channels?
>
> When there are multiple dmas entries with the same dma, the DMA
> subsystem picks a (random?) available channel.  This is clearly
> visible on e.g. Salvator-XS, where the mapping from I2C channels
> to DMA controllers changes on almost every boot
> (see /sys/kernel/debug/dmaengine/summary).
>
Aha thanks for the explanation (and pointer).

Cheers,
Prabhakar