Re: [PATCH v2] arm: dts: bcm2711: Describe Ethernet LEDs

From: Florian Fainelli
Date: Tue Apr 23 2024 - 12:39:05 EST


On 4/22/24 22:44, Stefan Wahren wrote:
Hi Florian,

Am 23.04.24 um 01:08 schrieb 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.

Signed-off-by: Florian Fainelli <florian.fainelli@xxxxxxxxxxxx>
---
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(+)

diff --git a/arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts b/arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts
index cfc8cb5e10ba..7a0f495ff726 100644
--- a/arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts
+++ b/arch/arm/boot/dts/broadcom/bcm2711-rpi-4-b.dts
@@ -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";
+            };
+        };
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.
--
Florian

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature