From: Tim Harvey <tharvey@gateworks.com>
Date: Mon, 4 Feb 2019 20:56:52 +0000 (-0800)
Subject: net: mv88e61xx: fix autonegotiation on ports
X-Git-Tag: v2025.01-rc5-pxa1908~3121^2~36
X-Git-Url: http://git.dujemihanovic.xyz/img/static/%7B%7B%20%24.Site.BaseURL%20%7D%7Dposts/html/index.html?a=commitdiff_plain;h=69280961d72754f27b5196d392bd41b7f8fa2a42;p=u-boot.git

net: mv88e61xx: fix autonegotiation on ports

phy_reset should be called before autoneg is setup

The only boards using MV88E61XX_SWITCH are:
 - alliedtelesis/SBx81LIFKW
 - alliedtelesis/SBx81LIFXCAT
 - gateworks/gw_ventana

Cc: Chris Packham <chris.packham@alliedtelesis.co.nz>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz>
---

diff --git a/drivers/net/phy/mv88e61xx.c b/drivers/net/phy/mv88e61xx.c
index ea54a15310..c1e2860329 100644
--- a/drivers/net/phy/mv88e61xx.c
+++ b/drivers/net/phy/mv88e61xx.c
@@ -945,14 +945,14 @@ static int mv88e61xx_phy_config(struct phy_device *phydev)
 				continue;
 			}
 
-			res = genphy_config_aneg(phydev);
+			res = phy_reset(phydev);
 			if (res < 0) {
-				printf("Error setting PHY %i autoneg\n", i);
+				printf("Error resetting PHY %i\n", i);
 				continue;
 			}
-			res = phy_reset(phydev);
+			res = genphy_config_aneg(phydev);
 			if (res < 0) {
-				printf("Error resetting PHY %i\n", i);
+				printf("Error setting PHY %i autoneg\n", i);
 				continue;
 			}