[PATCH] net: phy: wait for link OK after successfull autonegotiation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



It may take some time for PHY to indicate link OK status after
autonegotiation completed. This change addresses this case
and prevent network commands fails due to the delay.

Signed-off-by: Anton Bondarenko <anton.bondarenko.sama@xxxxxxxxx>
---
 drivers/net/phy/phy.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 2b3c5e2..73569f3 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -502,13 +502,17 @@ int phy_wait_aneg_done(struct phy_device *phydev)
 		return 0;
 
 	while (!is_timeout(start, PHY_AN_TIMEOUT * SECOND)) {
-		if (phy_aneg_done(phydev) > 0) {
-			phydev->link = 1;
+		if (phy_aneg_done(phydev) > 0)
+			break;
+	}
+
+	genphy_update_link(phydev);
+	while (!is_timeout(start, PHY_AN_TIMEOUT * SECOND)) {
+		if (phydev->link == 1)
 			return 0;
-		}
+		genphy_update_link(phydev);
 	}
 
-	phydev->link = 0;
 	return -ETIMEDOUT;
 }
 
-- 
2.6.2


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux