diff options
author | Shan Lu <shanlu@cs.uiuc.edu> | 2007-03-06 05:42:03 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-04-28 11:00:57 -0400 |
commit | 024a0a3cfb4c98cb3c6c81ec70672c6a925cf164 (patch) | |
tree | 1ae2ab2e5f558bf3a8844a1b28d6ecbc3796b35e /drivers/net/phy | |
parent | 2b272221ad3d5c686f1d5ffb3b3c8a45120ad765 (diff) |
network: add the missing phy_device speed information to phy_mii_ioctl
Function `phy_mii_ioctl' returns physical device's information based on
user requests. When requested to return the basic mode control register
information (BMCR), the original implementation only returns the physical
device's duplex information and forgets to return speed information, which
should not be because BMCR register is used to hold both duplex and speed
information.
The patch checks the BMCR value against speed-related flags and fills the
return structure's speed field accordingly.
Signed-off-by: Shan <shanlu@cs.uiuc.edu>
Cc: Jeff Garzik <jeff@garzik.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/phy')
-rw-r--r-- | drivers/net/phy/phy.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index a602d06d85ab..eed433d6056a 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c | |||
@@ -382,6 +382,12 @@ int phy_mii_ioctl(struct phy_device *phydev, | |||
382 | phydev->duplex = DUPLEX_FULL; | 382 | phydev->duplex = DUPLEX_FULL; |
383 | else | 383 | else |
384 | phydev->duplex = DUPLEX_HALF; | 384 | phydev->duplex = DUPLEX_HALF; |
385 | if ((!phydev->autoneg) && | ||
386 | (val & BMCR_SPEED1000)) | ||
387 | phydev->speed = SPEED_1000; | ||
388 | else if ((!phydev->autoneg) && | ||
389 | (val & BMCR_SPEED100)) | ||
390 | phydev->speed = SPEED_100; | ||
385 | break; | 391 | break; |
386 | case MII_ADVERTISE: | 392 | case MII_ADVERTISE: |
387 | phydev->advertising = val; | 393 | phydev->advertising = val; |