diff options
author | Florian Fainelli <f.fainelli@gmail.com> | 2013-12-06 16:01:30 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-12-09 20:38:58 -0500 |
commit | 114002bc1af6c63de4c003f8c5d3ca0bb430d987 (patch) | |
tree | 1bd189225054a8313dac7025d41c194887f72248 /drivers/net/phy | |
parent | 73713357ab58aacda1af715bb5a623528dbbfd79 (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')
-rw-r--r-- | drivers/net/phy/phy.c | 1 | ||||
-rw-r--r-- | drivers/net/phy/phy_device.c | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 36c6994436b7..05cb8fe742f9 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -289,6 +289,7 @@ int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd) | |||
289 | cmd->supported = phydev->supported; | 289 | cmd->supported = phydev->supported; |
290 | 290 | ||
291 | cmd->advertising = phydev->advertising; | 291 | cmd->advertising = phydev->advertising; |
292 | cmd->lp_advertising = phydev->lp_advertising; | ||
292 | 293 | ||
293 | ethtool_cmd_speed_set(cmd, phydev->speed); | 294 | ethtool_cmd_speed_set(cmd, phydev->speed); |
294 | cmd->duplex = phydev->duplex; | 295 | cmd->duplex = phydev->duplex; |
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) | |||
839 | if (err) | 839 | if (err) |
840 | return err; | 840 | return err; |
841 | 841 | ||
842 | phydev->lp_advertising = 0; | ||
843 | |||
842 | if (AUTONEG_ENABLE == phydev->autoneg) { | 844 | if (AUTONEG_ENABLE == phydev->autoneg) { |
843 | if (phydev->supported & (SUPPORTED_1000baseT_Half | 845 | if (phydev->supported & (SUPPORTED_1000baseT_Half |
844 | | SUPPORTED_1000baseT_Full)) { | 846 | | SUPPORTED_1000baseT_Full)) { |
@@ -852,6 +854,8 @@ int genphy_read_status(struct phy_device *phydev) | |||
852 | if (adv < 0) | 854 | if (adv < 0) |
853 | return adv; | 855 | return adv; |
854 | 856 | ||
857 | phydev->lp_advertising = | ||
858 | mii_stat1000_to_ethtool_lpa_t(lpagb); | ||
855 | lpagb &= adv << 2; | 859 | lpagb &= adv << 2; |
856 | } | 860 | } |
857 | 861 | ||
@@ -860,6 +864,8 @@ int genphy_read_status(struct phy_device *phydev) | |||
860 | if (lpa < 0) | 864 | if (lpa < 0) |
861 | return lpa; | 865 | return lpa; |
862 | 866 | ||
867 | phydev->lp_advertising |= mii_lpa_to_ethtool_lpa_t(lpa); | ||
868 | |||
863 | adv = phy_read(phydev, MII_ADVERTISE); | 869 | adv = phy_read(phydev, MII_ADVERTISE); |
864 | 870 | ||
865 | if (adv < 0) | 871 | if (adv < 0) |