[PATCH v1 5/5] net: phy: marvell: Fix 2210 link and speed detection resolution

Stefan Roese sr at denx.de
Wed Mar 24 10:20:08 CET 2021


From: Stefan Chulski <stefanc at marvell.com>

Patch fix couple of link and speed detection resolution bugs:
1. Waiting for PHY real time link condition.
2. Replace PHYSTAT_SPDDONE with PHYSTAT_LINK in while loop,
   PHYSTAT_SPDDONE could be enabled before link status changed to
   enable.
3. Update link status after link resolution loop.

Signed-off-by: Stefan Chulski <stefanc at marvell.com>
Tested-by: sa_ip-sw-jenkins <sa_ip-sw-jenkins at marvell.com>
Reviewed-by: Kostya Porotchkin <kostap at marvell.com>
Reviewed-by: Yan Markman <ymarkman at marvell.com>
Reviewed-by: Marcin Wojtas <marcin at marvell.com>
Signed-off-by: Stefan Roese <sr at denx.de>
---

 drivers/net/phy/marvell.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c
index 36e678755ae8..3bcb0033b391 100644
--- a/drivers/net/phy/marvell.c
+++ b/drivers/net/phy/marvell.c
@@ -659,12 +659,11 @@ static uint m88e2110_parse_status(struct phy_device *phydev)
 
 	mii_reg = phy_read(phydev, 3, MIIM_88E2110_PHY_STATUS);
 
-	if ((mii_reg & MIIM_88E2110_PHYSTAT_LINK) &&
-	    !(mii_reg & MIIM_88E2110_PHYSTAT_SPDDONE)) {
+	if (!(mii_reg & MIIM_88E2110_PHYSTAT_LINK)) {
 		int i = 0;
 
 		puts("Waiting for PHY realtime link");
-		while (!(mii_reg & MIIM_88E2110_PHYSTAT_SPDDONE)) {
+		while (!(mii_reg & MIIM_88E2110_PHYSTAT_LINK)) {
 			/* Timeout reached ? */
 			if (i > PHY_AUTONEGOTIATE_TIMEOUT) {
 				puts(" TIMEOUT !\n");
@@ -679,13 +678,13 @@ static uint m88e2110_parse_status(struct phy_device *phydev)
 		}
 		puts(" done\n");
 		mdelay(500);	/* another 500 ms (results in faster booting) */
-	} else {
-		if (mii_reg & MIIM_88E2110_PHYSTAT_LINK)
-			phydev->link = 1;
-		else
-			phydev->link = 0;
 	}
 
+	if (mii_reg & MIIM_88E2110_PHYSTAT_LINK)
+		phydev->link = 1;
+	else
+		phydev->link = 0;
+
 	if (mii_reg & MIIM_88E2110_PHYSTAT_DUPLEX)
 		phydev->duplex = DUPLEX_FULL;
 	else
-- 
2.31.0



More information about the U-Boot mailing list