[net-next,11/11] arm: mvebu: dt: Add PHY LED support for 370-rd WAN port

Message ID 20230307170046.28917-12-ansuelsmth@gmail.com
State New
Headers
Series net: Add basic LED support for switch/phy |

Commit Message

Christian Marangi March 7, 2023, 5 p.m. UTC
  From: Andrew Lunn <andrew@lunn.ch>

The WAN port of the 370-RD has a Marvell PHY, with one LED on
the front panel. List this LED in the device tree.

Set the LED default state to "keep" to not change any blink rule
set by default.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
 arch/arm/boot/dts/armada-370-rd.dts | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
  

Comments

Christian Marangi March 7, 2023, 6:03 p.m. UTC | #1
On Wed, Mar 08, 2023 at 12:20:17AM +0100, Andrew Lunn wrote:
> On Tue, Mar 07, 2023 at 06:00:46PM +0100, Christian Marangi wrote:
> > From: Andrew Lunn <andrew@lunn.ch>
> > 
> > The WAN port of the 370-RD has a Marvell PHY, with one LED on
> > the front panel. List this LED in the device tree.
> > 
> > Set the LED default state to "keep" to not change any blink rule
> > set by default.
> 
> Hi Christian
> 
> What board are you using for testing? It would be good to patch its
> .dts file to enable its LEDs. We don't normally had new code without a
> user.
> 

ipq806x, my specific device is not present upstream but we have a rb3011
that currently use the qca8k dsa switch upstream.
If needed I can add support there by checking the leds supported...

Also looking at the dt I think I need to use "port - 1" after all since
it does use legacy way... Sad me...
  
Andrew Lunn March 7, 2023, 11:20 p.m. UTC | #2
On Tue, Mar 07, 2023 at 06:00:46PM +0100, Christian Marangi wrote:
> From: Andrew Lunn <andrew@lunn.ch>
> 
> The WAN port of the 370-RD has a Marvell PHY, with one LED on
> the front panel. List this LED in the device tree.
> 
> Set the LED default state to "keep" to not change any blink rule
> set by default.

Hi Christian

What board are you using for testing? It would be good to patch its
.dts file to enable its LEDs. We don't normally had new code without a
user.

	Andrew
  

Patch

diff --git a/arch/arm/boot/dts/armada-370-rd.dts b/arch/arm/boot/dts/armada-370-rd.dts
index be005c9f42ef..ccd4699b219f 100644
--- a/arch/arm/boot/dts/armada-370-rd.dts
+++ b/arch/arm/boot/dts/armada-370-rd.dts
@@ -20,6 +20,7 @@ 
 /dts-v1/;
 #include <dt-bindings/input/input.h>
 #include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/leds/common.h>
 #include <dt-bindings/gpio/gpio.h>
 #include "armada-370.dtsi"
 
@@ -135,6 +136,19 @@  &mdio {
 	pinctrl-names = "default";
 	phy0: ethernet-phy@0 {
 		reg = <0>;
+		leds {
+			#address-cells = <1>;
+			#size-cells = <0>;
+
+			led@0 {
+				reg = <0>;
+				label = "WAN";
+				color = <LED_COLOR_ID_WHITE>;
+				function = LED_FUNCTION_LAN;
+				function-enumerator = <1>;
+				default-state = "keep";
+			};
+		};
 	};
 
 	switch: switch@10 {