[PATCH v2 6/6] net: sun8i-emac: v3s: fix soft reset timeout

Andreas Rehn rehn.andreas86 at gmail.com
Sun May 23 01:23:40 CEST 2021


v3s emac soft reset tooks quit longer if autonegation is active
on 100 Mbit full duplex pairs what can result in
`sun8i_emac_eth_start: Timeout` error

wait_for_bit_le32 polls register value each ms.
Increasing the timeout for setup to 1000 ms and above results still in start timeouts.

Linux kernel driver dwmac-sun8i work very nice and don't provide a soft reset.
Skip soft reset on u-boot for V3s provide the expected behavior
on all connection permutations. If cable is not plugged in, the timeout
comes form the phy driver itself.

Signed-off-by: Andreas Rehn <rehn.andreas86 at gmail.com>
---
Changes in v2:
	- skip soft reset if MACH_SUN8I_V3S is enabled
	- depends on PATCH v2 4/6

 drivers/net/sun8i_emac.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/sun8i_emac.c b/drivers/net/sun8i_emac.c
index ab9f61994c..403e9b9d31 100644
--- a/drivers/net/sun8i_emac.c
+++ b/drivers/net/sun8i_emac.c
@@ -474,12 +474,14 @@ static int sun8i_emac_eth_start(struct udevice *dev)
 	int ret;
 
 	/* Soft reset MAC */
-	writel(EMAC_CTL1_SOFT_RST, priv->mac_reg + EMAC_CTL1);
-	ret = wait_for_bit_le32(priv->mac_reg + EMAC_CTL1,
-				EMAC_CTL1_SOFT_RST, false, 10, true);
-	if (ret) {
-		printf("%s: Timeout\n", __func__);
-		return ret;
+	if (!IS_ENABLED(CONFIG_MACH_SUN8I_V3S)) {
+		writel(EMAC_CTL1_SOFT_RST, priv->mac_reg + EMAC_CTL1);
+		ret = wait_for_bit_le32(priv->mac_reg + EMAC_CTL1,
+					EMAC_CTL1_SOFT_RST, false, 10, true);
+		if (ret) {
+			printf("%s: Timeout\n", __func__);
+			return ret;
+		}
 	}
 
 	/* Rewrite mac address after reset */
-- 
2.25.1



More information about the U-Boot mailing list