1 From 84c4e27d24e8563945d5a3cdc922467051770986 Mon Sep 17 00:00:00 2001
2 From: James Hughes <james.hughes@raspberrypi.org>
3 Date: Thu, 31 Oct 2019 14:39:44 +0000
4 Subject: [PATCH] net:phy:2711 Allow ethernet LED mode to be set via
7 Add device tree entries and code to allow the specification of
8 the lighting modes for the LED's on the ethernet connector.
10 Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
12 net:phy:2711 Change the default ethernet LED actions
14 This should return default behaviour back to that of previous
17 drivers/net/phy/broadcom.c | 11 +++++++----
18 1 file changed, 7 insertions(+), 4 deletions(-)
20 --- a/drivers/net/phy/broadcom.c
21 +++ b/drivers/net/phy/broadcom.c
22 @@ -316,6 +316,9 @@ static void bcm54xx_adjust_rxrefclk(stru
23 static int bcm54xx_config_init(struct phy_device *phydev)
26 + u32 led_modes[] = {BCM_LED_MULTICOLOR_LINK_ACT,
27 + BCM_LED_MULTICOLOR_LINK};
28 + struct device_node *np = phydev->mdio.dev.of_node;
30 reg = phy_read(phydev, MII_BCM54XX_ECR);
32 @@ -371,10 +374,10 @@ static int bcm54xx_config_init(struct ph
34 bcm54xx_phydsp_config(phydev);
36 + of_property_read_u32_array(np, "led-modes", led_modes, 2);
38 /* For non-SFP setups, encode link speed into LED1 and LED3 pair
40 - * Also flash these two LEDs on activity. This means configuring
41 - * them for MULTICOLOR and encoding link/activity into them.
42 * Don't do this for devices on an SFP module, since some of these
43 * use the LED outputs to control the SFP LOS signal, and changing
44 * these settings will cause LOS to malfunction.
45 @@ -385,8 +388,8 @@ static int bcm54xx_config_init(struct ph
46 bcm_phy_write_shadow(phydev, BCM5482_SHD_LEDS1, val);
48 val = BCM_LED_MULTICOLOR_IN_PHASE |
49 - BCM5482_SHD_LEDS1_LED1(BCM_LED_MULTICOLOR_LINK_ACT) |
50 - BCM5482_SHD_LEDS1_LED3(BCM_LED_MULTICOLOR_LINK_ACT);
51 + BCM5482_SHD_LEDS1_LED1(led_modes[0]) |
52 + BCM5482_SHD_LEDS1_LED3(led_modes[1]);
53 bcm_phy_write_exp(phydev, BCM_EXP_MULTICOLOR, val);