summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Oltean <olteanv@gmail.com>2019-03-23 18:18:46 -0400
committerDavid S. Miller <davem@davemloft.net>2019-03-26 14:24:47 -0400
commit450895d04ba13a96886eddfeddb11556ae8624f1 (patch)
treec75603351b496c0f612f11b6cbb6bf81beebc429
parent9926cb5f8b0f0aea535735185600d74db7608550 (diff)
net: phy: bcm54xx: Encode link speed and activity into LEDs
Previously the green and amber LEDs on this quad PHY were solid, to indicate an encoding of the link speed (10/100/1000). This keeps the LEDs always on just as before, but now they flash on Rx/Tx activity. Signed-off-by: Vladimir Oltean <olteanv@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/phy/broadcom.c13
-rw-r--r--include/linux/brcmphy.h16
2 files changed, 29 insertions, 0 deletions
diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index 9605d4fe540b..cb86a3e90c7d 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -323,6 +323,19 @@ static int bcm54xx_config_init(struct phy_device *phydev)
323 323
324 bcm54xx_phydsp_config(phydev); 324 bcm54xx_phydsp_config(phydev);
325 325
326 /* Encode link speed into LED1 and LED3 pair (green/amber).
327 * Also flash these two LEDs on activity. This means configuring
328 * them for MULTICOLOR and encoding link/activity into them.
329 */
330 val = BCM5482_SHD_LEDS1_LED1(BCM_LED_SRC_MULTICOLOR1) |
331 BCM5482_SHD_LEDS1_LED3(BCM_LED_SRC_MULTICOLOR1);
332 bcm_phy_write_shadow(phydev, BCM5482_SHD_LEDS1, val);
333
334 val = BCM_LED_MULTICOLOR_IN_PHASE |
335 BCM5482_SHD_LEDS1_LED1(BCM_LED_MULTICOLOR_LINK_ACT) |
336 BCM5482_SHD_LEDS1_LED3(BCM_LED_MULTICOLOR_LINK_ACT);
337 bcm_phy_write_exp(phydev, BCM_EXP_MULTICOLOR, val);
338
326 return 0; 339 return 0;
327} 340}
328 341
diff --git a/include/linux/brcmphy.h b/include/linux/brcmphy.h
index 9cd00a37b8d3..6db2d9a6e503 100644
--- a/include/linux/brcmphy.h
+++ b/include/linux/brcmphy.h
@@ -148,6 +148,22 @@
148#define BCM_LED_SRC_OFF 0xe /* Tied high */ 148#define BCM_LED_SRC_OFF 0xe /* Tied high */
149#define BCM_LED_SRC_ON 0xf /* Tied low */ 149#define BCM_LED_SRC_ON 0xf /* Tied low */
150 150
151/*
152 * Broadcom Multicolor LED configurations (expansion register 4)
153 */
154#define BCM_EXP_MULTICOLOR (MII_BCM54XX_EXP_SEL_ER + 0x04)
155#define BCM_LED_MULTICOLOR_IN_PHASE BIT(8)
156#define BCM_LED_MULTICOLOR_LINK_ACT 0x0
157#define BCM_LED_MULTICOLOR_SPEED 0x1
158#define BCM_LED_MULTICOLOR_ACT_FLASH 0x2
159#define BCM_LED_MULTICOLOR_FDX 0x3
160#define BCM_LED_MULTICOLOR_OFF 0x4
161#define BCM_LED_MULTICOLOR_ON 0x5
162#define BCM_LED_MULTICOLOR_ALT 0x6
163#define BCM_LED_MULTICOLOR_FLASH 0x7
164#define BCM_LED_MULTICOLOR_LINK 0x8
165#define BCM_LED_MULTICOLOR_ACT 0x9
166#define BCM_LED_MULTICOLOR_PROGRAM 0xa
151 167
152/* 168/*
153 * BCM5482: Shadow registers 169 * BCM5482: Shadow registers