From patchwork Sun Nov 7 14:09:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sander Vanheule X-Patchwork-Id: 1551968 X-Patchwork-Delegate: stijn@linux-ipv6.be Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=fWxN1Ro5; dkim=fail reason="signature verification failed" (2048-bit key; secure) header.d=svanheule.net header.i=@svanheule.net header.a=rsa-sha256 header.s=mail1707 header.b=AEPILInr; dkim-atps=neutral Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.openwrt.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by bilbo.ozlabs.org (Postfix) with ESMTPS id 4HnGQQ31Fbz9sRR for ; Mon, 8 Nov 2021 01:11:58 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=0CTDc+p2HkLIjQyM4uUOvOat9ArzoiTPXcQnKRuYd9s=; b=fWxN1Ro5CmiPuq //UtpfUoEZ2F+UnFhGYlnD2ixT9kcsH3lHVrJl0ppTTAUmPS8CFXF39d2SzFIesHOOUVKhu0huytO N54sIPgrOcuzx7jIX7m8/iedbRf1IelDCbHKHgXlFWc9ALJtNbaEQVOWhiyvvGaCf9d/z9bwGwz0q sQ3SWiYtEdkkEbXGFil+dx/biW3iLzbM/3/J4lvlsdd9sHRABYau7OmU423avZfoClPp1JDsUzgCY 3hVi0yaquGCDf0N7Sa5aCcocCDvKG39qRTyQE8qUiEPXU3aHLMg5RsKBBywbCkpDlTyMPct9gcPqg Pwa1dWT92dV0RQstQqyQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mjiru-00EQY4-Mm; Sun, 07 Nov 2021 14:09:58 +0000 Received: from polaris.svanheule.net ([84.16.241.116]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mjirl-00EQWh-BL for openwrt-devel@lists.openwrt.org; Sun, 07 Nov 2021 14:09:51 +0000 Received: from terra.local.svanheule.net (unknown [IPv6:2a02:a03f:eafe:c901:c475:2e98:3c18:1065]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sander@svanheule.net) by polaris.svanheule.net (Postfix) with ESMTPSA id 01E9D26DD93; Sun, 7 Nov 2021 15:09:45 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svanheule.net; s=mail1707; t=1636294186; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=PXmrKzI+PUZLyetQy9NGc1fxYLlpWxUnf8oG74+y/ZU=; b=AEPILInrGqvXrV0NV4Iwem0qHpsutIv3c3lSiObxmDn+4JYqPNQuhinJhsgsEizsZpzHJz ljRRoYEXLawFFP+gDcwn70BldrvbwtW0Ers5ZKUlWxY/2Zpt2IUSD8SlE9cHptbmrJvuMr GKuXb/67ZV5OggHgiqc67p8Ao9VyxViqm9JEztTZXHTQYCekv68LgEfGKykzDdHoTnEFlc plDgYVIGBGRmKCzW1zKDNuJXgYcQNa4Vm6/vpeN24rvvMKHBmK0lYFak9bj1q1POaUrJTl sn7z0SAjvITtqtoeftwxY9+6mE/avQ9eV90hlYutekmfr+00fKFxgcYn0Yt+5w== From: Sander Vanheule To: openwrt-devel@lists.openwrt.org Cc: Sander Vanheule , Birger Koblitz Subject: [PATCH v1] realtek: reset both ethernet NIC and queues Date: Sun, 7 Nov 2021 15:09:37 +0100 Message-Id: <20211107140937.465680-1-sander@svanheule.net> X-Mailer: git-send-email 2.33.1 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211107_060950_050680_141C6FBD X-CRM114-Status: UNSURE ( 9.01 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -0.9 (/) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: 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_ [...] Content analysis details: (-0.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at https://www.dnswl.org/, low trust [84.16.241.116 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org 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 Signed-off-by: Sander Vanheule --- .../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 */