Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Florian Fainelli and committed by
David S. Miller
cc013fb4 e4a60a93

+11 -2
+11 -2
drivers/net/ethernet/broadcom/genet/bcmgenet.c
··· 739 739 740 740 case GENET_POWER_PASSIVE: 741 741 /* Power down LED */ 742 - bcmgenet_mii_reset(priv->dev); 743 742 if (priv->hw_params->flags & GENET_HAS_EXT) { 744 743 reg = bcmgenet_ext_readl(priv, EXT_EXT_PWR_MGMT); 745 744 reg |= (EXT_PWR_DOWN_PHY | ··· 778 779 } 779 780 780 781 bcmgenet_ext_writel(priv, reg, EXT_EXT_PWR_MGMT); 781 - bcmgenet_mii_reset(priv->dev); 782 + 783 + if (mode == GENET_POWER_PASSIVE) 784 + bcmgenet_mii_reset(priv->dev); 782 785 } 783 786 784 787 /* ioctl handle special commands that are not present in ethtool. */ ··· 2165 2164 * disabled no new work will be scheduled. 2166 2165 */ 2167 2166 cancel_work_sync(&priv->bcmgenet_irq_work); 2167 + 2168 + priv->old_pause = -1; 2169 + priv->old_link = -1; 2170 + priv->old_duplex = -1; 2168 2171 } 2169 2172 2170 2173 static int bcmgenet_close(struct net_device *dev) ··· 2616 2611 2617 2612 bcmgenet_netif_stop(dev); 2618 2613 2614 + phy_suspend(priv->phydev); 2615 + 2619 2616 netif_device_detach(dev); 2620 2617 2621 2618 /* Disable MAC receive */ ··· 2699 2692 bcmgenet_enable_dma(priv, dma_ctrl); 2700 2693 2701 2694 netif_device_attach(dev); 2695 + 2696 + phy_resume(priv->phydev); 2702 2697 2703 2698 bcmgenet_netif_start(dev); 2704 2699