]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: phy: broadcom: Configure LEDs on BCM54210E
authorMarek Vasut <marex@denx.de>
Mon, 1 Jan 2024 21:07:47 +0000 (22:07 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 26 Mar 2024 23:58:26 +0000 (19:58 -0400)
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 <marex@denx.de>
drivers/net/phy/broadcom.c

index 82e3bbef7ddf89b9a8bdded86cf2874dc1a2d55a..ecccb7c3b54ad1443c4465622a5ed627341655a4 100644 (file)
 #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_ACTIVITYLED                0x3
+#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)