aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2014-08-11 17:50:43 -0400
committerDavid S. Miller <davem@davemloft.net>2014-08-11 18:10:11 -0400
commitcc013fb4889892cd6058cfb122c43aeea7d930e8 (patch)
tree02b8332bbbfdc0c0797c2d7296a4fdd2a2bf93eb /drivers/net
parente4a60a93c4a6e7dd4e3e82736b932375598a26fd (diff)
net: bcmgenet: correctly suspend and resume PHY device
Make sure that we properly suspend and resume the PHY device when we enter low power modes. We had two calls to bcmgenet_mii_reset() which will issue a software-reset to the PHY without using the PHY library, get rid of them since they are completely bogus and mess up with the PHY library state. Make sure that we reset the PHY library cached values (link, pause and duplex) to allow the link adjustment callback to be invoked when needed. Fixes: b6e978e50444 ("net: bcmgenet: add suspend/resume callbacks") Fixes: 1c1008c793fa4 ("net: bcmgenet: add main driver file") Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/ethernet/broadcom/genet/bcmgenet.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 7a3661c090ee..90eb9c4b1b2c 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -739,7 +739,6 @@ static void bcmgenet_power_down(struct bcmgenet_priv *priv,
739 739
740 case GENET_POWER_PASSIVE: 740 case GENET_POWER_PASSIVE:
741 /* Power down LED */ 741 /* Power down LED */
742 bcmgenet_mii_reset(priv->dev);
743 if (priv->hw_params->flags & GENET_HAS_EXT) { 742 if (priv->hw_params->flags & GENET_HAS_EXT) {
744 reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); 743 reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT);
745 reg |= (EXT_PWR_DOWN_PHY | 744 reg |= (EXT_PWR_DOWN_PHY |
@@ -779,7 +778,9 @@ static void bcmgenet_power_up(struct bcmgenet_priv *priv,
779 } 778 }
780 779
781 bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); 780 bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
782 bcmgenet_mii_reset(priv->dev); 781
782 if (mode == GENET_POWER_PASSIVE)
783 bcmgenet_mii_reset(priv->dev);
783} 784}
784 785
785/* ioctl handle special commands that are not present in ethtool. */ 786/* ioctl handle special commands that are not present in ethtool. */
@@ -2164,6 +2165,10 @@ static void bcmgenet_netif_stop(struct net_device *dev)
2164 * disabled no new work will be scheduled. 2165 * disabled no new work will be scheduled.
2165 */ 2166 */
2166 cancel_work_sync(&priv->bcmgenet_irq_work); 2167 cancel_work_sync(&priv->bcmgenet_irq_work);
2168
2169 priv->old_pause = -1;
2170 priv->old_link = -1;
2171 priv->old_duplex = -1;
2167} 2172}
2168 2173
2169static int bcmgenet_close(struct net_device *dev) 2174static int bcmgenet_close(struct net_device *dev)
@@ -2611,6 +2616,8 @@ static int bcmgenet_suspend(struct device *d)
2611 2616
2612 bcmgenet_netif_stop(dev); 2617 bcmgenet_netif_stop(dev);
2613 2618
2619 phy_suspend(priv->phydev);
2620
2614 netif_device_detach(dev); 2621 netif_device_detach(dev);
2615 2622
2616 /* Disable MAC receive */ 2623 /* Disable MAC receive */
@@ -2693,6 +2700,8 @@ static int bcmgenet_resume(struct device *d)
2693 2700
2694 netif_device_attach(dev); 2701 netif_device_attach(dev);
2695 2702
2703 phy_resume(priv->phydev);
2704
2696 bcmgenet_netif_start(dev); 2705 bcmgenet_netif_start(dev);
2697 2706
2698 return 0; 2707 return 0;