Jetson/FAQ/BSP/Jetson TX2 NX ethernet LED indicators

From eLinux.org
Jump to: navigation, search

Questions

Jetson TX2

Ethernet chip: BCM89610
When gigabit network cable is connected to ethernet port, the network indicators' behavior is wrong (the data indicator always on and the connection indicator is flashing).
When 100m/10m network cable is connected, the network indicators' behavior is right.
How to fix gigabit network indicators' behavior?

Jetson NX

Ethernet chip: RTL8211F
When gigabit network cable is connected to ethernet port, the network indicators' behavior is right (the connection indicator always on and the data indicator is flashing).
When 100m/10m network cable is connected, all of the indicators are turned off.
How to set 100m/10m network indicators' behavior same as gigabit network?

Fixes

Jetson TX2

diff --git a/kernel/kernel-4.9/drivers/net/phy/broadcom.c b/kernel/kernel-4.9/drivers/net/phy/broadcom.c
index a1d1a9a71..22894c839 100644
--- a/kernel/kernel-4.9/drivers/net/phy/broadcom.c
+++ b/kernel/kernel-4.9/drivers/net/phy/broadcom.c
@@ -382,6 +382,53 @@ static int bcm54xx_config_init(struct phy_device *phydev)
        reg |= BIT(14); /* Enable rx of extended pkts */
        bcm89xx_shadow_write(phydev, MII_BCM89XX_SHD_AUX_CONTROL, reg);
 
+       /*
+        * LED1 (Orange) -> GBE_LINK_ACT  -> ACTIVITY Function
+        * LED3 (Green)  -> GBE_LINK_1000 -> LINKSPD2 Function
+        */
+
+       /* Read shadow control 1 register and program it to disable lom -led
+        * after that configure LEDs as link and activity
+        */
+
+       /* Disable LOM-LED */
+       reg = bcm_phy_read_shadow(phydev, BCM54XX_SHD_RGMII_MODE);
+       reg = reg & ~(1 << 2);
+       reg = reg & ~(1 << 5);
+       reg = reg & ~(3);
+       bcm_phy_write_shadow(phydev, BCM54XX_SHD_RGMII_MODE, reg);
+
+       /* activity control */
+       reg = bcm_phy_read_shadow(phydev, 0x09);
+       reg = reg | (1 << 4);
+       bcm_phy_write_shadow(phydev, 0x09, reg);
+
+       /* Configure activity functionality for LED1 */
+       reg = bcm_phy_read_shadow(phydev, BCM5482_SHD_LEDS1);
+       reg = reg & ~(0xf);
+       reg = reg | 0x3;
+       bcm_phy_write_shadow(phydev, BCM5482_SHD_LEDS1, reg);
+
+       /* Configure LINKSPD2 functionality for LED3 */
+       reg = bcm_phy_read_shadow(phydev, 0x0e);
+
+       /* Sets linkspd2 function which means link LED will be on for
+        * 1000 and 100 and not for the link speed 10
+        */
+       reg = reg & ~(0xf);
+       reg = reg | 0x1;
+       /* Selecting below and commenting above means linkspd1 function
+        * which means link LED will be on for 1000 and 10 but not for 100
+        */
+       /* reg = reg & ~(0xf); */
+
+       bcm_phy_write_shadow(phydev, 0x0e, reg);
+
+       reg = bcm_phy_read_shadow(phydev, 9);
+       /* variable blink rate, it can be 0 for the fixed blink rate */
+       reg = reg | 0x3;
+       bcm_phy_write_shadow(phydev, 9, reg);
+
 #ifdef CONFIG_EQOS_DISABLE_EEE
        /* Disable EEE advertisement. Nvbugs 2678273 */

Jetson NX

diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
index 963cd9b..c38dfa9 100644
--- a/drivers/net/phy/realtek.c
+++ b/drivers/net/phy/realtek.c
@@ -38,6 +38,8 @@
 #define RTL8211F_PHYCR2_REG    0x19
 #define RTL8211F_ALDPS_ENABLED 0x4
 #define RTL8211F_ALDPS_PLL_OFF 0x2
+#define RTL8211F_LED0_LINK_10  0x1
+#define RTL8211F_LED0_LINK_100 0x2
 #define RTL8211F_LED0_LINK_1000    0x8
 #define RTL8211F_LED1_LINK_1000    0x100
 #define RTL8211F_LED1_LINK_100 0x40
@@ -227,8 +229,9 @@
    if (ret)
        return ret;
 
-   /* Enable all speeds for activity indicator  and LED0 for GBE */
-   reg = RTL8211F_LED0_LINK_1000 | RTL8211F_LED1_LINK_1000 |
+   /* Enable all speeds for activity and link indicator */
+   reg = RTL8211F_LED0_LINK_10 | RTL8211F_LED0_LINK_100 |
+       RTL8211F_LED0_LINK_1000 | RTL8211F_LED1_LINK_1000 |
        RTL8211F_LED1_LINK_100 | RTL8211F_LED1_LINK_10 |
        RTL8211F_LED1_LINK_ACTIVE;