Skip to content

Commit 0686bd9

Browse files
Doug Bergerdavem330
authored andcommitted
net: bcmgenet: reapply manual settings to the PHY
The phy_init_hw() function may reset the PHY to a configuration that does not match manual network settings stored in the phydev structure. If the phy state machine is polled rather than event driven this can create a timing hazard where the phy state machine might alter the settings stored in the phydev structure from the value read from the BMCR. This commit follows invocations of phy_init_hw() by the bcmgenet driver with invocations of the genphy_config_aneg() function to ensure that the BMCR is written to match the settings held in the phydev structure. This prevents the risk of manual settings being accidentally altered. Fixes: 1c1008c ("net: bcmgenet: add main driver file") Signed-off-by: Doug Berger <opendmb@gmail.com> Acked-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 6b6d017 commit 0686bd9

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

drivers/net/ethernet/broadcom/genet/bcmgenet.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2612,8 +2612,10 @@ static void bcmgenet_irq_task(struct work_struct *work)
26122612
spin_unlock_irq(&priv->lock);
26132613

26142614
if (status & UMAC_IRQ_PHY_DET_R &&
2615-
priv->dev->phydev->autoneg != AUTONEG_ENABLE)
2615+
priv->dev->phydev->autoneg != AUTONEG_ENABLE) {
26162616
phy_init_hw(priv->dev->phydev);
2617+
genphy_config_aneg(priv->dev->phydev);
2618+
}
26172619

26182620
/* Link UP/DOWN event */
26192621
if (status & UMAC_IRQ_LINK_EVENT)
@@ -3634,6 +3636,7 @@ static int bcmgenet_resume(struct device *d)
36343636
phy_init_hw(dev->phydev);
36353637

36363638
/* Speed settings must be restored */
3639+
genphy_config_aneg(dev->phydev);
36373640
bcmgenet_mii_config(priv->dev, false);
36383641

36393642
bcmgenet_set_hw_addr(priv, dev->dev_addr);

0 commit comments

Comments
 (0)