* [PATCH] net: phy: bcm54xx: Encode link speed and activity into LEDs
@ 2019-03-23 22:18 Vladimir Oltean
2019-03-24 1:27 ` Florian Fainelli
2019-03-26 18:24 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Vladimir Oltean @ 2019-03-23 22:18 UTC (permalink / raw)
To: davem, netdev; +Cc: andrew, f.fainelli, hkallweit1, Vladimir Oltean
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>
---
drivers/net/phy/broadcom.c | 13 +++++++++++++
include/linux/brcmphy.h | 16 ++++++++++++++++
2 files changed, 29 insertions(+)
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)
bcm54xx_phydsp_config(phydev);
+ /* Encode link speed into LED1 and LED3 pair (green/amber).
+ * Also flash these two LEDs on activity. This means configuring
+ * them for MULTICOLOR and encoding link/activity into them.
+ */
+ val = BCM5482_SHD_LEDS1_LED1(BCM_LED_SRC_MULTICOLOR1) |
+ BCM5482_SHD_LEDS1_LED3(BCM_LED_SRC_MULTICOLOR1);
+ bcm_phy_write_shadow(phydev, BCM5482_SHD_LEDS1, val);
+
+ val = BCM_LED_MULTICOLOR_IN_PHASE |
+ BCM5482_SHD_LEDS1_LED1(BCM_LED_MULTICOLOR_LINK_ACT) |
+ BCM5482_SHD_LEDS1_LED3(BCM_LED_MULTICOLOR_LINK_ACT);
+ bcm_phy_write_exp(phydev, BCM_EXP_MULTICOLOR, val);
+
return 0;
}
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 @@
#define BCM_LED_SRC_OFF 0xe /* Tied high */
#define BCM_LED_SRC_ON 0xf /* Tied low */
+/*
+ * Broadcom Multicolor LED configurations (expansion register 4)
+ */
+#define BCM_EXP_MULTICOLOR (MII_BCM54XX_EXP_SEL_ER + 0x04)
+#define BCM_LED_MULTICOLOR_IN_PHASE BIT(8)
+#define BCM_LED_MULTICOLOR_LINK_ACT 0x0
+#define BCM_LED_MULTICOLOR_SPEED 0x1
+#define BCM_LED_MULTICOLOR_ACT_FLASH 0x2
+#define BCM_LED_MULTICOLOR_FDX 0x3
+#define BCM_LED_MULTICOLOR_OFF 0x4
+#define BCM_LED_MULTICOLOR_ON 0x5
+#define BCM_LED_MULTICOLOR_ALT 0x6
+#define BCM_LED_MULTICOLOR_FLASH 0x7
+#define BCM_LED_MULTICOLOR_LINK 0x8
+#define BCM_LED_MULTICOLOR_ACT 0x9
+#define BCM_LED_MULTICOLOR_PROGRAM 0xa
/*
* BCM5482: Shadow registers
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: phy: bcm54xx: Encode link speed and activity into LEDs
2019-03-23 22:18 [PATCH] net: phy: bcm54xx: Encode link speed and activity into LEDs Vladimir Oltean
@ 2019-03-24 1:27 ` Florian Fainelli
2019-03-26 18:24 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2019-03-24 1:27 UTC (permalink / raw)
To: Vladimir Oltean, davem, netdev; +Cc: andrew, hkallweit1
On 3/23/2019 3:18 PM, Vladimir Oltean wrote:
> 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.
>
We should probably revamp the whole way the PHY drivers configure LEDs
and come up with a number of standard LED encoding properties in Device
Tree to describe the different possible scenarios, but until we get there:
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] net: phy: bcm54xx: Encode link speed and activity into LEDs
2019-03-23 22:18 [PATCH] net: phy: bcm54xx: Encode link speed and activity into LEDs Vladimir Oltean
2019-03-24 1:27 ` Florian Fainelli
@ 2019-03-26 18:24 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-03-26 18:24 UTC (permalink / raw)
To: olteanv; +Cc: netdev, andrew, f.fainelli, hkallweit1
From: Vladimir Oltean <olteanv@gmail.com>
Date: Sun, 24 Mar 2019 00:18:46 +0200
> 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>
Applied.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-03-26 18:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-23 22:18 [PATCH] net: phy: bcm54xx: Encode link speed and activity into LEDs Vladimir Oltean
2019-03-24 1:27 ` Florian Fainelli
2019-03-26 18:24 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.