9f9e61989a2e31e75630ed5df337218edab13760
[openwrt/staging/ansuel.git] /
1 From 2c7d2adefa34858208435e771690d2808eaf809d 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
5 device tree
6
7 Add device tree entries and code to allow the specification of
8 the lighting modes for the LED's on the ethernet connector.
9
10 Signed-off-by: James Hughes <james.hughes@raspberrypi.org>
11
12 net:phy:2711 Change the default ethernet LED actions
13
14 This should return default behaviour back to that of previous
15 releases.
16 ---
17 drivers/net/phy/broadcom.c | 11 +++++++----
18 1 file changed, 7 insertions(+), 4 deletions(-)
19
20 --- a/drivers/net/phy/broadcom.c
21 +++ b/drivers/net/phy/broadcom.c
22 @@ -337,6 +337,9 @@ static void bcm54xx_ptp_config_init(stru
23 static int bcm54xx_config_init(struct phy_device *phydev)
24 {
25 int reg, err, val;
26 + u32 led_modes[] = {BCM_LED_MULTICOLOR_LINK_ACT,
27 + BCM_LED_MULTICOLOR_LINK};
28 + struct device_node *np = phydev->mdio.dev.of_node;
29
30 reg = phy_read(phydev, MII_BCM54XX_ECR);
31 if (reg < 0)
32 @@ -392,10 +395,10 @@ static int bcm54xx_config_init(struct ph
33
34 bcm54xx_phydsp_config(phydev);
35
36 + of_property_read_u32_array(np, "led-modes", led_modes, 2);
37 +
38 /* For non-SFP setups, encode link speed into LED1 and LED3 pair
39 * (green/amber).
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 @@ -406,8 +409,8 @@ static int bcm54xx_config_init(struct ph
46 bcm_phy_write_shadow(phydev, BCM5482_SHD_LEDS1, val);
47
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);
54 }
55