diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2009-06-10 01:28:04 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-06-11 05:47:10 -0400 |
commit | d005ba6cc82440d9ebf96f3ec8f79c54578b898f (patch) | |
tree | 871a9a75e1fcb6dbf9c8f3aa6944fe6a7baf2068 | |
parent | b8facca01ba381c3f8ff2391fbe3860ebc6a6bdc (diff) |
mdio: Expose 10GBASE-T MDI-X status via ethtool
This is available in a standard MDIO register in 10GBASE-T PHYs.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/mdio.c | 17 | ||||
-rw-r--r-- | include/linux/mdio.h | 9 |
2 files changed, 26 insertions, 0 deletions
diff --git a/drivers/net/mdio.c b/drivers/net/mdio.c index 66483035f683..dc45e9856c35 100644 --- a/drivers/net/mdio.c +++ b/drivers/net/mdio.c | |||
@@ -296,6 +296,23 @@ void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio, | |||
296 | ecmd->duplex = (reg & MDIO_CTRL1_FULLDPLX || | 296 | ecmd->duplex = (reg & MDIO_CTRL1_FULLDPLX || |
297 | ecmd->speed == SPEED_10000); | 297 | ecmd->speed == SPEED_10000); |
298 | } | 298 | } |
299 | |||
300 | /* 10GBASE-T MDI/MDI-X */ | ||
301 | if (ecmd->port == PORT_TP && ecmd->speed == SPEED_10000) { | ||
302 | switch (mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, | ||
303 | MDIO_PMA_10GBT_SWAPPOL)) { | ||
304 | case MDIO_PMA_10GBT_SWAPPOL_ABNX | MDIO_PMA_10GBT_SWAPPOL_CDNX: | ||
305 | ecmd->eth_tp_mdix = ETH_TP_MDI; | ||
306 | break; | ||
307 | case 0: | ||
308 | ecmd->eth_tp_mdix = ETH_TP_MDI_X; | ||
309 | break; | ||
310 | default: | ||
311 | /* It's complicated... */ | ||
312 | ecmd->eth_tp_mdix = ETH_TP_MDI_INVALID; | ||
313 | break; | ||
314 | } | ||
315 | } | ||
299 | } | 316 | } |
300 | EXPORT_SYMBOL(mdio45_ethtool_gset_npage); | 317 | EXPORT_SYMBOL(mdio45_ethtool_gset_npage); |
301 | 318 | ||
diff --git a/include/linux/mdio.h b/include/linux/mdio.h index 56851646529a..cfdf1df2875e 100644 --- a/include/linux/mdio.h +++ b/include/linux/mdio.h | |||
@@ -45,6 +45,7 @@ | |||
45 | #define MDIO_PHYXS_LNSTAT 24 /* PHY XGXS lane state */ | 45 | #define MDIO_PHYXS_LNSTAT 24 /* PHY XGXS lane state */ |
46 | 46 | ||
47 | /* Media-dependent registers. */ | 47 | /* Media-dependent registers. */ |
48 | #define MDIO_PMA_10GBT_SWAPPOL 130 /* 10GBASE-T pair swap & polarity */ | ||
48 | #define MDIO_PMA_10GBT_TXPWR 131 /* 10GBASE-T TX power control */ | 49 | #define MDIO_PMA_10GBT_TXPWR 131 /* 10GBASE-T TX power control */ |
49 | #define MDIO_PMA_10GBT_SNR 133 /* 10GBASE-T SNR margin, lane A. | 50 | #define MDIO_PMA_10GBT_SNR 133 /* 10GBASE-T SNR margin, lane A. |
50 | * Lanes B-D are numbered 134-136. */ | 51 | * Lanes B-D are numbered 134-136. */ |
@@ -195,6 +196,14 @@ | |||
195 | #define MDIO_PHYXS_LNSTAT_SYNC3 0x0008 | 196 | #define MDIO_PHYXS_LNSTAT_SYNC3 0x0008 |
196 | #define MDIO_PHYXS_LNSTAT_ALIGN 0x1000 | 197 | #define MDIO_PHYXS_LNSTAT_ALIGN 0x1000 |
197 | 198 | ||
199 | /* PMA 10GBASE-T pair swap & polarity */ | ||
200 | #define MDIO_PMA_10GBT_SWAPPOL_ABNX 0x0001 /* Pair A/B uncrossed */ | ||
201 | #define MDIO_PMA_10GBT_SWAPPOL_CDNX 0x0002 /* Pair C/D uncrossed */ | ||
202 | #define MDIO_PMA_10GBT_SWAPPOL_AREV 0x0100 /* Pair A polarity reversed */ | ||
203 | #define MDIO_PMA_10GBT_SWAPPOL_BREV 0x0200 /* Pair B polarity reversed */ | ||
204 | #define MDIO_PMA_10GBT_SWAPPOL_CREV 0x0400 /* Pair C polarity reversed */ | ||
205 | #define MDIO_PMA_10GBT_SWAPPOL_DREV 0x0800 /* Pair D polarity reversed */ | ||
206 | |||
198 | /* PMA 10GBASE-T TX power register. */ | 207 | /* PMA 10GBASE-T TX power register. */ |
199 | #define MDIO_PMA_10GBT_TXPWR_SHORT 0x0001 /* Short-reach mode */ | 208 | #define MDIO_PMA_10GBT_TXPWR_SHORT 0x0001 /* Short-reach mode */ |
200 | 209 | ||