950-0173-net-phy-2711-Allow-ethernet-LED-mode-to-be-set-via-d.patch 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. From 3ab0c4b6aa76a4dedb51c4e800b5b4ba29187c46 Mon Sep 17 00:00:00 2001
  2. From: James Hughes <[email protected]>
  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. Add device tree entries and code to allow the specification of
  7. the lighting modes for the LED's on the ethernet connector.
  8. Signed-off-by: James Hughes <[email protected]>
  9. ---
  10. drivers/net/phy/broadcom.c | 9 +++++++--
  11. 1 file changed, 7 insertions(+), 2 deletions(-)
  12. --- a/drivers/net/phy/broadcom.c
  13. +++ b/drivers/net/phy/broadcom.c
  14. @@ -314,6 +314,9 @@ static void bcm54xx_adjust_rxrefclk(stru
  15. static int bcm54xx_config_init(struct phy_device *phydev)
  16. {
  17. int reg, err, val;
  18. + u32 led_modes[] = {BCM_LED_MULTICOLOR_LINK_ACT,
  19. + BCM_LED_MULTICOLOR_LINK_ACT};
  20. + struct device_node *np = phydev->mdio.dev.of_node;
  21. reg = phy_read(phydev, MII_BCM54XX_ECR);
  22. if (reg < 0)
  23. @@ -369,6 +372,8 @@ static int bcm54xx_config_init(struct ph
  24. bcm54xx_phydsp_config(phydev);
  25. + of_property_read_u32_array(np, "led-modes", led_modes, 2);
  26. +
  27. /* Encode link speed into LED1 and LED3 pair (green/amber).
  28. * Also flash these two LEDs on activity. This means configuring
  29. * them for MULTICOLOR and encoding link/activity into them.
  30. @@ -378,8 +383,8 @@ static int bcm54xx_config_init(struct ph
  31. bcm_phy_write_shadow(phydev, BCM5482_SHD_LEDS1, val);
  32. val = BCM_LED_MULTICOLOR_IN_PHASE |
  33. - BCM5482_SHD_LEDS1_LED1(BCM_LED_MULTICOLOR_LINK_ACT) |
  34. - BCM5482_SHD_LEDS1_LED3(BCM_LED_MULTICOLOR_LINK_ACT);
  35. + BCM5482_SHD_LEDS1_LED1(led_modes[0]) |
  36. + BCM5482_SHD_LEDS1_LED3(led_modes[1]);
  37. bcm_phy_write_exp(phydev, BCM_EXP_MULTICOLOR, val);
  38. return 0;