0005-qca807x-add-a-LED-quirk-for-Xiaomi-AX9000.patch 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. From 37255b97a9170f6dd1604931f0d7a8f847be5b5d Mon Sep 17 00:00:00 2001
  2. From: Robert Marko <[email protected]>
  3. Date: Tue, 11 Jan 2022 00:28:42 +0100
  4. Subject: [PATCH 05/14] qca807x: add a LED quirk for Xiaomi AX9000
  5. Xiaomi AX9000 has a single LED for each of 4 gigabit ethernet ports that
  6. are connected to QCA8075, and that LED is connected to the 100M LED pin.
  7. So, by default it will only work when in 10 or 100Mbit mode, this is quite
  8. annoying and makes no sense(If they have connected it to the 1000Mbit LED
  9. pin then it would have worked for 10/100 by default as well).
  10. So, to solve this add a check for system compatible as we cant parse if
  11. from DTS in any other way and set the 100M LED to blink on 1000Base-T
  12. as well.
  13. Signed-off-by: Robert Marko <[email protected]>
  14. ---
  15. include/hsl/phy/malibu_phy.h | 2 ++
  16. src/hsl/phy/malibu_phy.c | 11 +++++++++++
  17. 2 files changed, 13 insertions(+)
  18. --- a/include/hsl/phy/malibu_phy.h
  19. +++ b/include/hsl/phy/malibu_phy.h
  20. @@ -94,6 +94,7 @@ extern "C"
  21. #define MALIBU_DAC_CTRL_MASK 0x380
  22. #define MALIBU_DAC_CTRL_VALUE 0x280
  23. #define MALIBU_LED_1000_CTRL1_100_10_MASK 0x30
  24. +#define MALIBU_LED_100_CTRL1_1000_MASK 0x40
  25. #define MALIBU_PHY_EEE_ADV_100M 0x0002
  26. #define MALIBU_PHY_EEE_ADV_1000M 0x0004
  27. @@ -118,6 +119,7 @@ extern "C"
  28. #define MALIBU_PHY_MMD7_EGRESS_COUNTER_HIGH 0x802d
  29. #define MALIBU_PHY_MMD7_EGRESS_COUNTER_LOW 0x802e
  30. #define MALIBU_PHY_MMD7_EGRESS_ERROR_COUNTER 0x802f
  31. +#define MALIBU_PHY_MMD7_LED_100_CTRL1 0x8074
  32. #define MALIBU_PHY_MMD7_LED_1000_CTRL1 0x8076
  33. --- a/src/hsl/phy/malibu_phy.c
  34. +++ b/src/hsl/phy/malibu_phy.c
  35. @@ -15,6 +15,8 @@
  36. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  37. */
  38. +#include <linux/of.h>
  39. +
  40. #include "sw.h"
  41. #include "fal_port_ctrl.h"
  42. #include "hsl_api.h"
  43. @@ -2708,6 +2710,15 @@ malibu_phy_hw_init(a_uint32_t dev_id, a_
  44. led_status |= MALIBU_LED_1000_CTRL1_100_10_MASK;
  45. malibu_phy_mmd_write(dev_id, phy_addr, MALIBU_PHY_MMD7_NUM,
  46. MALIBU_PHY_MMD7_LED_1000_CTRL1, led_status);
  47. + if (of_machine_is_compatible("xiaomi,ax9000")) {
  48. + /* add 1000M link LED behavior for Xiaomi AX9000 */
  49. + led_status = malibu_phy_mmd_read(dev_id, phy_addr, MALIBU_PHY_MMD7_NUM,
  50. + MALIBU_PHY_MMD7_LED_100_CTRL1);
  51. + led_status &= ~MALIBU_LED_100_CTRL1_1000_MASK;
  52. + led_status |= MALIBU_LED_100_CTRL1_1000_MASK;
  53. + malibu_phy_mmd_write(dev_id, phy_addr, MALIBU_PHY_MMD7_NUM,
  54. + MALIBU_PHY_MMD7_LED_100_CTRL1, led_status);
  55. + }
  56. /*disable Extended next page*/
  57. phy_data = malibu_phy_reg_read(dev_id, phy_addr, MALIBU_AUTONEG_ADVERT);
  58. phy_data &= ~MALIBU_EXTENDED_NEXT_PAGE_EN;