Skip to contentSkip to conversation

arm: dts: bcm2711: Describe Ethernet LEDs

PATCH Superseded Florian Fainelli 3 participants 4 messages Apr 22, 2024 – Apr 23, 2024

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Florian Fainelli

author maintainer
#0 lore raw

PATCH v2 1/1 arm: dts: bcm2711: Describe Ethernet LEDs

Describe the Ethernet LEDs for the Raspberry Pi 4 model B board as well as the Raspberry Pi 4 CM board. The Raspberry Pi 400 board does not include RJ45 connector LEDs so the 'leds' node is deleted accordingly.

---
Changes in v2:

- added "function = LED_FUNCTION_LAN"

 .../arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts | 20 +++++++++++++++++
 .../arm/boot/dts/broadcom/bcm2711-rpi-400.dts |  1 +
 .../boot/dts/broadcom/bcm2711-rpi-cm4-io.dts  | 22 +++++++++++++++++++
 3 files changed, 43 insertions(+)
arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts +20 -0
index cfc8cb5e10ba..7a0f495ff726 100644
@@ -5,6 +5,7 @@
 #include "bcm283x-rpi-led-deprecated.dtsi"
 #include "bcm283x-rpi-usb-peripheral.dtsi"
 #include "bcm283x-rpi-wifi-bt.dtsi"
