diff options
author | Grant Grundler <grundler@google.com> | 2011-11-15 02:12:40 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-11-15 16:26:06 -0500 |
commit | a77929a278651d4451c872178d4d7aac8908aa8e (patch) | |
tree | e80174550dcea0e16d6555cbd8c9097dfc15d6f2 /drivers/net/usb/asix.c | |
parent | 3486140e30fcc16c0b8cd9545fbe5e2e66bf6941 (diff) |
net-next:asix:poll in asix_get_phyid in case phy not ready
Sometimes the phy isn't ready after reset...poll and pray it will be soon.
Signed-off-by: Freddy Xin <freddy@asix.com.tw>
Signed-off-by: Grant Grundler <grundler@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/usb/asix.c')
-rw-r--r-- | drivers/net/usb/asix.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c index 873860d46e9e..b4675e89e42c 100644 --- a/drivers/net/usb/asix.c +++ b/drivers/net/usb/asix.c | |||
@@ -652,9 +652,17 @@ static u32 asix_get_phyid(struct usbnet *dev) | |||
652 | { | 652 | { |
653 | int phy_reg; | 653 | int phy_reg; |
654 | u32 phy_id; | 654 | u32 phy_id; |
655 | int i; | ||
655 | 656 | ||
656 | phy_reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_PHYSID1); | 657 | /* Poll for the rare case the FW or phy isn't ready yet. */ |
657 | if (phy_reg < 0) | 658 | for (i = 0; i < 100; i++) { |
659 | phy_reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_PHYSID1); | ||
660 | if (phy_reg != 0 && phy_reg != 0xFFFF) | ||
661 | break; | ||
662 | mdelay(1); | ||
663 | } | ||
664 | |||
665 | if (phy_reg <= 0 || phy_reg == 0xFFFF) | ||
658 | return 0; | 666 | return 0; |
659 | 667 | ||
660 | phy_id = (phy_reg & 0xffff) << 16; | 668 | phy_id = (phy_reg & 0xffff) << 16; |