diff options
Diffstat (limited to 'drivers/net/usb')
-rw-r--r-- | drivers/net/usb/smsc95xx.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c index df9179a1c93b..d222d7e25273 100644 --- a/drivers/net/usb/smsc95xx.c +++ b/drivers/net/usb/smsc95xx.c | |||
@@ -709,6 +709,8 @@ static void smsc95xx_start_rx_path(struct usbnet *dev) | |||
709 | 709 | ||
710 | static int smsc95xx_phy_initialize(struct usbnet *dev) | 710 | static int smsc95xx_phy_initialize(struct usbnet *dev) |
711 | { | 711 | { |
712 | int bmcr, timeout = 0; | ||
713 | |||
712 | /* Initialize MII structure */ | 714 | /* Initialize MII structure */ |
713 | dev->mii.dev = dev->net; | 715 | dev->mii.dev = dev->net; |
714 | dev->mii.mdio_read = smsc95xx_mdio_read; | 716 | dev->mii.mdio_read = smsc95xx_mdio_read; |
@@ -717,7 +719,20 @@ static int smsc95xx_phy_initialize(struct usbnet *dev) | |||
717 | dev->mii.reg_num_mask = 0x1f; | 719 | dev->mii.reg_num_mask = 0x1f; |
718 | dev->mii.phy_id = SMSC95XX_INTERNAL_PHY_ID; | 720 | dev->mii.phy_id = SMSC95XX_INTERNAL_PHY_ID; |
719 | 721 | ||
722 | /* reset phy and wait for reset to complete */ | ||
720 | smsc95xx_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET); | 723 | smsc95xx_mdio_write(dev->net, dev->mii.phy_id, MII_BMCR, BMCR_RESET); |
724 | |||
725 | do { | ||
726 | msleep(10); | ||
727 | bmcr = smsc95xx_mdio_read(dev->net, dev->mii.phy_id, MII_BMCR); | ||
728 | timeout++; | ||
729 | } while ((bmcr & MII_BMCR) && (timeout < 100)); | ||
730 | |||
731 | if (timeout >= 100) { | ||
732 | netdev_warn(dev->net, "timeout on PHY Reset"); | ||
733 | return -EIO; | ||
734 | } | ||
735 | |||
721 | smsc95xx_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE, | 736 | smsc95xx_mdio_write(dev->net, dev->mii.phy_id, MII_ADVERTISE, |
722 | ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP | | 737 | ADVERTISE_ALL | ADVERTISE_CSMA | ADVERTISE_PAUSE_CAP | |
723 | ADVERTISE_PAUSE_ASYM); | 738 | ADVERTISE_PAUSE_ASYM); |