+#include <dt-bindings/leds/common.h>
 
 / {
 	compatible = "raspberrypi,4-model-b", "brcm,bcm2711";
@@ -204,6 +205,25 @@ &genet_mdio {
 	phy1: ethernet-phy@1 {
 		/* No PHY interrupt */
 		reg = <0x1>;
+
+		leds {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			leds@0 {
+				reg = <0>;
+				color = <LED_COLOR_ID_GREEN>;
+				function = LED_FUNCTION_LAN;
+				default-state = "keep";
+			};
+
+			leds@1 {
+				reg = <1>;
+				color = <LED_COLOR_ID_AMBER>;
+				function = LED_FUNCTION_LAN;
+				default-state = "keep";
+			};
+		};
 	};
 };
 
arch/arm/boot/dts/broadcom/bcm2711-rpi-400.dts +1 -0
index 5a2869a18bd5..ca9be91b4f36 100644
@@ -30,6 +30,7 @@ &expgpio {
 
 &genet_mdio {
 	clock-frequency = <1950000>;
+	/delete-node/ leds;
 };
 
 &led_pwr {
arch/arm/boot/dts/broadcom/bcm2711-rpi-cm4-io.dts +22 -0
index 7c6a5bdf48aa..76cb20373095 100644
@@ -1,5 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /dts-v1/;
+#include <dt-bindings/leds/common.h>
 #include "bcm2711-rpi-cm4.dtsi"
 #include "bcm283x-rpi-led-deprecated.dtsi"
 #include "bcm283x-rpi-usb-host.dtsi"
@@ -110,6 +111,27 @@ rtc@51 {
 	};
 };
 
+&phy1 {
+	leds {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		leds@1 {
+			reg = <1>;
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_LAN;
+			default-state = "keep";
+		};
+
+		leds@2 {
+			reg = <2>;
+			color = <LED_COLOR_ID_AMBER>;
+			function = LED_FUNCTION_LAN;
+			default-state = "keep";
+		};
+	};
+};
+
 &led_act {
 	gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
 };
Signature · 1 line
2.34.1
#1 lore raw

Hi Florian,

Am 23.04.24 um 01:08 schrieb Florian Fainelli:

Quoted 40 lines

Describe the Ethernet LEDs for the Raspberry Pi 4 model B board as well as the Raspberry Pi 4 CM board. The Raspberry Pi 400 board does not include RJ45 connector LEDs so the 'leds' node is deleted accordingly.

---
Changes in v2:

- added "function = LED_FUNCTION_LAN"

  .../arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts | 20 +++++++++++++++++
  .../arm/boot/dts/broadcom/bcm2711-rpi-400.dts |  1 +
  .../boot/dts/broadcom/bcm2711-rpi-cm4-io.dts  | 22 +++++++++++++++++++
  3 files changed, 43 insertions(+)
arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts +10 -0
index cfc8cb5e10ba..7a0f495ff726 100644
@@ -5,6 +5,7 @@
  #include "bcm283x-rpi-led-deprecated.dtsi"
  #include "bcm283x-rpi-usb-peripheral.dtsi"
  #include "bcm283x-rpi-wifi-bt.dtsi"
+#include <dt-bindings/leds/common.h>
 
  / {
  	compatible = "raspberrypi,4-model-b", "brcm,bcm2711";
@@ -204,6 +205,25 @@ &genet_mdio {
  	phy1: ethernet-phy@1 {
  		/* No PHY interrupt */
  		reg = <0x1>;
+
+		leds {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			leds@0 {
+				reg = <0>;
+				color = <LED_COLOR_ID_GREEN>;
+				function = LED_FUNCTION_LAN;

arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts &genet_mdio { · line 226

Quoted 10 lines
arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts +10 -0
+				default-state = "keep";
+			};
+
+			leds@1 {
+				reg = <1>;
+				color = <LED_COLOR_ID_AMBER>;
+				function = LED_FUNCTION_LAN;
+				default-state = "keep";
+			};
+		};

this looks good to me, but i'm wondering about the address numbering. This ones starts with 0 and the CM4 starts with 1. Does this come from the PHY?

Quoted 54 lines
arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts +0 -0
  	};
  };
 
arch/arm/boot/dts/broadcom/bcm2711-rpi-400.dts +1 -0
index 5a2869a18bd5..ca9be91b4f36 100644
@@ -30,6 +30,7 @@ &expgpio {
 
  &genet_mdio {
  	clock-frequency = <1950000>;
+	/delete-node/ leds;
  };
 
  &led_pwr {
arch/arm/boot/dts/broadcom/bcm2711-rpi-cm4-io.dts +22 -0
index 7c6a5bdf48aa..76cb20373095 100644
@@ -1,5 +1,6 @@
  // SPDX-License-Identifier: GPL-2.0
  /dts-v1/;
+#include <dt-bindings/leds/common.h>
  #include "bcm2711-rpi-cm4.dtsi"
  #include "bcm283x-rpi-led-deprecated.dtsi"
  #include "bcm283x-rpi-usb-host.dtsi"
@@ -110,6 +111,27 @@ rtc@51 {
  	};
  };
 
+&phy1 {
+	leds {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		leds@1 {
+			reg = <1>;
+			color = <LED_COLOR_ID_GREEN>;
+			function = LED_FUNCTION_LAN;
+			default-state = "keep";
+		};
+
+		leds@2 {
+			reg = <2>;
+			color = <LED_COLOR_ID_AMBER>;
+			function = LED_FUNCTION_LAN;
+			default-state = "keep";
+		};
+	};
+};
+
  &led_act {
  	gpios = <&gpio 42 GPIO_ACTIVE_HIGH>;
  };
author maintainer
#2 lore raw
Quoted 48 lines · Stefan Wahren

Hi Florian,

Am 23.04.24 um 01:08 schrieb Florian Fainelli:

Quoted 45 lines

Describe the Ethernet LEDs for the Raspberry Pi 4 model B board as well as the Raspberry Pi 4 CM board. The Raspberry Pi 400 board does not include RJ45 connector LEDs so the 'leds' node is deleted accordingly.

---
Changes in v2:

- added "function = LED_FUNCTION_LAN"

  .../arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts | 20 +++++++++++++++++ .../arm/boot/dts/broadcom/bcm2711-rpi-400.dts |  1 + .../boot/dts/broadcom/bcm2711-rpi-cm4-io.dts  | 22 +++++++++++++++++++

  3 files changed, 43 insertions(+)
arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts +15 -0
index cfc8cb5e10ba..7a0f495ff726 100644
@@ -5,6 +5,7 @@
   #include "bcm283x-rpi-led-deprecated.dtsi"
   #include "bcm283x-rpi-usb-peripheral.dtsi"
   #include "bcm283x-rpi-wifi-bt.dtsi"
+#include <dt-bindings/leds/common.h>
 
   / {
       compatible = "raspberrypi,4-model-b", "brcm,bcm2711";
@@ -204,6 +205,25 @@ &genet_mdio {
       phy1: ethernet-phy@1 {
           /* No PHY interrupt */
           reg = <0x1>;
+
+        leds {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            leds@0 {
+                reg = <0>;
+                color = <LED_COLOR_ID_GREEN>;
+                function = LED_FUNCTION_LAN;
+                default-state = "keep";
+            };
+
+            leds@1 {
+                reg = <1>;
Quoted 8 lines

arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts &genet_mdio { · line 226

Quoted 5 lines
arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts +5 -0
+                color = <LED_COLOR_ID_AMBER>;
+                function = LED_FUNCTION_LAN;
+                default-state = "keep";
+            };
+        };

this looks good to me, but i'm wondering about the address numbering. This ones starts with 0 and the CM4 starts with 1. Does this come from the PHY?

Yes the PHY numbering is local to the PHY, reg = 0 maps to LED1, reg = 1 maps to LED2 and so on and so forth. There is no LED0 in the PHY datasheet, so I expect people writing DTSs to subtract by 1 when defining their "reg" property.

Will re-submit with the DT issues spotted by Rob's bot fixed.

Signature · 1 line
Florian
maintainer
#3 lore raw
In reply to Florian Fainelli
Quoted 8 lines · Florian Fainelli

Describe the Ethernet LEDs for the Raspberry Pi 4 model B board as well as the Raspberry Pi 4 CM board. The Raspberry Pi 400 board does not include RJ45 connector LEDs so the 'leds' node is deleted accordingly.

---
Changes in v2:

Quoted 7 lines

- added "function = LED_FUNCTION_LAN"

 .../arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts | 20 +++++++++++++++++
 .../arm/boot/dts/broadcom/bcm2711-rpi-400.dts |  1 +
 .../boot/dts/broadcom/bcm2711-rpi-cm4-io.dts  | 22 +++++++++++++++++++
 3 files changed, 43 insertions(+)

My bot found new DTB warnings on the .dts files added or changed in this series.

Some warnings may be from an existing SoC .dtsi. Or perhaps the warnings are fixed by another series. Ultimately, it is up to the platform maintainer whether these warnings are acceptable or not. No need to reply unless the platform maintainer has comments.

If you already ran DT checks and didn't see these error(s), then make sure dt-schema is up to date:

  pip3 install dtschema --upgrade

New warnings running 'make CHECK_DTBS=y broadcom/bcm2711-rpi-4-b.dtb broadcom/bcm2711-rpi-400.dtb broadcom/bcm2711-rpi-cm4-io.dtb' for [email protected]:

arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dtb: ethernet-phy@1: leds: 'leds@0', 'leds@1' do not match any of the regexes: '^led@[a-f0-9]+$', 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/net/ethernet-phy.yaml#
arch/arm/boot/dts/broadcom/bcm2711-rpi-400.dtb: ethernet-phy@1: leds: 'leds@0', 'leds@1' do not match any of the regexes: '^led@[a-f0-9]+$', 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/net/ethernet-phy.yaml#
arch/arm/boot/dts/broadcom/bcm2711-rpi-cm4-io.dtb: ethernet-phy@0: leds: 'leds@1', 'leds@2' do not match any of the regexes: '^led@[a-f0-9]+$', 'pinctrl-[0-9]+'
from schema $id: http://devicetree.org/schemas/net/ethernet-phy.yaml#