Commit 40d0690b authored by David S. Miller's avatar David S. Miller

Merge branch 'net-phy-improve-genphy_c45_read_lpa'

Heiner Kallweit says:

====================
net: phy: improve genphy_c45_read_lpa

This series improves genphy_c45_read_lpa:
- Use clause 45 standard register / bit to detect link partner autoneg
  capability.
- Consider that lpa register values may be invalid if "autoneg complete"
  bit isn't set.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents fa288a42 372fcc1b
......@@ -262,12 +262,30 @@ int genphy_c45_read_lpa(struct phy_device *phydev)
{
int val;
val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_STAT1);
if (val < 0)
return val;
if (!(val & MDIO_AN_STAT1_COMPLETE)) {
linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
phydev->lp_advertising);
mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0);
mii_adv_mod_linkmode_adv_t(phydev->lp_advertising, 0);
phydev->pause = 0;
phydev->asym_pause = 0;
return 0;
}
linkmode_mod_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->lp_advertising,
val & MDIO_AN_STAT1_LPABLE);
/* Read the link partner's base page advertisement */
val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_AN_LPA);
if (val < 0)
return val;
mii_lpa_mod_linkmode_lpa_t(phydev->lp_advertising, val);
mii_adv_mod_linkmode_adv_t(phydev->lp_advertising, val);
phydev->pause = val & LPA_PAUSE_CAP ? 1 : 0;
phydev->asym_pause = val & LPA_PAUSE_ASYM ? 1 : 0;
......
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