Skip to content

Commit f6715a7

Browse files
duynguyenxakartben
authored andcommitted
drivers: eth: phy_mii: Add BMSR second read in update_link state
The ICS1894 phy AN_COMPLETE bit is latched high, this make the BMSR first read return incorrect status of the AN state, update one more BMSR read to ensure all latched bit is clear and BMSR return actual status of the phy chip Signed-off-by: Duy Nguyen <[email protected]>
1 parent f970596 commit f6715a7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

drivers/ethernet/phy/phy_mii.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,14 @@ static int update_link_state(const struct device *dev)
205205

206206
k_sleep(K_MSEC(100));
207207

208+
/* On some PHY chips, the BMSR bits are latched, so the first read may
209+
* show incorrect status. A second read ensures correct values.
210+
*/
211+
if (phy_mii_reg_read(dev, MII_BMSR, &bmsr_reg) < 0) {
212+
return -EIO;
213+
}
214+
215+
/* Second read, clears the latched bits and gives the correct status */
208216
if (phy_mii_reg_read(dev, MII_BMSR, &bmsr_reg) < 0) {
209217
return -EIO;
210218
}

0 commit comments

Comments
 (0)