Commit c677ba8b authored by Florian Fainelli's avatar Florian Fainelli Committed by David S. Miller
Browse files

net: bcmgenet: update UMAC_CMD only when link is detected

When we bring the interface down, phy_stop() will schedule the PHY state
machine to call our link adjustment callback. By the time we do so, we
may have clock gated off the GENET hardware block, and this will cause
bus errors to happen in bcmgenet_mii_setup():

Make sure that we only touch the UMAC_CMD register when there is an
actual link. This is safe to do for two reasons:

- updating the Ethernet MAC registers only make sense when a physical
  link is present
- the PHY library state machine first set phydev->link = 0 before
  invoking phydev->adjust_link in the PHY_HALTED case

Fixes: 24052408

 ("net: bcmgenet: only update UMAC_CMD if something changed")
Signed-off-by: default avatarFlorian Fainelli <>
Signed-off-by: default avatarDavid S. Miller <>
parent cc013fb4
......@@ -129,7 +129,10 @@ static void bcmgenet_mii_setup(struct net_device *dev)
if (status_changed) {
if (!status_changed)
if (phydev->link) {
reg = bcmgenet_umac_readl(priv, UMAC_CMD);
......@@ -137,8 +140,9 @@ static void bcmgenet_mii_setup(struct net_device *dev)
reg |= cmd_bits;
bcmgenet_umac_writel(priv, reg, UMAC_CMD);
void bcmgenet_mii_reset(struct net_device *dev)
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