Skip to content

Commit 72c9243

Browse files
Ansuelfrank-w
authored andcommitted
net: phy: as21xxx: handle corner case with link and autoneg complete
Add missing case in custom read_link, when autoneg is started, autoneg complete bit is reset but link is still not up. Fixes: 830877d ("net: phy: Add support for Aeonsemi AS21xxx PHYs") Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
1 parent 13f6dff commit 72c9243

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

drivers/net/phy/as21xxx.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,13 @@ static int as21xxx_read_link(struct phy_device *phydev, int *bmcr)
658658
return status;
659659

660660
phydev->link = !!(status & MDIO_STAT1_LSTATUS);
661+
phydev->autoneg_complete = !!(status & MDIO_AN_STAT1_COMPLETE);
662+
663+
/* Consider the case that autoneg was started and "aneg complete"
664+
* bit has been reset, but "link up" bit not yet.
665+
*/
666+
if (phydev->autoneg == AUTONEG_ENABLE && !phydev->autoneg_complete)
667+
phydev->link = 0;
661668

662669
return 0;
663670
}

0 commit comments

Comments
 (0)