net: dsa: bcm_sf2: disable RGMII interface(s) when link is down
authorFlorian Fainelli <f.fainelli@gmail.com>
Thu, 25 Sep 2014 00:05:19 +0000 (17:05 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 28 Sep 2014 21:14:09 +0000 (17:14 -0400)
When the link is down, disable the RGMII interface to conserve as much
power as possible. We re-enable the RGMII interface whenever the link is
detected.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/bcm_sf2.c

index d9b7da545063c9b921e524173ad00d688aa46a2e..58b8fef25b96a0d70af50161e2a0332036bc552e 100644 (file)
@@ -506,6 +506,15 @@ static void bcm_sf2_sw_adjust_link(struct dsa_switch *ds, int port,
                port_mode = EXT_REVMII;
                break;
        default:
+               /* All other PHYs: internal and MoCA */
+               goto force_link;
+       }
+
+       /* If the link is down, just disable the interface to conserve power */
+       if (!phydev->link) {
+               reg = reg_readl(priv, REG_RGMII_CNTRL_P(port));
+               reg &= ~RGMII_MODE_EN;
+               reg_writel(priv, reg, REG_RGMII_CNTRL_P(port));
                goto force_link;
        }