mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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 <[email protected]> Signed-off-by: Grant Grundler <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
parent
3486140e30
commit
a77929a278
1 changed files with 10 additions and 2 deletions
|
|
@ -652,9 +652,17 @@ static u32 asix_get_phyid(struct usbnet *dev)
|
|||
{
|
||||
int phy_reg;
|
||||
u32 phy_id;
|
||||
int i;
|
||||
|
||||
phy_reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_PHYSID1);
|
||||
if (phy_reg < 0)
|
||||
/* Poll for the rare case the FW or phy isn't ready yet. */
|
||||
for (i = 0; i < 100; i++) {
|
||||
phy_reg = asix_mdio_read(dev->net, dev->mii.phy_id, MII_PHYSID1);
|
||||
if (phy_reg != 0 && phy_reg != 0xFFFF)
|
||||
break;
|
||||
mdelay(1);
|
||||
}
|
||||
|
||||
if (phy_reg <= 0 || phy_reg == 0xFFFF)
|
||||
return 0;
|
||||
|
||||
phy_id = (phy_reg & 0xffff) << 16;
|
||||
|
|
|
|||
Loading…
Reference in a new issue