aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/mdio.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-04-29 08:21:53 +0000
committerDavid S. Miller <davem@davemloft.net>2009-04-29 17:32:37 -0700
commit0c09c1a49cc7b819b33566a49d9901f7cfdd6889 (patch)
treee10fc988a21ca0b3e1550ae905b96cc444f90a76 /drivers/net/mdio.c
parent3f926da82f128c68c479247b1771729b9487502a (diff)
ethtool/mdio: Report MDIO mode support and link partner advertising
Add mdio_support and lp_advertising fields to ethtool_cmd. Set these in mdio45_ethtool_gset{,_npage}(). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/mdio.c')
-rw-r--r--drivers/net/mdio.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/net/mdio.c b/drivers/net/mdio.c
index 2fb0d16b61f..ee383c25693 100644
--- a/drivers/net/mdio.c
+++ b/drivers/net/mdio.c
@@ -173,6 +173,8 @@ void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio,
ecmd->transceiver = XCVR_INTERNAL;
ecmd->phy_address = mdio->prtad;
+ ecmd->mdio_support =
+ mdio->mode_support & (MDIO_SUPPORTS_C45 | MDIO_SUPPORTS_C22);
reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD,
MDIO_CTRL2);
@@ -235,16 +237,19 @@ void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio,
if (ecmd->autoneg) {
u32 modes = 0;
+ int an_stat = mdio->mdio_read(mdio->dev, mdio->prtad,
+ MDIO_MMD_AN, MDIO_STAT1);
/* If AN is complete and successful, report best common
* mode, otherwise report best advertised mode. */
- if (mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_AN,
- MDIO_STAT1) &
- MDIO_AN_STAT1_COMPLETE)
- modes = (ecmd->advertising &
- (mdio45_get_an(mdio, MDIO_AN_LPA) |
- npage_lpa));
- if (modes == 0)
+ if (an_stat & MDIO_AN_STAT1_COMPLETE) {
+ ecmd->lp_advertising =
+ mdio45_get_an(mdio, MDIO_AN_LPA) | npage_lpa;
+ if (an_stat & MDIO_AN_STAT1_LPABLE)
+ ecmd->lp_advertising |= ADVERTISED_Autoneg;
+ modes = ecmd->advertising & ecmd->lp_advertising;
+ }
+ if ((modes & ~ADVERTISED_Autoneg) == 0)
modes = ecmd->advertising;
if (modes & ADVERTISED_10000baseT_Full) {