summaryrefslogtreecommitdiff
path: root/drivers/net/phy/phy_device.c
diff options
context:
space:
mode:
authorFlorian Fainelli <f.fainelli@gmail.com>2013-12-06 13:01:30 -0800
committerDavid S. Miller <davem@davemloft.net>2013-12-09 20:38:58 -0500
commit114002bc1af6c63de4c003f8c5d3ca0bb430d987 (patch)
tree1bd189225054a8313dac7025d41c194887f72248 /drivers/net/phy/phy_device.c
parent73713357ab58aacda1af715bb5a623528dbbfd79 (diff)
net: phy: report link partner features through ethtool
The PHY library already reads the MII_STAT1000 and MII_LPA registers in genphy_read_status(), so extend it to also populate the PHY device link partner advertised features such that we can feed this back into ethtool when asked for it in phy_ethtool_gset(). Signed-off-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/phy_device.c')
-rw-r--r--drivers/net/phy/phy_device.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index d6447b3f7409..6db36595eac9 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -839,6 +839,8 @@ int genphy_read_status(struct phy_device *phydev)
if (err)
return err;
+ phydev->lp_advertising = 0;
+
if (AUTONEG_ENABLE == phydev->autoneg) {
if (phydev->supported & (SUPPORTED_1000baseT_Half
| SUPPORTED_1000baseT_Full)) {
@@ -852,6 +854,8 @@ int genphy_read_status(struct phy_device *phydev)
if (adv < 0)
return adv;
+ phydev->lp_advertising =
+ mii_stat1000_to_ethtool_lpa_t(lpagb);
lpagb &= adv << 2;
}
@@ -860,6 +864,8 @@ int genphy_read_status(struct phy_device *phydev)
if (lpa < 0)
return lpa;
+ phydev->lp_advertising |= mii_lpa_to_ethtool_lpa_t(lpa);
+
adv = phy_read(phydev, MII_ADVERTISE);
if (adv < 0)