net: bcmgenet: implement GPHY power down sequence
authorFlorian Fainelli <f.fainelli@gmail.com>
Mon, 23 Mar 2015 22:09:55 +0000 (15:09 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Mar 2015 02:10:43 +0000 (22:10 -0400)
Implement the GPHY power down sequence by setting all power down bits, putting
the GPHY in reset, and finally cutting the 25Mhz reference clock.

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

index c26c0757d75543f71f6eb86623139aad35eaefdd..3320219003fba3f2c25cbc3646c70e6053f21b7d 100644 (file)
@@ -177,8 +177,8 @@ static void bcmgenet_phy_power_set(struct net_device *dev, bool enable)
        if (!GENET_IS_V4(priv))
                return;
 
+       reg = bcmgenet_ext_readl(priv, EXT_GPHY_CTRL);
        if (enable) {
-               reg = bcmgenet_ext_readl(priv, EXT_GPHY_CTRL);
                reg &= ~EXT_CK25_DIS;
                bcmgenet_ext_writel(priv, reg, EXT_GPHY_CTRL);
                mdelay(1);
@@ -189,9 +189,14 @@ static void bcmgenet_phy_power_set(struct net_device *dev, bool enable)
                mdelay(1);
 
                reg &= ~EXT_GPHY_RESET;
+       } else {
+               reg |= EXT_CFG_IDDQ_BIAS | EXT_CFG_PWR_DOWN | EXT_GPHY_RESET;
                bcmgenet_ext_writel(priv, reg, EXT_GPHY_CTRL);
-               udelay(60);
+               mdelay(1);
+               reg |= EXT_CK25_DIS;
        }
+       bcmgenet_ext_writel(priv, reg, EXT_GPHY_CTRL);
+       udelay(60);
 }
 
 static void bcmgenet_internal_phy_setup(struct net_device *dev)