Skip to content

Commit 68d5cd0

Browse files
dangowrtPaolo Abeni
authored andcommitted
net: phy: realtek: change order of calls in C22 read_status()
Always call rtlgen_read_status() first, so genphy_read_status() which is called by it clears bits in case auto-negotiation has not completed. Also clear 10GBT link-partner advertisement bits in case auto-negotiation is disabled or has not completed. Suggested-by: Russell King (Oracle) <[email protected]> Signed-off-by: Daniel Golle <[email protected]> Link: https://patch.msgid.link/b15929a41621d215c6b2b57393368086589569ec.1728565530.git.daniel@makrotopia.org Signed-off-by: Paolo Abeni <[email protected]>
1 parent 081c9c0 commit 68d5cd0

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

drivers/net/phy/realtek.c

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -949,17 +949,25 @@ static void rtl822xb_update_interface(struct phy_device *phydev)
949949

950950
static int rtl822x_read_status(struct phy_device *phydev)
951951
{
952-
if (phydev->autoneg == AUTONEG_ENABLE) {
953-
int lpadv = phy_read_paged(phydev, 0xa5d, 0x13);
952+
int lpadv, ret;
954953

955-
if (lpadv < 0)
956-
return lpadv;
954+
ret = rtlgen_read_status(phydev);
955+
if (ret < 0)
956+
return ret;
957957

958-
mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising,
959-
lpadv);
958+
if (phydev->autoneg == AUTONEG_DISABLE ||
959+
!phydev->autoneg_complete) {
960+
mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0);
961+
return 0;
960962
}
961963

962-
return rtlgen_read_status(phydev);
964+
lpadv = phy_read_paged(phydev, 0xa5d, 0x13);
965+
if (lpadv < 0)
966+
return lpadv;
967+
968+
mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, lpadv);
969+
970+
return 0;
963971
}
964972

965973
static int rtl822xb_read_status(struct phy_device *phydev)

0 commit comments

Comments
 (0)