From nobody Sun Feb 8 10:29:50 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7302EC0015E for ; Fri, 21 Jul 2023 13:39:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231347AbjGUNj2 (ORCPT ); Fri, 21 Jul 2023 09:39:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229518AbjGUNjZ (ORCPT ); Fri, 21 Jul 2023 09:39:25 -0400 Received: from smtp1.axis.com (smtp1.axis.com [195.60.68.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62BC3E53; Fri, 21 Jul 2023 06:39:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axis.com; q=dns/txt; s=axis-central1; t=1689946763; x=1721482763; h=from:date:subject:mime-version:content-transfer-encoding: message-id:to:cc; bh=Iw+bltGRYz/2l9De5LyQdFIZrY7VU+/N+bnY6dDOT/s=; b=f1bhUSPovjH16UheDK0t7gYO6ocNgpprMYAnpd5KbE/aQbYGcvLg8SP9 SBBeVXtJtMSK5Ucb3t+DzM7Q2jmVdgAHBAs0vTP3dFLCOC30g3GRZ3xa3 jQt/UR7Cq0j55/URN20m4YrvMwJiU+eUSWYtQUT8NERECMxgo+hg2LFtc Q/GC1cA2HdXrb+ZhVimI5wT+EmP1tXEPu/Q5JKv6LIPrZ5BYdI5+KPT1/ ZZ4wmyvrunTN5jS8Q9avLY1lL08fMFvywkasrX54bn9fiE6/Zz68Rf1HO EZ2LxGfgDloJZ4g5fiLH6nsVGZnCkqmeVknNBH4yD25yA4TieYOULqpcJ w==; From: Vincent Whitchurch Date: Fri, 21 Jul 2023 15:39:20 +0200 Subject: [PATCH net] net: stmmac: Apply redundant write work around on 4.xx too MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-ID: <20230721-stmmac-tx-workaround-v1-1-9411cbd5ee07@axis.com> X-B4-Tracking: v=1; b=H4sIAIeKumQC/x3MQQqDMBBA0avIrB0wUQz0KuIixrEOxUQmaRVC7 m7o8i3+zxBJmCK8mgxCP44cfIVqG3C79W9CXqtBd7rvjFYY03FYh+nGK8jHSvj6FbdFGTMo1+u RoKan0Mb3fzuBpwRzKQ+mHijHawAAAA== To: Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , "Jakub Kicinski" , Paolo Abeni , Maxime Coquelin , Heiner Kallweit CC: , , , , , Vincent Whitchurch X-Mailer: b4 0.12.3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit a3a57bf07de23fe1ff779e0fdf710aa581c3ff73 ("net: stmmac: work around sporadic tx issue on link-up") worked around a problem with TX sometimes not working after a link-up by avoiding a redundant write to MAC_CTRL_REG (aka GMAC_CONFIG), since the IP appeared to have problems with handling multiple writes to that register in some cases. That commit however only added the work around to dwmac_lib.c (apart from the common code in stmmac_main.c), but my systems with version 4.21a of the IP exhibit the same problem, so add the work around to dwmac4_lib.c too. Fixes: a3a57bf07de2 ("net: stmmac: work around sporadic tx issue on link-up= ") Signed-off-by: Vincent Whitchurch Reviewed-by: Simon Horman --- drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c b/drivers/net= /ethernet/stmicro/stmmac/dwmac4_lib.c index df41eac54058..03ceb6a94073 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_lib.c @@ -240,13 +240,15 @@ void stmmac_dwmac4_set_mac_addr(void __iomem *ioaddr,= const u8 addr[6], void stmmac_dwmac4_set_mac(void __iomem *ioaddr, bool enable) { u32 value =3D readl(ioaddr + GMAC_CONFIG); + u32 old_val =3D value; =20 if (enable) value |=3D GMAC_CONFIG_RE | GMAC_CONFIG_TE; else value &=3D ~(GMAC_CONFIG_TE | GMAC_CONFIG_RE); =20 - writel(value, ioaddr + GMAC_CONFIG); + if (value !=3D old_val) + writel(value, ioaddr + GMAC_CONFIG); } =20 void stmmac_dwmac4_get_mac_addr(void __iomem *ioaddr, unsigned char *addr, --- base-commit: fdf0eaf11452d72945af31804e2a1048ee1b574c change-id: 20230721-stmmac-tx-workaround-fb17741c326e Best regards, --=20 Vincent Whitchurch