diff options
Diffstat (limited to 'drivers/net/mdio.c')
-rw-r--r-- | drivers/net/mdio.c | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/net/mdio.c b/drivers/net/mdio.c index f2d10abd0403..16fbb11d92ac 100644 --- a/drivers/net/mdio.c +++ b/drivers/net/mdio.c | |||
@@ -188,6 +188,7 @@ void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio, | |||
188 | u32 npage_adv, u32 npage_lpa) | 188 | u32 npage_adv, u32 npage_lpa) |
189 | { | 189 | { |
190 | int reg; | 190 | int reg; |
191 | u32 speed; | ||
191 | 192 | ||
192 | ecmd->transceiver = XCVR_INTERNAL; | 193 | ecmd->transceiver = XCVR_INTERNAL; |
193 | ecmd->phy_address = mdio->prtad; | 194 | ecmd->phy_address = mdio->prtad; |
@@ -290,33 +291,36 @@ void mdio45_ethtool_gset_npage(const struct mdio_if_info *mdio, | |||
290 | if (modes & (ADVERTISED_10000baseT_Full | | 291 | if (modes & (ADVERTISED_10000baseT_Full | |
291 | ADVERTISED_10000baseKX4_Full | | 292 | ADVERTISED_10000baseKX4_Full | |
292 | ADVERTISED_10000baseKR_Full)) { | 293 | ADVERTISED_10000baseKR_Full)) { |
293 | ecmd->speed = SPEED_10000; | 294 | speed = SPEED_10000; |
294 | ecmd->duplex = DUPLEX_FULL; | 295 | ecmd->duplex = DUPLEX_FULL; |
295 | } else if (modes & (ADVERTISED_1000baseT_Full | | 296 | } else if (modes & (ADVERTISED_1000baseT_Full | |
296 | ADVERTISED_1000baseT_Half | | 297 | ADVERTISED_1000baseT_Half | |
297 | ADVERTISED_1000baseKX_Full)) { | 298 | ADVERTISED_1000baseKX_Full)) { |
298 | ecmd->speed = SPEED_1000; | 299 | speed = SPEED_1000; |
299 | ecmd->duplex = !(modes & ADVERTISED_1000baseT_Half); | 300 | ecmd->duplex = !(modes & ADVERTISED_1000baseT_Half); |
300 | } else if (modes & (ADVERTISED_100baseT_Full | | 301 | } else if (modes & (ADVERTISED_100baseT_Full | |
301 | ADVERTISED_100baseT_Half)) { | 302 | ADVERTISED_100baseT_Half)) { |
302 | ecmd->speed = SPEED_100; | 303 | speed = SPEED_100; |
303 | ecmd->duplex = !!(modes & ADVERTISED_100baseT_Full); | 304 | ecmd->duplex = !!(modes & ADVERTISED_100baseT_Full); |
304 | } else { | 305 | } else { |
305 | ecmd->speed = SPEED_10; | 306 | speed = SPEED_10; |
306 | ecmd->duplex = !!(modes & ADVERTISED_10baseT_Full); | 307 | ecmd->duplex = !!(modes & ADVERTISED_10baseT_Full); |
307 | } | 308 | } |
308 | } else { | 309 | } else { |
309 | /* Report forced settings */ | 310 | /* Report forced settings */ |
310 | reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, | 311 | reg = mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, |
311 | MDIO_CTRL1); | 312 | MDIO_CTRL1); |
312 | ecmd->speed = (((reg & MDIO_PMA_CTRL1_SPEED1000) ? 100 : 1) * | 313 | speed = (((reg & MDIO_PMA_CTRL1_SPEED1000) ? 100 : 1) |
313 | ((reg & MDIO_PMA_CTRL1_SPEED100) ? 100 : 10)); | 314 | * ((reg & MDIO_PMA_CTRL1_SPEED100) ? 100 : 10)); |
314 | ecmd->duplex = (reg & MDIO_CTRL1_FULLDPLX || | 315 | ecmd->duplex = (reg & MDIO_CTRL1_FULLDPLX || |
315 | ecmd->speed == SPEED_10000); | 316 | speed == SPEED_10000); |
316 | } | 317 | } |
317 | 318 | ||
319 | ethtool_cmd_speed_set(ecmd, speed); | ||
320 | |||
318 | /* 10GBASE-T MDI/MDI-X */ | 321 | /* 10GBASE-T MDI/MDI-X */ |
319 | if (ecmd->port == PORT_TP && ecmd->speed == SPEED_10000) { | 322 | if (ecmd->port == PORT_TP |
323 | && (ethtool_cmd_speed(ecmd) == SPEED_10000)) { | ||
320 | switch (mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, | 324 | switch (mdio->mdio_read(mdio->dev, mdio->prtad, MDIO_MMD_PMAPMD, |
321 | MDIO_PMA_10GBT_SWAPPOL)) { | 325 | MDIO_PMA_10GBT_SWAPPOL)) { |
322 | case MDIO_PMA_10GBT_SWAPPOL_ABNX | MDIO_PMA_10GBT_SWAPPOL_CDNX: | 326 | case MDIO_PMA_10GBT_SWAPPOL_ABNX | MDIO_PMA_10GBT_SWAPPOL_CDNX: |