Re: [PATCH] net: phy: broadcom: Configure LEDs on BCM54210E

2024-04-02 Thread Michael Walle
On Thu Mar 28, 2024 at 4:09 PM CET, Tom Rini wrote:
> On Mon, Jan 01, 2024 at 10:07:47PM +0100, Marek Vasut wrote:
>
> > Configure LEDs on BCM54210E so they would blink on activity
> > and indicate link speed. Without this the LEDs are always on
> > if cable is plugged in.
> > 
> > Signed-off-by: Marek Vasut 
>
> Applied to u-boot/next, thanks!

Pretty late and I'm not implying this should be reverted. I just
want to point out, that this is really board dependent and might
even break boards which have this PHY and are using its default
configuration for the attached LEDs.

FWIW, linux now have LED PHY DT bindings.

-michael


signature.asc
Description: PGP signature


Re: [PATCH] net: phy: broadcom: Configure LEDs on BCM54210E

2024-03-28 Thread Tom Rini
On Mon, Jan 01, 2024 at 10:07:47PM +0100, Marek Vasut wrote:

> Configure LEDs on BCM54210E so they would blink on activity
> and indicate link speed. Without this the LEDs are always on
> if cable is plugged in.
> 
> Signed-off-by: Marek Vasut 

Applied to u-boot/next, thanks!

-- 
Tom


signature.asc
Description: PGP signature


[PATCH] net: phy: broadcom: Configure LEDs on BCM54210E

2024-01-01 Thread Marek Vasut
Configure LEDs on BCM54210E so they would blink on activity
and indicate link speed. Without this the LEDs are always on
if cable is plugged in.

Signed-off-by: Marek Vasut 
---
Cc: Joe Hershberger 
Cc: Rafał Miłecki 
Cc: Ramon Fried 
Cc: Rasmus Villemoes 
---
 drivers/net/phy/broadcom.c | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 82e3bbef7dd..ecccb7c3b54 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -42,6 +42,12 @@
 #define BCM54810_SHD_CLK_CTL   0x3
 #define BCM54810_SHD_CLK_CTL_GTXCLK_EN BIT(9)
 
+#define BCM54XX_SHD_LEDS1  0x0d
+#define BCM_LED_SRC_LINKSPD2   0x1
+#define BCM_LED_SRC_ACTIVITYLED0x3
+#define BCM54XX_SHD_LEDS1_LED3(src)(((src) & 0xf) << 4)
+#define BCM54XX_SHD_LEDS1_LED1(src)(((src) & 0xf) << 0)
+
 static int bcm54xx_auxctl_read(struct phy_device *phydev, u16 regnum)
 {
/* The register must be written to both the Shadow Register Select and
@@ -148,7 +154,16 @@ static int bcm54210e_config(struct phy_device *phydev)
if (ret < 0)
return ret;
 
-   return bcm5461_config(phydev);
+   ret = bcm5461_config(phydev);
+   if (ret < 0)
+   return ret;
+
+   /* Configure LEDs to blink. */
+   bcm_phy_write_shadow(phydev, BCM54XX_SHD_LEDS1,
+BCM54XX_SHD_LEDS1_LED1(BCM_LED_SRC_ACTIVITYLED) |
+BCM54XX_SHD_LEDS1_LED3(BCM_LED_SRC_LINKSPD2));
+
+   return 0;
 }
 
 static int bcm54xx_parse_status(struct phy_device *phydev)
-- 
2.43.0