diff mbox series

[U-Boot,v2,08/11] drivers: net: aquantia: use SI and LI status in loop waiting for link up

Message ID 20190812131521.28556-9-alexandru.marginean@nxp.com
State Superseded
Delegated to: Joe Hershberger
Headers show
Series Aquantia PHY driver updates to reduce FW dependency | expand

Commit Message

Alexandru Marginean Aug. 12, 2019, 1:15 p.m. UTC
In some cases the link on the system interface of the aquantia PHY comes up
after the link on line interface.  The link state loop only checks the line
side, which may result in first packet sent being lost.
Use aquantia_link_is_up instead, which checks both system and line side on
gen 2/3 PHYs to avoid losing the 1st packet.

Signed-off-by: Alex Marginean <alexm.osslist@gmail.com>
---
 drivers/net/phy/aquantia.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/phy/aquantia.c b/drivers/net/phy/aquantia.c
index 8a3df692d1..855a100656 100644
--- a/drivers/net/phy/aquantia.c
+++ b/drivers/net/phy/aquantia.c
@@ -543,17 +543,14 @@  int aquantia_startup(struct phy_device *phydev)
 	phydev->duplex = DUPLEX_FULL;
 
 	/* if the AN is still in progress, wait till timeout. */
-	phy_read(phydev, MDIO_MMD_AN, MDIO_STAT1);
-	reg = phy_read(phydev, MDIO_MMD_AN, MDIO_STAT1);
-	if (!(reg & MDIO_AN_STAT1_COMPLETE)) {
+	if (!aquantia_link_is_up(phydev)) {
 		printf("%s Waiting for PHY auto negotiation to complete",
 		       phydev->dev->name);
 		do {
 			udelay(1000);
-			reg = phy_read(phydev, MDIO_MMD_AN, MDIO_STAT1);
 			if ((i++ % 500) == 0)
 				printf(".");
-		} while (!(reg & MDIO_AN_STAT1_COMPLETE) &&
+		} while (!aquantia_link_is_up(phydev) &&
 			 i < (4 * PHY_ANEG_TIMEOUT));
 
 		if (i > PHY_ANEG_TIMEOUT)