arm64: dts: allwiner: h5: OrangePi PC2: add ethernet LEDs
Subsystems (2)
PATCH 1/1 arm64: dts: allwiner: h5: OrangePi PC2: add ethernet LEDs
This patch adds support for Ethernet LEDs.
--- .../dts/allwinner/sun50i-h5-orangepi-pc2.dts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+)
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts +20 -0
@@ -7,6 +7,7 @@ #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/input/input.h> +#include <dt-bindings/leds/common.h> #include <dt-bindings/pinctrl/sun4i-a10.h> / {
@@ -132,6 +133,25 @@ &external_mdio { ext_rgmii_phy: ethernet-phy@1 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <1>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_LAN; + linux,default-trigger = "netdev"; + }; + + led@1 { + reg = <1>; + color = <LED_COLOR_ID_AMBER>; + function = LED_FUNCTION_LAN; + linux,default-trigger = "netdev"; + }; + }; }; };
Signature · 1 line
2.47.2
Jernej Škrabec
maintainerDne ponedeljek, 18. avgust 2025 ob 18:35:13 Srednjeevropski poletni čas je Aleksander Jan Bajkowski napisal(a):
Quoted 1 line
This patch adds support for Ethernet LEDs.
How did you tested this? According to linux-sunxi wiki, this board has RTL8211E, while LED control is supported only with RTL8211F driver.
Quoted 30 lines
Signed-off-by Aleksander Jan Bajkowski <[email protected]>--- .../dts/allwinner/sun50i-h5-orangepi-pc2.dts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+)arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts +9
-0@@ -7,6 +7,7 @@ #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/input/input.h> +#include <dt-bindings/leds/common.h> #include <dt-bindings/pinctrl/sun4i-a10.h> / {@@ -132,6 +133,25 @@ &external_mdio { ext_rgmii_phy: ethernet-phy@1 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <1>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = <LED_COLOR_ID_GREEN>;
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts &external_mdio { · line 153
Quoted 10 lines
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts +10
-0+ function = LED_FUNCTION_LAN; + linux,default-trigger = "netdev"; + }; + + led@1 { + reg = <1>; + color = <LED_COLOR_ID_AMBER>; + function = LED_FUNCTION_LAN; + linux,default-trigger = "netdev"; + };
Schematic says LED0 is "Yellow" or Amber in this DT. So LED1 should be green.
Also, I'm not sure if trigger really needs to be added, since PHY network will set it as such.
Best regards,
Jernej
Quoted 5 lines
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts +1
-0+ }; }; };
A message that is not in the archive (sent off-list or not yet received): [email protected]
Dne torek, 9. september 2025 ob 00:11:46 Srednjeevropski poletni čas je Aleksander Jan Bajkowski napisal(a):
Quoted 9 lines
Hi Jernej,
Quoted 4 lines · Jernej Škrabec
Dne ponedeljek, 18. avgust 2025 ob 18:35:13 Srednjeevropski poletni čas je Aleksander Jan Bajkowski napisal(a):
Quoted 1 line
This patch adds support for Ethernet LEDs.
How did you tested this? According to linux-sunxi wiki, this board has RTL8211E, while LED control is supported only with RTL8211F driver.
Quoted 5 lines
For testing, I used OpenWRT snapshot with kernel 6.12. OpenWRT backported patches from kernel 6.16 that add LED control support. Realtek RTL8211E supports LED control since commit:
708686132ba02659267c0cebcc414348ece389a5("net: phy: realtek: Add support for PHY LEDs on RTL8211E")
Ah, I haven't checked the latest code. Alright.
Quoted 43 lines
Quoted 43 lines
Quoted 31 lines
Signed-off-by Aleksander Jan Bajkowski<[email protected]>--- .../dts/allwinner/sun50i-h5-orangepi-pc2.dts | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+)arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts +9
-0@@ -7,6 +7,7 @@ #include <dt-bindings/gpio/gpio.h> #include <dt-bindings/input/input.h> +#include <dt-bindings/leds/common.h> #include <dt-bindings/pinctrl/sun4i-a10.h> / {@@ -132,6 +133,25 @@ &external_mdio { ext_rgmii_phy: ethernet-phy@1 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <1>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = <LED_COLOR_ID_GREEN>;arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts &external_mdio { · line 153
Quoted 10 lines
arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts +10
-0+ function = LED_FUNCTION_LAN; + linux,default-trigger = "netdev"; + }; + + led@1 { + reg = <1>; + color = <LED_COLOR_ID_AMBER>; + function = LED_FUNCTION_LAN; + linux,default-trigger = "netdev"; + };Schematic says LED0 is "Yellow" or Amber in this DT. So LED1 should be green.
Quoted 6 lines
Quoted 2 lines
Also, I'm not sure if trigger really needs to be added, since PHY network will set it as such.
I think there is a mistake in the schematic. Setting the trigger on LED0 illuminates the green LED. My tests found that the netdev trigger isn't set by default.
Ok.
Best regards,
Jernej
Quoted 1 line · On Mon, 18 Aug 2025 18:35:13 +0200 Aleksander Jan Bajkowski <[email protected]> wrote:
This patch adds support for Ethernet LEDs.
So I tried this on my OPi-PC2, but I cannot influence the LEDs. I have CONFIG_LED_TRIGGER_PHY and CONFIG_LEDS_TRIGGER_NETDEV built in, and I see mdio_mux-0.2:01:amber:lan and mdio_mux-0.2:01:green:lan in /sys/class/leds, but anything I write into trigger does not seem to change the output: it always stays on the network functionality, I guess because it's still configured to the PHY hardware wired function?
What am I missing?
Cheers,
Andre
Quoted 43 lines
Signed-off-by Aleksander Jan Bajkowski <[email protected]>--- .../dts/allwinner/sun50i-h5-orangepi-pc2.dts | 20+++++++++++++++++++ 1 file changed, 20 insertions(+)
(quoted diff) +0
-0
b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dtsindex0f29da7d51e6..7688f565ec9b100644 ---a/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts+++b/arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts@@ -7,6 +7,7 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>arch/arm64/boot/dts/allwinner/sun50i-h5-orangepi-pc2.dts +20
-0+#include <dt-bindings/leds/common.h> #include <dt-bindings/pinctrl/sun4i-a10.h> / {@@ -132,6 +133,25 @@ &external_mdio { ext_rgmii_phy: ethernet-phy@1 { compatible = "ethernet-phy-ieee802.3-c22"; reg = <1>; + + leds { + #address-cells = <1>; + #size-cells = <0>; + + led@0 { + reg = <0>; + color = <LED_COLOR_ID_GREEN>; + function = LED_FUNCTION_LAN; + linux,default-trigger = "netdev"; + }; + + led@1 { + reg = <1>; + color = <LED_COLOR_ID_AMBER>; + function = LED_FUNCTION_LAN; + linux,default-trigger = "netdev"; + }; + }; }; };
Hi Andre,
I see that my previous reply didn't reach lkml
Quoted 4 lines · Andre Przywara
Quoted 1 line · On Mon, 18 Aug 2025 18:35:13 +0200 Aleksander Jan Bajkowski <[email protected]> wrote:
This patch adds support for Ethernet LEDs.
Quoted 10 lines
So I tried this on my OPi-PC2, but I cannot influence the LEDs. I have
CONFIG_LED_TRIGGER_PHYandCONFIG_LEDS_TRIGGER_NETDEVbuilt in, and I see mdio_mux-0.2:01:amber:lan and mdio_mux-0.2:01:green:lan in/sys/class/leds, but anything I write into trigger does not seem to change the output: it always stays on the network functionality, I guess because it's still configured to the PHY hardware wired function?What am I missing?
You should also set up the name of the device that controls the activity:
Example:
root@OpenWrt:/sys/class/leds/mdio_mux-0.2:01:green:lan# echo "eth0" > device_name root@OpenWrt:/sys/class/leds/mdio_mux-0.2:01:green:lan# echo "1" > link_10 root@OpenWrt:/sys/class/leds/mdio_mux-0.2:01:green:lan# echo "1" > link_1000 root@OpenWrt:/sys/class/leds/mdio_mux-0.2:01:amber:lan# echo "eth0" > device_name root@OpenWrt:/sys/class/leds/mdio_mux-0.2:01:amber:lan# echo "1" > rx root@OpenWrt:/sys/class/leds/mdio_mux-0.2:01:amber:lan# echo "1" > tx
In the second iteration, I added the default-spate = “keep” property. By default, the LEDs will be activated as before.
Regards,
Aleksander