diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2009-04-29 04:25:57 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-04-29 20:32:40 -0400 |
commit | 894b19a6b343ce3589237167a56e6df0fe72ef0d (patch) | |
tree | 0713a034ac095488151bcd94f3510c50d660cc11 | |
parent | 0c09c1a49cc7b819b33566a49d9901f7cfdd6889 (diff) |
ethtool/mdio: Support backplane mode negotiation
Compile-tested only.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/mdio.c | 30 | ||||
-rw-r--r-- | include/linux/ethtool.h | 10 | ||||
-rw-r--r-- | include/linux/mdio.h | 5 |
3 files changed, 40 insertions, 5 deletions
diff --git a/drivers/net/mdio.c b/drivers/net/mdio.c index ee383c256931..66483035f683 100644 --- a/drivers/net/mdio.c +++ b/drivers/net/mdio.c | |||
@@ -202,12 +202,29 @@ void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio, | |||
202 | break; | 202 | break; |
203 | 203 | ||
204 | case MDIO_PMA_CTRL2_10GBCX4: | 204 | case MDIO_PMA_CTRL2_10GBCX4: |
205 | ecmd->port = PORT_OTHER; | ||
206 | ecmd->supported = 0; | ||
207 | ecmd->advertising = 0; | ||
208 | break; | ||
209 | |||
205 | case MDIO_PMA_CTRL2_10GBKX4: | 210 | case MDIO_PMA_CTRL2_10GBKX4: |
206 | case MDIO_PMA_CTRL2_10GBKR: | 211 | case MDIO_PMA_CTRL2_10GBKR: |
207 | case MDIO_PMA_CTRL2_1000BKX: | 212 | case MDIO_PMA_CTRL2_1000BKX: |
208 | ecmd->port = PORT_OTHER; | 213 | ecmd->port = PORT_OTHER; |
209 | ecmd->supported = 0; | 214 | ecmd->supported = SUPPORTED_Backplane; |
210 | ecmd->advertising = 0; | 215 | reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, |
216 | MDIO_PMA_EXTABLE); | ||
217 | if (reg & MDIO_PMA_EXTABLE_10GBKX4) | ||
218 | ecmd->supported |= SUPPORTED_10000baseKX4_Full; | ||
219 | if (reg & MDIO_PMA_EXTABLE_10GBKR) | ||
220 | ecmd->supported |= SUPPORTED_10000baseKR_Full; | ||
221 | if (reg & MDIO_PMA_EXTABLE_1000BKX) | ||
222 | ecmd->supported |= SUPPORTED_1000baseKX_Full; | ||
223 | reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, | ||
224 | MDIO_PMA_10GBR_FECABLE); | ||
225 | if (reg & MDIO_PMA_10GBR_FECABLE_ABLE) | ||
226 | ecmd->supported |= SUPPORTED_10000baseR_FEC; | ||
227 | ecmd->advertising = ADVERTISED_Backplane; | ||
211 | break; | 228 | break; |
212 | 229 | ||
213 | /* All the other defined modes are flavours of optical */ | 230 | /* All the other defined modes are flavours of optical */ |
@@ -252,13 +269,16 @@ void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio, | |||
252 | if ((modes & ~ADVERTISED_Autoneg) == 0) | 269 | if ((modes & ~ADVERTISED_Autoneg) == 0) |
253 | modes = ecmd->advertising; | 270 | modes = ecmd->advertising; |
254 | 271 | ||
255 | if (modes & ADVERTISED_10000baseT_Full) { | 272 | if (modes & (ADVERTISED_10000baseT_Full | |
273 | ADVERTISED_10000baseKX4_Full | | ||
274 | ADVERTISED_10000baseKR_Full)) { | ||
256 | ecmd->speed = SPEED_10000; | 275 | ecmd->speed = SPEED_10000; |
257 | ecmd->duplex = DUPLEX_FULL; | 276 | ecmd->duplex = DUPLEX_FULL; |
258 | } else if (modes & (ADVERTISED_1000baseT_Full | | 277 | } else if (modes & (ADVERTISED_1000baseT_Full | |
259 | ADVERTISED_1000baseT_Half)) { | 278 | ADVERTISED_1000baseT_Half | |
279 | ADVERTISED_1000baseKX_Full)) { | ||
260 | ecmd->speed = SPEED_1000; | 280 | ecmd->speed = SPEED_1000; |
261 | ecmd->duplex = !!(modes & ADVERTISED_1000baseT_Full); | 281 | ecmd->duplex = !(modes & ADVERTISED_1000baseT_Half); |
262 | } else if (modes & (ADVERTISED_100baseT_Full | | 282 | } else if (modes & (ADVERTISED_100baseT_Full | |
263 | ADVERTISED_100baseT_Half)) { | 283 | ADVERTISED_100baseT_Half)) { |
264 | ecmd->speed = SPEED_100; | 284 | ecmd->speed = SPEED_100; |
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h index 14e6bc860112..380b04272bf1 100644 --- a/include/linux/ethtool.h +++ b/include/linux/ethtool.h | |||
@@ -565,6 +565,11 @@ struct ethtool_ops { | |||
565 | #define SUPPORTED_Pause (1 << 13) | 565 | #define SUPPORTED_Pause (1 << 13) |
566 | #define SUPPORTED_Asym_Pause (1 << 14) | 566 | #define SUPPORTED_Asym_Pause (1 << 14) |
567 | #define SUPPORTED_2500baseX_Full (1 << 15) | 567 | #define SUPPORTED_2500baseX_Full (1 << 15) |
568 | #define SUPPORTED_Backplane (1 << 16) | ||
569 | #define SUPPORTED_1000baseKX_Full (1 << 17) | ||
570 | #define SUPPORTED_10000baseKX4_Full (1 << 18) | ||
571 | #define SUPPORTED_10000baseKR_Full (1 << 19) | ||
572 | #define SUPPORTED_10000baseR_FEC (1 << 20) | ||
568 | 573 | ||
569 | /* Indicates what features are advertised by the interface. */ | 574 | /* Indicates what features are advertised by the interface. */ |
570 | #define ADVERTISED_10baseT_Half (1 << 0) | 575 | #define ADVERTISED_10baseT_Half (1 << 0) |
@@ -583,6 +588,11 @@ struct ethtool_ops { | |||
583 | #define ADVERTISED_Pause (1 << 13) | 588 | #define ADVERTISED_Pause (1 << 13) |
584 | #define ADVERTISED_Asym_Pause (1 << 14) | 589 | #define ADVERTISED_Asym_Pause (1 << 14) |
585 | #define ADVERTISED_2500baseX_Full (1 << 15) | 590 | #define ADVERTISED_2500baseX_Full (1 << 15) |
591 | #define ADVERTISED_Backplane (1 << 16) | ||
592 | #define ADVERTISED_1000baseKX_Full (1 << 17) | ||
593 | #define ADVERTISED_10000baseKX4_Full (1 << 18) | ||
594 | #define ADVERTISED_10000baseKR_Full (1 << 19) | ||
595 | #define ADVERTISED_10000baseR_FEC (1 << 20) | ||
586 | 596 | ||
587 | /* The following are all involved in forcing a particular link | 597 | /* The following are all involved in forcing a particular link |
588 | * mode for the device for setting things. When getting the | 598 | * mode for the device for setting things. When getting the |
diff --git a/include/linux/mdio.h b/include/linux/mdio.h index 1bff2f2d0e19..26b4eb3bbee9 100644 --- a/include/linux/mdio.h +++ b/include/linux/mdio.h | |||
@@ -46,6 +46,7 @@ | |||
46 | 46 | ||
47 | /* Media-dependent registers. */ | 47 | /* Media-dependent registers. */ |
48 | #define MDIO_PMA_10GBT_TXPWR 131 /* 10GBASE-T TX power control */ | 48 | #define MDIO_PMA_10GBT_TXPWR 131 /* 10GBASE-T TX power control */ |
49 | #define MDIO_PMA_10GBR_FECABLE 170 /* 10GBASE-R FEC ability */ | ||
49 | #define MDIO_PCS_10GBX_STAT1 24 /* 10GBASE-X PCS status 1 */ | 50 | #define MDIO_PCS_10GBX_STAT1 24 /* 10GBASE-X PCS status 1 */ |
50 | #define MDIO_PCS_10GBRT_STAT1 32 /* 10GBASE-R/-T PCS status 1 */ | 51 | #define MDIO_PCS_10GBRT_STAT1 32 /* 10GBASE-R/-T PCS status 1 */ |
51 | #define MDIO_PCS_10GBRT_STAT2 33 /* 10GBASE-R/-T PCS status 2 */ | 52 | #define MDIO_PCS_10GBRT_STAT2 33 /* 10GBASE-R/-T PCS status 2 */ |
@@ -187,6 +188,10 @@ | |||
187 | /* PMA 10GBASE-T TX power register. */ | 188 | /* PMA 10GBASE-T TX power register. */ |
188 | #define MDIO_PMA_10GBT_TXPWR_SHORT 0x0001 /* Short-reach mode */ | 189 | #define MDIO_PMA_10GBT_TXPWR_SHORT 0x0001 /* Short-reach mode */ |
189 | 190 | ||
191 | /* PMA 10GBASE-R FEC ability register. */ | ||
192 | #define MDIO_PMA_10GBR_FECABLE_ABLE 0x0001 /* FEC ability */ | ||
193 | #define MDIO_PMA_10GBR_FECABLE_ERRABLE 0x0002 /* FEC error indic. ability */ | ||
194 | |||
190 | /* PCS 10GBASE-R/-T status register 1. */ | 195 | /* PCS 10GBASE-R/-T status register 1. */ |
191 | #define MDIO_PCS_10GBRT_STAT1_BLKLK 0x0001 /* Block lock attained */ | 196 | #define MDIO_PCS_10GBRT_STAT1_BLKLK 0x0001 /* Block lock attained */ |
192 | 197 | ||