[PATCH 04/13] arm64: dts: renesas: r9a09g087: Add pinctrl node

Prabhakar posted 13 patches 1 month, 3 weeks ago
[PATCH 04/13] arm64: dts: renesas: r9a09g087: Add pinctrl node
Posted by Prabhakar 1 month, 3 weeks ago
From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Add pinctrl node to RZ/N2H ("R9A09G087") SoC DTSI.

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

diff --git a/arch/arm64/boot/dts/renesas/r9a09g087.dtsi b/arch/arm64/boot/dts/renesas/r9a09g087.dtsi
index 7dcaee711486..3d243096b04c 100644
--- a/arch/arm64/boot/dts/renesas/r9a09g087.dtsi
+++ b/arch/arm64/boot/dts/renesas/r9a09g087.dtsi
@@ -5,6 +5,17 @@
  * Copyright (C) 2025 Renesas Electronics Corp.
  */
 
+#define RZN2H_PINS_PER_PORT    8
+
+/*
+ * Create the pin index from its bank and position numbers and store in
+ * the upper 16 bits the alternate function identifier
+ */
+#define RZN2H_PORT_PINMUX(b, p, f)     ((b) * RZN2H_PINS_PER_PORT + (p) | ((f) << 16))
+
+/* Convert a port and pin label to its global pin index */
+#define RZN2H_GPIO(port, pin)  ((port) * RZN2H_PINS_PER_PORT + (pin))
+
 #include <dt-bindings/clock/renesas,r9a09g087-cpg-mssr.h>
 #include <dt-bindings/interrupt-controller/arm-gic.h>
 
@@ -216,6 +227,19 @@ cpg: clock-controller@80280000 {
 			#power-domain-cells = <0>;
 		};
 
+		pinctrl: pinctrl@802c0000 {
+			compatible = "renesas,r9a09g087-pinctrl";
+			reg = <0 0x802c0000 0 0x10000>,
+			      <0 0x812c0000 0 0x10000>,
+			      <0 0x802b0000 0 0x10000>;
+			reg-names = "nsr", "srs", "srn";
+			clocks = <&cpg CPG_CORE R9A09G087_CLK_PCLKM>;
+			gpio-controller;
+			#gpio-cells = <2>;
+			gpio-ranges = <&pinctrl 0 0 280>;
+			power-domains = <&cpg>;
+		};
+
 		gic: interrupt-controller@83000000 {
 			compatible = "arm,gic-v3";
 			reg = <0x0 0x83000000 0 0x40000>,
-- 
2.50.1
Re: [PATCH 04/13] arm64: dts: renesas: r9a09g087: Add pinctrl node
Posted by Geert Uytterhoeven 1 month, 2 weeks ago
Hi Prabhakar,

On Tue, 12 Aug 2025 at 22:03, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Add pinctrl node to RZ/N2H ("R9A09G087") SoC DTSI.
>
> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>

Thanks for your patch!

> --- a/arch/arm64/boot/dts/renesas/r9a09g087.dtsi
> +++ b/arch/arm64/boot/dts/renesas/r9a09g087.dtsi
> @@ -5,6 +5,17 @@
>   * Copyright (C) 2025 Renesas Electronics Corp.
>   */
>
> +#define RZN2H_PINS_PER_PORT    8
> +
> +/*
> + * Create the pin index from its bank and position numbers and store in
> + * the upper 16 bits the alternate function identifier
> + */
> +#define RZN2H_PORT_PINMUX(b, p, f)     ((b) * RZN2H_PINS_PER_PORT + (p) | ((f) << 16))
> +
> +/* Convert a port and pin label to its global pin index */
> +#define RZN2H_GPIO(port, pin)  ((port) * RZN2H_PINS_PER_PORT + (pin))

Shouldn't this be in a header file under include/dt-bindings/pinctrl/?
Else you have to duplicate these definitions in DT overlays.

The rest LGTM, 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 04/13] arm64: dts: renesas: r9a09g087: Add pinctrl node
Posted by Lad, Prabhakar 1 month, 2 weeks ago
Hi Geert,

