]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
net: phy: use c45 standard to detect link partner autoneg capability
authorHeiner Kallweit <hkallweit1@gmail.com>
Sun, 31 Mar 2019 17:52:51 +0000 (19:52 +0200)
committerDavid S. Miller <davem@davemloft.net>
Tue, 2 Apr 2019 20:16:17 +0000 (13:16 -0700)
Currently mii_lpa_mod_linkmode_lpa_t() checks bit LPA_LPACK to detect
whether link partner supports autoneg. This doesn't work correctly at
least on Aquantia AQCS109 when it negotiates 1000Base-T2 mode.
The "link partner is autoneg-capable" bit as defined by clause 45 is
set however. Better let's switch in general to use the clause 45
standard for link partner autoneg detection.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy-c45.c

index 9e24d95694242aa88c5940b891da1c01a75a3198..666fbb0eec040d27ee0bcc38339bcd4bc76f05e7 100644 (file)
@@ -262,12 +262,19 @@ 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;
+
+       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;