devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC PATCH] ARM: dts: renesas: r9a06g032-rzn1d400-eb: describe LEDs
@ 2025-09-19 10:07 Wolfram Sang
  2025-09-22 19:26 ` Rob Herring
  2025-09-26  9:02 ` Geert Uytterhoeven
  0 siblings, 2 replies; 5+ messages in thread
From: Wolfram Sang @ 2025-09-19 10:07 UTC (permalink / raw)
  To: linux-renesas-soc
  Cc: Wolfram Sang, Geert Uytterhoeven, Magnus Damm, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, devicetree

To be able to use the LEDs, a configuration switch has to be set to a
non-default value. So, infrastructure to support these switches (which
modify signal routing via the CPLD on the demo board (DB)) is added as
well.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

This patch depends on "[PATCH v3 5/8] ARM: dts: r9a06g032: Add GPIO
controllers" which is still in-flight. I send this out as RFC already,
so we can discuss the introduction of the switch dependant settings. I
copied this approach form RZ/G3S.
 

 .../renesas/r9a06g032-rzn1d400-db-switches.h  | 22 ++++++++++++++
 .../dts/renesas/r9a06g032-rzn1d400-db.dts     | 30 +++++++++++++++++++
 .../dts/renesas/r9a06g032-rzn1d400-eb.dts     | 19 ++++++++++++
 3 files changed, 71 insertions(+)
 create mode 100644 arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db-switches.h

diff --git a/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db-switches.h b/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db-switches.h
new file mode 100644
index 000000000000..4560d16e7c60
--- /dev/null
+++ b/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db-switches.h
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * On-board switches for the Renesas RZ/N1D demo board (DB) and extension
+ * board (EB)
+ *
+ * Copyright (C) 2025 Renesas Electronics Corp.
+ */
+
+#ifndef __N1D_DB_EB_SWITCHES_H__
+#define __N1D_DB_EB_SWITCHES_H__
+
+#define SW_OFF         0
+#define SW_ON          1
+
+/*
+ * SW_2-2:
+ *     SW_OFF - enable PMOD1-3+LEDs on the extension board
+ *     SW_ON  - enable CAT/S3 (default)
+ */
+#define SW_2_2 SW_ON
+
+#endif
diff --git a/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db.dts b/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db.dts
index 3258b2e27434..849b5ad9c79d 100644
--- a/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db.dts
+++ b/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db.dts
@@ -15,6 +15,7 @@
 #include <dt-bindings/pinctrl/rzn1-pinctrl.h>
 
 #include "r9a06g032.dtsi"
+#include "r9a06g032-rzn1d400-db-switches.h"
 
 / {
 	model = "RZN1D-DB Board";
@@ -185,6 +186,14 @@ fixed-link {
 	};
 };
 
