[PATCH v1] realtek: reset both ethernet NIC and queues

Sander Vanheule sander at svanheule.net
Sun Nov 7 06:09:37 PST 2021


When restarting the device using a CPU reset, the networking part of the
SoC is not reset. This leads to unresponsive network after the (warm)
restart. By resetting both the switch NIC and queues (SW_NIC_RST and
SW_Q_RST bits), networking always comes up reliably.

Tested on a Zyxel GS1900-8 (RTL8380).

Suggested-by: Birger Koblitz <mail at birger-koblitz.de>
Signed-off-by: Sander Vanheule <sander at svanheule.net>
---
 .../realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c b/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c
index c966746f0246..cc8347b2fa97 100644
--- a/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c
+++ b/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.c
@@ -662,15 +662,15 @@ static void rtl838x_hw_reset(struct rtl838x_eth_priv *priv)
 		sw_w32(0xffffffff, priv->r->dma_if_intr_sts);
 	}
 
-	/* Reset NIC  */
+	/* Reset NIC (SW_NIC_RST) and queues (SW_Q_RST) */
 	if (priv->family_id == RTL9300_FAMILY_ID || priv->family_id == RTL9310_FAMILY_ID)
-		sw_w32(0x4, priv->r->rst_glb_ctrl);
+		sw_w32(0x6, priv->r->rst_glb_ctrl);
 	else
-		sw_w32(0x8, priv->r->rst_glb_ctrl);
+		sw_w32(0xc, priv->r->rst_glb_ctrl);
 
 	do { /* Wait for reset of NIC and Queues done */
 		udelay(20);
-	} while (sw_r32(priv->r->rst_glb_ctrl) & 0xc);
+	} while (sw_r32(priv->r->rst_glb_ctrl) & 0xe);
 	mdelay(100);
 
 	/* Setup Head of Line */
-- 
2.33.1




More information about the openwrt-devel mailing list