Guest User

HG556a LAN LEDS patch v2- lede 17.01

a guest
Mar 7th, 2017
159
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. diff --git a/target/linux/brcm63xx/base-files/etc/board.d/01_leds b/target/linux/brcm63xx/base-files/etc/board.d/01_leds
  2. index 8d8a942..f638f41 100755
  3. --- a/target/linux/brcm63xx/base-files/etc/board.d/01_leds
  4. +++ b/target/linux/brcm63xx/base-files/etc/board.d/01_leds
  5. @@ -38,12 +38,20 @@ fast2704v2)
  6.     ucidef_set_led_usbdev "usb" "USB" "F@ST2704V2:green:usb" "1-1"
  7.     ;;
  8.  hg553)
  9. -   ucidef_set_led_netdev "lan" "LAN" "HW553:blue:lan" "eth0"
  10. +   ucidef_set_led_switch "lan" "LAN" "HW553:blue:lan" "switch0" "0x0f"
  11.     ucidef_set_led_usbdev "usb1" "USB1" "HW553:red:hspa" "1-1"
  12.     ucidef_set_led_usbdev "usb2" "USB2" "HW553:blue:hspa" "1-2"
  13.     ;;
  14.  hg556a_*)
  15. -   ucidef_set_led_netdev "lan" "LAN" "HW556:red:dsl" "eth0"
  16. +   ucidef_set_led_switch "lan" "LAN" "HW556:red:dsl" "switch0" "0x0f"
  17. +   ucidef_set_led_switch "lan1green" "LAN1 (green)" "HW556:green:lan1" "switch0" "0x01" "0x04"
  18. +   ucidef_set_led_switch "lan2green" "LAN2 (green)" "HW556:green:lan2" "switch0" "0x02" "0x04"
  19. +   ucidef_set_led_switch "lan3green" "LAN3 (green)" "HW556:green:lan3" "switch0" "0x04" "0x04"
  20. +   ucidef_set_led_switch "lan4green" "LAN4 (green)" "HW556:green:lan4" "switch0" "0x08" "0x04"
  21. +   ucidef_set_led_switch "lan1red" "LAN1 (red)" "HW556:red:lan1" "switch0" "0x01" "0x02"
  22. +   ucidef_set_led_switch "lan2red" "LAN2 (red)" "HW556:red:lan2" "switch0" "0x02" "0x02"
  23. +   ucidef_set_led_switch "lan3red" "LAN3 (red)" "HW556:red:lan3" "switch0" "0x04" "0x02"
  24. +   ucidef_set_led_switch "lan4red" "LAN4 (red)" "HW556:red:lan4" "switch0" "0x08" "0x02"
  25.     ucidef_set_led_usbdev "usb" "USB" "HW556:red:hspa" "1-2"
  26.     ;;
  27.  hg622)
  28. diff --git a/target/linux/brcm63xx/config-4.4 b/target/linux/brcm63xx/config-4.4
  29. index fb448ad..a88028b 100644
  30. --- a/target/linux/brcm63xx/config-4.4
  31. +++ b/target/linux/brcm63xx/config-4.4
  32. @@ -19,6 +19,7 @@ CONFIG_SWCONFIG_B53_PHY_DRIVER=y
  33.  CONFIG_SWCONFIG_B53_PHY_FIXUP=y
  34.  CONFIG_SWCONFIG_B53_SPI_DRIVER=y
  35.  # CONFIG_SWCONFIG_B53_SRAB_DRIVER is not set
  36. +CONFIG_SWCONFIG_LEDS=y
  37.  CONFIG_BCM6345_EXT_IRQ=y
  38.  CONFIG_BCM6345_PERIPH_IRQ=y
  39.  CONFIG_BCM63XX=y
  40. diff --git a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
  41. index b884010..fb9be37 100644
  42. --- a/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
  43. +++ b/target/linux/generic/files/drivers/net/phy/b53/b53_common.c
  44. @@ -835,6 +835,28 @@ static int b53_port_set_link(struct switch_dev *sw_dev, int port,
  45.     return switch_generic_set_link(sw_dev, port, link);
  46.  }
  47.  
  48. +static int
  49. +b53_get_port_stats(struct switch_dev *dev,  int port,
  50. +           struct switch_port_stats *stats)
  51. +{
  52. +   struct b53_device *priv = sw_to_b53(dev);
  53. +   u64 txoctets, rxoctets;
  54. +
  55. +   if (!(BIT(port) & priv->enabled_ports))
  56. +       return -EINVAL;
  57. +
  58. +   if (is5365(priv) && port == 5)
  59. +       port = 8;
  60. +
  61. +   b53_read64(priv, B53_MIB_PAGE(port), 0x00, &txoctets);
  62. +   b53_read64(priv, B53_MIB_PAGE(port), (is5365(priv) || is63xx(priv)) ? 0x44 : 0x50, &rxoctets);
  63. +
  64. +   stats->rx_bytes = rxoctets;
  65. +   stats->tx_bytes = txoctets;
  66. +
  67. +   return 0;
  68. +}
  69. +
  70.  static int b53_phy_read16(struct switch_dev *dev, int addr, u8 reg, u16 *value)
  71.  {
  72.     struct b53_device *priv = sw_to_b53(dev);
  73. @@ -1064,6 +1086,7 @@ static const struct switch_dev_ops b53_switch_ops_25 = {
  74.     .reset_switch = b53_global_reset_switch,
  75.     .get_port_link = b53_port_get_link,
  76.     .set_port_link = b53_port_set_link,
  77. +   .get_port_stats = b53_get_port_stats,
  78.     .phy_read16 = b53_phy_read16,
  79.     .phy_write16 = b53_phy_write16,
  80.  };
  81. @@ -1090,6 +1113,7 @@ static const struct switch_dev_ops b53_switch_ops_65 = {
  82.     .reset_switch = b53_global_reset_switch,
  83.     .get_port_link = b53_port_get_link,
  84.     .set_port_link = b53_port_set_link,
  85. +   .get_port_stats = b53_get_port_stats,
  86.     .phy_read16 = b53_phy_read16,
  87.     .phy_write16 = b53_phy_write16,
  88.  };
  89. @@ -1116,6 +1140,7 @@ static const struct switch_dev_ops b53_switch_ops = {
  90.     .reset_switch = b53_global_reset_switch,
  91.     .get_port_link = b53_port_get_link,
  92.     .set_port_link = b53_port_set_link,
  93. +   .get_port_stats = b53_get_port_stats,
  94.     .phy_read16 = b53_phy_read16,
  95.     .phy_write16 = b53_phy_write16,
  96.  };
RAW Paste Data