net: phy: let genphy_c45_read_abilities also check aneg capability
authorHeiner Kallweit <hkallweit1@gmail.com>
Fri, 22 Feb 2019 07:23:04 +0000 (08:23 +0100)
committerDavid S. Miller <davem@davemloft.net>
Sun, 24 Feb 2019 20:34:47 +0000 (12:34 -0800)
When using genphy_c45_read_abilities() as get_features callback we
also have to set the autoneg capability in phydev->supported.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy-c45.c

index c86bef005ef2657d7dc7b4fa0903b1988d728c7d..d79c27431aa5f334dc208c854450be33415f402d 100644 (file)
@@ -380,6 +380,17 @@ int genphy_c45_pma_read_abilities(struct phy_device *phydev)
 {
        int val;
 
+       linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->supported);
+       if (phydev->c45_ids.devices_in_package & MDIO_DEVS_AN) {
+               val = phy_read_mmd(phydev, MDIO_MMD_AN, MDIO_STAT1);
+               if (val < 0)
+                       return val;
+
+               if (val & MDIO_AN_STAT1_ABLE)
+                       linkmode_set_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
+                                        phydev->supported);
+       }
+
        val = phy_read_mmd(phydev, MDIO_MMD_PMAPMD, MDIO_STAT2);
        if (val < 0)
                return val;