Skip to contentSkip to conversation

arm: dts: xilinx: add ethernet LEDs on Paralella board

PATCH New Aleksander Jan Bajkowski 2 participants 2 messages Dec 3

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: dts: xilinx: add ethernet LEDs on Paralella board

Add Ethernet LEDs on the Parallel board. This board has two Ethernet LEDs (green and yellow). Both LEDs are active-low and inactive-high-impedance. Previously, the polarization was configured using marvell,reg-init property. This property is deprecated. Keep the write to the 0x3:16 register, which sets the default triggers.

---
 arch/arm/boot/dts/xilinx/zynq-parallella.dts | 33 ++++++++++++++++++--
 1 file changed, 31 insertions(+), 2 deletions(-)
arch/arm/boot/dts/xilinx/zynq-parallella.dts +31 -2
index b4651540935a..750168657f37 100644
@@ -11,6 +11,9 @@
 /dts-v1/;
 /include/ "zynq-7000.dtsi"
 
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
+
 / {
 	model = "Adapteva Parallella board";
 	compatible = "adapteva,parallella", "xlnx,zynq-7000";
@@ -46,8 +49,34 @@ ethernet_phy: ethernet-phy@0 {
 		compatible = "ethernet-phy-id0141.0e90",
 			     "ethernet-phy-ieee802.3-c22";
 		reg = <0>;
-		marvell,reg-init = <0x3 0x10 0xff00 0x1e>,
-				   <0x3 0x11 0xfff0 0xa>;
+
+		/* Configure LEDs default behaviour */
+		marvell,reg-init = <0x3 0x10 0xff00 0x1e>;
+
+		leds {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			led@0 {
+				reg = <0>;
+				active-low;
+				inactive-high-impedance;
+				color = <LED_COLOR_ID_GREEN>;
+				function = LED_FUNCTION_LAN;
+				linux,default-trigger = "netdev";
+				default-state = "keep";
+			};
+
+			led@1 {
+				reg = <1>;
+				active-low;
+				inactive-high-impedance;
+				color = <LED_COLOR_ID_YELLOW>;
+				function = LED_FUNCTION_LAN;
+				linux,default-trigger = "netdev";
+				default-state = "keep";
+			};
+		};
 	};
 };
 
Signature · 1 line
2.55.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 2 potential issues to consider: - [Medium] ARM: dts: xilinx: netdev trigger on led@0 clobbers mode 0xe to OFF - [Low] ARM: dts: xilinx…

Thank you for your contribution! Sashiko AI review found 2 potential issues to consider:
- [Medium] ARM: dts: xilinx: netdev trigger on led@0 clobbers mode 0xe to OFF
- [Low] ARM: dts: xilinx: unused gpio.h include in zynq-parallella.dts --

commit 8106eb16ff931bffb2299a9e6b2e761e1c36c71f
Author: Aleksander Jan Bajkowski <[email protected]>

arm: dts: xilinx: add ethernet LEDs on Paralella board

This commit describes the two Ethernet PHY LEDs on the Adapteva Parallella board in devicetree and removes the deprecated marvell,reg-init write that configured their polarity, keeping the register write for default triggers.

arch/arm/boot/dts/xilinx/zynq-parallella.dts line 15

Quoted 10 lines
arch/arm/boot/dts/xilinx/zynq-parallella.dts +2 -0
index 1b2501098e883..3e7c9209fe3ff 100644
@@ -11,6 +11,9 @@
 /dts-v1/;
 /include/ "zynq-7000.dtsi"
 
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>

[Severity: Low]
Is the dt-bindings/gpio/gpio.h include needed? Nothing in zynq-parallella.dts references any GPIO constants from it.

[ ... ]

Quoted 13 lines
arch/arm/boot/dts/xilinx/zynq-parallella.dts +7 -2
@@ -46,8 +49,34 @@ ethernet_phy: ethernet-phy@0 {
 		compatible = "ethernet-phy-id0141.0e90",
 			     "ethernet-phy-ieee802.3-c22";
 		reg = <0>;
-		marvell,reg-init = <0x3 0x10 0xff00 0x1e>,
-				   <0x3 0x11 0xfff0 0xa>;
+
+		/* Configure LEDs default behaviour */
+		marvell,reg-init = <0x3 0x10 0xff00 0x1e>;
+
+		leds {
+			#address-cells = <1>;
+			#size-cells = <0>;

arch/arm/boot/dts/xilinx/zynq-parallella.dts ethernet_phy: ethernet-phy@0 { · line 68

Quoted 10 lines
arch/arm/boot/dts/xilinx/zynq-parallella.dts +10 -0
+
+			led@0 {
+				reg = <0>;
+				active-low;
+				inactive-high-impedance;
+				color = <LED_COLOR_ID_GREEN>;
+				function = LED_FUNCTION_LAN;
+				linux,default-trigger = "netdev";
+				default-state = "keep";
+			};

[Severity: Medium]
Will the netdev trigger on led@0 overwrite the 0xe hardware mode set by marvell,reg-init and turn the green LED off?

In drivers/net/phy/marvell.c, marvell_led0[] omits mode 0xe, so m88e1318_led_hw_control_get() returns -EOPNOTSUPP. When CONFIG_LEDS_TRIGGER_NETDEV is a module and netdev_trig_activate() runs after macb_open() attaches eth0, hw_control stays true with mode left at 0.

On the next NETDEV_UP event, netdev_trig_notify() -> set_baseline_state() calls m88e1318_led_hw_control_set(phydev, 0, 0), writing mode 0x8 (MII_88E1318S_PHY_LED_FUNC_OFF) to LED0. default-state = "keep" is not handled by of_phy_led(), so the green LED stays dark.

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1