+#if SW2_2 == SW_OFF
+&gpio1 {
+	pinctrl-0 = <&pins_gpio1>;
+	pinctrl-names = "default";
+	status = "okay";
+};
+#endif
+
 &i2c2 {
 	pinctrl-0 = <&pins_i2c2>;
 	pinctrl-names = "default";
@@ -256,6 +265,27 @@ pins_cpld: pins-cpld {
 			 <RZN1_PINMUX(122, RZN1_FUNC_USB)>;
 	};
 
+#if SW2_2 == SW_OFF
+	pins_gpio1: pins-gpio1 {
+		pinmux = <RZN1_PINMUX(80, RZN1_FUNC_GPIO)>,
+			 <RZN1_PINMUX(81, RZN1_FUNC_GPIO)>,
+			 <RZN1_PINMUX(82, RZN1_FUNC_GPIO)>,
+			 <RZN1_PINMUX(83, RZN1_FUNC_GPIO)>,
+			 <RZN1_PINMUX(84, RZN1_FUNC_GPIO)>,
+			 <RZN1_PINMUX(85, RZN1_FUNC_GPIO)>,
+			 <RZN1_PINMUX(86, RZN1_FUNC_GPIO)>,
+			 <RZN1_PINMUX(87, RZN1_FUNC_GPIO)>,
+			 <RZN1_PINMUX(88, RZN1_FUNC_GPIO)>,
+			 <RZN1_PINMUX(89, RZN1_FUNC_GPIO)>,
+			 <RZN1_PINMUX(90, RZN1_FUNC_GPIO)>,
+			 <RZN1_PINMUX(91, RZN1_FUNC_GPIO)>,
+			 <RZN1_PINMUX(92, RZN1_FUNC_GPIO)>,
+			 <RZN1_PINMUX(93, RZN1_FUNC_GPIO)>;
+		drive-strength = <12>;
+		bias-disable;
+	};
+#endif
+
 	pins_eth3: pins_eth3 {
 		pinmux = <RZN1_PINMUX(36, RZN1_FUNC_CLK_ETH_MII_RGMII_RMII)>,
 			 <RZN1_PINMUX(37, RZN1_FUNC_CLK_ETH_MII_RGMII_RMII)>,
diff --git a/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-eb.dts b/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-eb.dts
index 97a339b30d76..6d0e12ae4de1 100644
--- a/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-eb.dts
+++ b/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-eb.dts
@@ -8,11 +8,30 @@
 
 #include <dt-bindings/leds/common.h>
 #include "r9a06g032-rzn1d400-db.dts"
+#include "r9a06g032-rzn1d400-db-switches.h"
 
 / {
 	model = "RZN1D-EB Board";
 	compatible = "renesas,rzn1d400-eb", "renesas,rzn1d400-db",
 		     "renesas,r9a06g032";
+
+#if SW2_2 == SW_OFF
+	leds {
+		compatible = "gpio-leds";
+
+		led-prog0 {
+			gpios = <&gpio1b 23 GPIO_ACTIVE_HIGH>;
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_PROGRAMMING;
+		};
+
+		led-prog1 {
+			gpios = <&gpio1b 24 GPIO_ACTIVE_HIGH>;
+			color = <LED_COLOR_ID_RED>;
+			function = LED_FUNCTION_PROGRAMMING;
+		};
+	};
+#endif
 };
 
 &gmac1 {
-- 
2.47.2


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

* Re: [RFC PATCH] ARM: dts: renesas: r9a06g032-rzn1d400-eb: describe LEDs
  2025-09-19 10:07 [RFC PATCH] ARM: dts: renesas: r9a06g032-rzn1d400-eb: describe LEDs Wolfram Sang
@ 2025-09-22 19:26 ` Rob Herring
  2025-09-26  9:24   ` Geert Uytterhoeven
  2025-09-26  9:02 ` Geert Uytterhoeven
  1 sibling, 1 reply; 5+ messages in thread
From: Rob Herring @ 2025-09-22 19:26 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-renesas-soc, Geert Uytterhoeven, Magnus Damm,
	Krzysztof Kozlowski, Conor Dooley, devicetree

On Fri, Sep 19, 2025 at 12:07:20PM +0200, Wolfram Sang wrote:
> To be able to use the LEDs, a configuration switch has to be set to a
> non-default value. So, infrastructure to support these switches (which
> modify signal routing via the CPLD on the demo board (DB)) is added as
> well.
> 
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
> ---
> 
> This patch depends on "[PATCH v3 5/8] ARM: dts: r9a06g032: Add GPIO
> controllers" which is still in-flight. I send this out as RFC already,
> so we can discuss the introduction of the switch dependant settings. I
> copied this approach form RZ/G3S.
>  
> 
>  .../renesas/r9a06g032-rzn1d400-db-switches.h  | 22 ++++++++++++++
>  .../dts/renesas/r9a06g032-rzn1d400-db.dts     | 30 +++++++++++++++++++
>  .../dts/renesas/r9a06g032-rzn1d400-eb.dts     | 19 ++++++++++++
>  3 files changed, 71 insertions(+)
>  create mode 100644 arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db-switches.h
> 
> diff --git a/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db-switches.h b/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db-switches.h
> new file mode 100644
> index 000000000000..4560d16e7c60
> --- /dev/null
> +++ b/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db-switches.h
> @@ -0,0 +1,22 @@
> +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
> +/*
> + * On-board switches for the Renesas RZ/N1D demo board (DB) and extension
> + * board (EB)
> + *
> + * Copyright (C) 2025 Renesas Electronics Corp.
> + */
> +
> +#ifndef __N1D_DB_EB_SWITCHES_H__
> +#define __N1D_DB_EB_SWITCHES_H__
> +
> +#define SW_OFF         0
> +#define SW_ON          1
> +
> +/*
> + * SW_2-2:
> + *     SW_OFF - enable PMOD1-3+LEDs on the extension board
> + *     SW_ON  - enable CAT/S3 (default)
> + */
> +#define SW_2_2 SW_ON
> +
> +#endif
> diff --git a/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db.dts b/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db.dts
> index 3258b2e27434..849b5ad9c79d 100644
> --- a/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db.dts
> +++ b/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db.dts
> @@ -15,6 +15,7 @@
>  #include <dt-bindings/pinctrl/rzn1-pinctrl.h>
>  
>  #include "r9a06g032.dtsi"
> +#include "r9a06g032-rzn1d400-db-switches.h"
>  
>  / {
>  	model = "RZN1D-DB Board";
> @@ -185,6 +186,14 @@ fixed-link {
>  	};
>  };
>  
> +#if SW2_2 == SW_OFF

The "rule" for DT headers is #defines for numbers only.

If the switches are s/w readable, then I'd say firmware should read them 
and enable/disable the LEDs as appropriate. If not, then maybe the DT 
should have a property reflecting the switch state and firmware uses 
that to enable/disable.

Rob

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

* Re: [RFC PATCH] ARM: dts: renesas: r9a06g032-rzn1d400-eb: describe LEDs
  2025-09-19 10:07 [RFC PATCH] ARM: dts: renesas: r9a06g032-rzn1d400-eb: describe LEDs Wolfram Sang
  2025-09-22 19:26 ` Rob Herring
@ 2025-09-26  9:02 ` Geert Uytterhoeven
  2025-09-26  9:15   ` Wolfram Sang
  1 sibling, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2025-09-26  9:02 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: linux-renesas-soc, Magnus Damm, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, devicetree

Hi Wolfram,

On Fri, 19 Sept 2025 at 12:07, Wolfram Sang
<wsa+renesas@sang-engineering.com> wrote:
> To be able to use the LEDs, a configuration switch has to be set to a
> non-default value. So, infrastructure to support these switches (which
> modify signal routing via the CPLD on the demo board (DB)) is added as
> well.
>
> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Thanks for your patch!

> This patch depends on "[PATCH v3 5/8] ARM: dts: r9a06g032: Add GPIO
> controllers" which is still in-flight. I send this out as RFC already,
> so we can discuss the introduction of the switch dependant settings. I
> copied this approach form RZ/G3S.

I am not opposed to that.
The switches are needed in both the DB and EB DTS, and in future
DT overlays (if any).

> --- /dev/null
> +++ b/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db-switches.h

"...-db-eb-...", as this header file applies to both?

> @@ -0,0 +1,22 @@
> +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
> +/*
> + * On-board switches for the Renesas RZ/N1D demo board (DB) and extension
> + * board (EB)
> + *
> + * Copyright (C) 2025 Renesas Electronics Corp.
> + */
> +
> +#ifndef __N1D_DB_EB_SWITCHES_H__
> +#define __N1D_DB_EB_SWITCHES_H__

The include guard does not match the file name.

> +
> +#define SW_OFF         0
> +#define SW_ON          1
> +
> +/*
> + * SW_2-2:

SW2-2?

> + *     SW_OFF - enable PMOD1-3+LEDs on the extension board

Please add "ALT0_PMOD"...

> + *     SW_ON  - enable CAT/S3 (default)

... and "ALT1_CAT_S3".

> + */
> +#define SW_2_2 SW_ON

SW2_2, which is what all users below are using ;-)
Or better, DB_SW2_2, so you can distinguish between switches on DB
and EB (EB also has SW2).

> +
> +#endif

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

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

* Re: [RFC PATCH] ARM: dts: renesas: r9a06g032-rzn1d400-eb: describe LEDs
  2025-09-26  9:02 ` Geert Uytterhoeven
@ 2025-09-26  9:15   ` Wolfram Sang
  0 siblings, 0 replies; 5+ messages in thread
From: Wolfram Sang @ 2025-09-26  9:15 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-renesas-soc, Magnus Damm, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, devicetree

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


> > This patch depends on "[PATCH v3 5/8] ARM: dts: r9a06g032: Add GPIO
> > controllers" which is still in-flight. I send this out as RFC already,
> > so we can discuss the introduction of the switch dependant settings. I
> > copied this approach form RZ/G3S.
> 
> I am not opposed to that.
> The switches are needed in both the DB and EB DTS, and in future
> DT overlays (if any).

Thanks, however, Rob didn't like the idea. I have to add we actually can
read out the switch states via I2C. Dunno if that's different to G3S
etc...

> > --- /dev/null
> > +++ b/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db-switches.h
> 
> "...-db-eb-...", as this header file applies to both?

Ah, I forgot to rename it.

I agree to all your other comments but we need to decide on the
principal approach first.

Thanks for your help,

   Wolfram


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

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

* Re: [RFC PATCH] ARM: dts: renesas: r9a06g032-rzn1d400-eb: describe LEDs
  2025-09-22 19:26 ` Rob Herring
@ 2025-09-26  9:24   ` Geert Uytterhoeven
  0 siblings, 0 replies; 5+ messages in thread
From: Geert Uytterhoeven @ 2025-09-26  9:24 UTC (permalink / raw)
  To: Rob Herring
  Cc: Wolfram Sang, linux-renesas-soc, Magnus Damm, Krzysztof Kozlowski,
	Conor Dooley, devicetree

Hi Rob,

On Mon, 22 Sept 2025 at 21:26, Rob Herring <robh@kernel.org> wrote:
> On Fri, Sep 19, 2025 at 12:07:20PM +0200, Wolfram Sang wrote:
> > To be able to use the LEDs, a configuration switch has to be set to a
> > non-default value. So, infrastructure to support these switches (which
> > modify signal routing via the CPLD on the demo board (DB)) is added as
> > well.
> >
> > Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

> > This patch depends on "[PATCH v3 5/8] ARM: dts: r9a06g032: Add GPIO
> > controllers" which is still in-flight. I send this out as RFC already,
> > so we can discuss the introduction of the switch dependant settings. I
> > copied this approach form RZ/G3S.

> > --- /dev/null
> > +++ b/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db-switches.h
> > @@ -0,0 +1,22 @@
> > +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
> > +/*
> > + * On-board switches for the Renesas RZ/N1D demo board (DB) and extension
> > + * board (EB)
> > + *
> > + * Copyright (C) 2025 Renesas Electronics Corp.
> > + */
> > +
> > +#ifndef __N1D_DB_EB_SWITCHES_H__
> > +#define __N1D_DB_EB_SWITCHES_H__
> > +
> > +#define SW_OFF         0
> > +#define SW_ON          1
> > +
> > +/*
> > + * SW_2-2:
> > + *     SW_OFF - enable PMOD1-3+LEDs on the extension board
> > + *     SW_ON  - enable CAT/S3 (default)
> > + */
> > +#define SW_2_2 SW_ON
> > +
> > +#endif
> > diff --git a/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db.dts b/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db.dts
> > index 3258b2e27434..849b5ad9c79d 100644
> > --- a/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db.dts
> > +++ b/arch/arm/boot/dts/renesas/r9a06g032-rzn1d400-db.dts
> > @@ -15,6 +15,7 @@
> >  #include <dt-bindings/pinctrl/rzn1-pinctrl.h>
> >
> >  #include "r9a06g032.dtsi"
> > +#include "r9a06g032-rzn1d400-db-switches.h"
> >
> >  / {
> >       model = "RZN1D-DB Board";
> > @@ -185,6 +186,14 @@ fixed-link {
> >       };
> >  };
> >
> > +#if SW2_2 == SW_OFF
>
> The "rule" for DT headers is #defines for numbers only.
>
> If the switches are s/w readable, then I'd say firmware should read them
> and enable/disable the LEDs as appropriate. If not, then maybe the DT
> should have a property reflecting the switch state and firmware uses
> that to enable/disable.

Both options require updating the (10y-old?) firmware, which is unlikely
to happen.

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

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

end of thread, other threads:[~2025-09-26  9:24 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-19 10:07 [RFC PATCH] ARM: dts: renesas: r9a06g032-rzn1d400-eb: describe LEDs Wolfram Sang
2025-09-22 19:26 ` Rob Herring
2025-09-26  9:24   ` Geert Uytterhoeven
2025-09-26  9:02 ` Geert Uytterhoeven
2025-09-26  9:15   ` Wolfram Sang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).