Thank you for the review.

On Mon, Aug 18, 2025 at 2:34 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
>
> Hi Prabhakar,
>
> On Tue, 12 Aug 2025 at 22:03, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > Add pinctrl node to RZ/N2H ("R9A09G087") SoC DTSI.
> >
> > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
>
> Thanks for your patch!
>
> > --- a/arch/arm64/boot/dts/renesas/r9a09g087.dtsi
> > +++ b/arch/arm64/boot/dts/renesas/r9a09g087.dtsi
> > @@ -5,6 +5,17 @@
> >   * Copyright (C) 2025 Renesas Electronics Corp.
> >   */
> >
> > +#define RZN2H_PINS_PER_PORT    8
> > +
> > +/*
> > + * Create the pin index from its bank and position numbers and store in
> > + * the upper 16 bits the alternate function identifier
> > + */
> > +#define RZN2H_PORT_PINMUX(b, p, f)     ((b) * RZN2H_PINS_PER_PORT + (p) | ((f) << 16))
> > +
> > +/* Convert a port and pin label to its global pin index */
> > +#define RZN2H_GPIO(port, pin)  ((port) * RZN2H_PINS_PER_PORT + (pin))
>
> Shouldn't this be in a header file under include/dt-bindings/pinctrl/?
Agreed, theT2H related macros are used in the driver whereas the above
aren't. In the past DT maintainers opposed including such headers
which aren't used in the DT and drivers. Hence I choose this approach.
Please let me know if you want me to move this into a header file
under dt-bindings.

> Else you have to duplicate these definitions in DT overlays.
>
> The rest LGTM, so
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
>

Cheers,
Prabhakar
Re: [PATCH 04/13] arm64: dts: renesas: r9a09g087: Add pinctrl node
Posted by Geert Uytterhoeven 1 month, 2 weeks ago
Hi Prabhakar,

On Mon, 18 Aug 2025 at 15:44, Lad, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> On Mon, Aug 18, 2025 at 2:34 PM Geert Uytterhoeven <geert@linux-m68k.org> wrote:
> > On Tue, 12 Aug 2025 at 22:03, Prabhakar <prabhakar.csengg@gmail.com> wrote:
> > > From: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> > >
> > > Add pinctrl node to RZ/N2H ("R9A09G087") SoC DTSI.
> > >
> > > Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com>
> >
> > Thanks for your patch!
> >
> > > --- a/arch/arm64/boot/dts/renesas/r9a09g087.dtsi
> > > +++ b/arch/arm64/boot/dts/renesas/r9a09g087.dtsi
> > > @@ -5,6 +5,17 @@
> > >   * Copyright (C) 2025 Renesas Electronics Corp.
> > >   */
> > >
> > > +#define RZN2H_PINS_PER_PORT    8
> > > +
> > > +/*
> > > + * Create the pin index from its bank and position numbers and store in
> > > + * the upper 16 bits the alternate function identifier
> > > + */
> > > +#define RZN2H_PORT_PINMUX(b, p, f)     ((b) * RZN2H_PINS_PER_PORT + (p) | ((f) << 16))
> > > +
> > > +/* Convert a port and pin label to its global pin index */
> > > +#define RZN2H_GPIO(port, pin)  ((port) * RZN2H_PINS_PER_PORT + (pin))
> >
> > Shouldn't this be in a header file under include/dt-bindings/pinctrl/?
>
> Agreed, theT2H related macros are used in the driver whereas the above
> aren't. In the past DT maintainers opposed including such headers
> which aren't used in the DT and drivers. Hence I choose this approach.
> Please let me know if you want me to move this into a header file
> under dt-bindings.

We need to share the definitions between DT sources and DT overlay
sources, so that sounds like a convincing argument for a header file
to me.

Now, as RZT2H_PORT_PINMUX() must be identical to RZN2H_PORT_PINMUX(),
this could be the existing
<dt-bindings/pinctrl/renesas,r9a09g077-pinctrl.h> file
(cfr. my comment on [PATCH 07/13]).

> > Else you have to duplicate these definitions in DT overlays.

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