Skip to content

Commit

Permalink
net: bcmgenet: Restore phy_stop() depending upon suspend/close
Browse files Browse the repository at this point in the history
Removing the phy_stop() from bcmgenet_netif_stop() ended up causing
warnings from the PHY library that phy_start() is called from the
RUNNING state since we are no longer stopping the PHY state machine
during bcmgenet_suspend().

Restore the call to phy_stop() but make it conditional on being called
from the close or suspend path.

Fixes: c96e731 ("net: bcmgenet: connect and disconnect from the PHY state machine")
Fixes: 93e0401 ("net: bcmgenet: Remove phy_stop() from bcmgenet_netif_stop()")
Signed-off-by: Florian Fainelli <[email protected]>
Reviewed-by: Pavan Chebbi <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
  • Loading branch information
ffainelli authored and Paolo Abeni committed May 16, 2023
1 parent df0acdc commit 225c657
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions drivers/net/ethernet/broadcom/genet/bcmgenet.c
Original file line number Diff line number Diff line change
Expand Up @@ -3450,7 +3450,7 @@ static int bcmgenet_open(struct net_device *dev)
return ret;
}

static void bcmgenet_netif_stop(struct net_device *dev)
static void bcmgenet_netif_stop(struct net_device *dev, bool stop_phy)
{
struct bcmgenet_priv *priv = netdev_priv(dev);

Expand All @@ -3465,6 +3465,8 @@ static void bcmgenet_netif_stop(struct net_device *dev)
/* Disable MAC transmit. TX DMA disabled must be done before this */
umac_enable_set(priv, CMD_TX_EN, false);

if (stop_phy)
phy_stop(dev->phydev);
bcmgenet_disable_rx_napi(priv);
bcmgenet_intr_disable(priv);

Expand All @@ -3485,7 +3487,7 @@ static int bcmgenet_close(struct net_device *dev)

netif_dbg(priv, ifdown, dev, "bcmgenet_close\n");

bcmgenet_netif_stop(dev);
bcmgenet_netif_stop(dev, false);

/* Really kill the PHY state machine and disconnect from it */
phy_disconnect(dev->phydev);
Expand Down Expand Up @@ -4303,7 +4305,7 @@ static int bcmgenet_suspend(struct device *d)

netif_device_detach(dev);

bcmgenet_netif_stop(dev);
bcmgenet_netif_stop(dev, true);

if (!device_may_wakeup(d))
phy_suspend(dev->phydev);
Expand Down

0 comments on commit 225c657

Please sign in to comment.