From: Florian Fainelli Date: Thu, 25 Sep 2014 00:05:19 +0000 (-0700) Subject: net: dsa: bcm_sf2: disable RGMII interface(s) when link is down X-Git-Tag: v4.9.8~5591^2~130^2~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7de1557ce7521e756974d5c28794c2375d28e3cc;p=platform%2Fkernel%2Flinux-rpi3.git net: dsa: bcm_sf2: disable RGMII interface(s) when link is down 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 Signed-off-by: David S. Miller --- diff --git a/drivers/net/dsa/bcm_sf2.c b/drivers/net/dsa/bcm_sf2.c index d9b7da5..58b8fef 100644 --- a/drivers/net/dsa/bcm_sf2.c +++ b/drivers/net/dsa/bcm_sf2.c @@ -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; }