Commit cc013fb4 authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller

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: b6e978e5 ("net: bcmgenet: add suspend/resume callbacks")
Fixes: 1c1008c7 ("net: bcmgenet: add main driver file")
Signed-off-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent e4a60a93
...@@ -739,7 +739,6 @@ static void bcmgenet_power_down(struct bcmgenet_priv *priv, ...@@ -739,7 +739,6 @@ static void bcmgenet_power_down(struct bcmgenet_priv *priv,
case GENET_POWER_PASSIVE: case GENET_POWER_PASSIVE:
/* Power down LED */ /* Power down LED */
bcmgenet_mii_reset(priv->dev);
if (priv->hw_params->flags & GENET_HAS_EXT) { if (priv->hw_params->flags & GENET_HAS_EXT) {
reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT);
reg |= (EXT_PWR_DOWN_PHY | reg |= (EXT_PWR_DOWN_PHY |
...@@ -779,6 +778,8 @@ static void bcmgenet_power_up(struct bcmgenet_priv *priv, ...@@ -779,6 +778,8 @@ static void bcmgenet_power_up(struct bcmgenet_priv *priv,
} }
bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT);
if (mode == GENET_POWER_PASSIVE)
bcmgenet_mii_reset(priv->dev); bcmgenet_mii_reset(priv->dev);
} }
...@@ -2164,6 +2165,10 @@ static void bcmgenet_netif_stop(struct net_device *dev) ...@@ -2164,6 +2165,10 @@ static void bcmgenet_netif_stop(struct net_device *dev)
* disabled no new work will be scheduled. * disabled no new work will be scheduled.
*/ */
cancel_work_sync(&priv->bcmgenet_irq_work); cancel_work_sync(&priv->bcmgenet_irq_work);
priv->old_pause = -1;
priv->old_link = -1;
priv->old_duplex = -1;
} }
static int bcmgenet_close(struct net_device *dev) static int bcmgenet_close(struct net_device *dev)
...@@ -2611,6 +2616,8 @@ static int bcmgenet_suspend(struct device *d) ...@@ -2611,6 +2616,8 @@ static int bcmgenet_suspend(struct device *d)
bcmgenet_netif_stop(dev); bcmgenet_netif_stop(dev);
phy_suspend(priv->phydev);
netif_device_detach(dev); netif_device_detach(dev);
/* Disable MAC receive */ /* Disable MAC receive */
...@@ -2693,6 +2700,8 @@ static int bcmgenet_resume(struct device *d) ...@@ -2693,6 +2700,8 @@ static int bcmgenet_resume(struct device *d)
netif_device_attach(dev); netif_device_attach(dev);
phy_resume(priv->phydev);
bcmgenet_netif_start(dev); bcmgenet_netif_start(dev);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment