From patchwork Fri May 24 21:02:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13673751 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 23D77C25B74 for ; Fri, 24 May 2024 21:03:44 +0000 (UTC) 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:References:In-Reply-To: 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: List-Owner; bh=WbPsqoB7VUIMP6VbA9P0MpM19BmvBfhTHp+1fuu8dP0=; b=v1Vi1jWc1qnPKu 3FD9uUy64G04xhAHZinClTj8CdtjGjyqZ3/bbx7d+q4dpQAaCdco7oiMjHUuPdkjGOO1uS9BiDfHN MX1d6ZDfVLzPuqdZLmEP3iyHoduCgt5B8FI94D2ZMwjnQjXQ5mUt9OXmNTkVRN+O38C47L/YQXEpk fY2xwFT3ik1cSILlCtpCUHEjSojwkBol6XgFVf8nahybdXd0S31uKECdUp9JKAAJWx0HyMOGk+LID gqOTwAbMJloDmcpwMvxehknkzjFZglWXx3SqVRWhMkDhdhNRnu7jJXMp0LtM4ZktuH1S44tc5pKja +ou9ZmYv7V44L5aeSfXA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sAc4c-00000009ssp-12Sm; Fri, 24 May 2024 21:03:34 +0000 Received: from mail-lf1-x129.google.com ([2a00:1450:4864:20::129]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sAc4Y-00000009sr6-2TGV for linux-arm-kernel@lists.infradead.org; Fri, 24 May 2024 21:03:32 +0000 Received: by mail-lf1-x129.google.com with SMTP id 2adb3069b0e04-5295bcb9bc1so1194746e87.0 for ; Fri, 24 May 2024 14:03:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716584601; x=1717189401; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=jfTzYX+duGMsU7h/VpsgnG4SbDyXgyQ9P7UXQAwHfVg=; b=mzGB7VmHkqM+0vDNZVVLpFxAk2lr3COQH+AnCiSzbBXWDtQLqfAmeg06aWG8yCp/ov C71uO1os0nRMey0js90XZ/uB4VtrLu6h3Yrk5mm9HV8KRO8ta5aROrgbxbMVzTMje/Rb R068QwyKOo8HBpOChh1aihESNBXo0cQBip4zuFJB7HD5nkPi+NVm96Y+pbCFjxA6c7w2 j5D8K3LZhYt3v1+tYPnIamdmASug8QMn+GbXAIxgOjPnUDH5fdwO6EQZaQ8XGsy0JW5L JAUWCfzPYf4khfWhTQHah7tzYo5fM1fPRMJUytrXRgsuUb+BHrAUXzcoIj5QkZcfwueq pVxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716584601; x=1717189401; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jfTzYX+duGMsU7h/VpsgnG4SbDyXgyQ9P7UXQAwHfVg=; b=DS6IKq/nF+YljL4UVUXOrnSi4lAY6OZ/4xJwAP7pUlH80tvJRJIA0PePmmITezXHO2 X3zocbBG6fXVHlpxqIraXC+Z5P7iPIQkIy0kr+eRJSjHjbNjV9+uxBGE/NHTXlXM71+M Kn7riFvsJXVehzofoi7ggWjWoNtsp+JJ9jHSM3nv3lvOnCk11b9TUf7r1NoYNzznEBIX GF5l2cXaPIu4l2mWuQ3+4v4O2qLc0zHNdTlVcpA7h98bUaognlDIavbQSzbv6TzEqq45 TliTyfeIILv/v5C4Lc1LUZ+GvFFeEONRGrRykKCCcrcE1NWFAFO2QZwSiE6TvMyXd2VC hdlg== X-Forwarded-Encrypted: i=1; AJvYcCXcfI7ojGO3EDqrI7ymUFw4lW/W7UDycL6K9sNMINEEJEgrFtms5Mi8/v3l3tsVXxDghDTvgmYfs47c55SebYIRIgIBAd1KC/iHzSohMD5brwKVqak= X-Gm-Message-State: AOJu0YyDITDWsqY19u3FN7hoS31g8dOAwLDEM+ksa1AGxWhhp3545wmB QD+gODTdvsHZvUykfYzQT58+/ExBwUYYHsJQNedDAAxyS4blbgF8 X-Google-Smtp-Source: AGHT+IFsvg+3eW+uFt+8zbMHGOvvmM7wbkkNlpRI+IgIK/fpNCjG+0mt4y0mWAeB+ZHjQFEWsw7fgQ== X-Received: by 2002:a19:381d:0:b0:523:889a:ebd with SMTP id 2adb3069b0e04-52964ea947bmr1972965e87.24.1716584601070; Fri, 24 May 2024 14:03:21 -0700 (PDT) Received: from localhost ([95.79.182.53]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52970e1ef56sm236078e87.228.2024.05.24.14.03.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 14:03:20 -0700 (PDT) From: Serge Semin To: Russell King , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin Cc: Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , bpf@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC net-next 1/3] net: stmmac: Prevent RGSMIIIS IRQs flood Date: Sat, 25 May 2024 00:02:57 +0300 Message-ID: <20240524210304.9164-1-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240524_140330_784798_30F25AA1 X-CRM114-Status: GOOD ( 11.29 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Without reading the GMAC_RGSMIIIS/MAC_PHYIF_Control_Status the IRQ line won't be de-asserted causing interrupt handler executed over and over. As a quick-fix let's just dummy-read the CSR for now. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 2 ++ drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c index adb872d5719f..2ae8467c588e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c @@ -304,6 +304,8 @@ static int dwmac1000_irq_status(struct mac_device_info *hw, dwmac_pcs_isr(ioaddr, GMAC_PCS_BASE, intr_status, x); if (intr_status & PCS_RGSMIIIS_IRQ) { + /* TODO Dummy-read to clear the IRQ status */ + readl(ioaddr + GMAC_RGSMIIIS); phylink_pcs_change(&hw->mac_pcs, false); x->irq_rgmii_n++; } diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index a892d361a4e4..cd2ca1d0222c 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -896,6 +896,8 @@ static int dwmac4_irq_status(struct mac_device_info *hw, dwmac_pcs_isr(ioaddr, GMAC_PCS_BASE, intr_status, x); if (intr_status & PCS_RGSMIIIS_IRQ) { + /* TODO Dummy-read to clear the IRQ status */ + readl(ioaddr + GMAC_PHYIF_CONTROL_STATUS); phylink_pcs_change(&hw->mac_pcs, false); x->irq_rgmii_n++; } From patchwork Fri May 24 21:02:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13673752 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CE17EC25B79 for ; Fri, 24 May 2024 21:03:46 +0000 (UTC) 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:References:In-Reply-To: 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: List-Owner; bh=puZBicav5WmtX9OK3avUR8cFs7Q6DEHcCIemI8QHW+U=; b=qQfE+Nxyz/+BQ0 GMhz/Fx1um8zq5YZ0Un7I45MtTi1vI/Ad75DtCG8EdN2cHG8rRAF0zaNs/0WDACHd0gLdL8603/zT 9XmqiQ2PXZTrBlZRxFuk5l71XmNfFZ1+t6snVae13LwrQqS1CuygP6b9Ry1EDxnXN3k0q1GCnnNOJ OVg1UAAv5Wr3+rlIbeI1dEda6RszbUBkMMyNCJ4KOJ92u9g5beKL2pGcfsbtMIAxlf4Gb/YwmLYzj bScezThcrgI3XgmqSibERDoXIFJLRlDQRYcBspF8lmuU6jE1igysYP7gCu4vJfOJkqStJx9hAobYE KO9ppeVDIiazOWC0ENOw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sAc4b-00000009ssV-2f18; Fri, 24 May 2024 21:03:33 +0000 Received: from mail-lf1-x12e.google.com ([2a00:1450:4864:20::12e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sAc4Y-00000009srB-30NG for linux-arm-kernel@lists.infradead.org; Fri, 24 May 2024 21:03:32 +0000 Received: by mail-lf1-x12e.google.com with SMTP id 2adb3069b0e04-529597d77b4so1319220e87.0 for ; Fri, 24 May 2024 14:03:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716584603; x=1717189403; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=hxT1J6TEpAgvO5DZP/UxXlPe1jaIeEw8wHuXNfn0DlA=; b=EiPCNc4n0E+18QaZtkrEwXezAtyT2yz/O7GxjcVpqPdhdeC9cXGw/V9dvK0JyOVH+E JZQHsJT4cXoYdec18qCwqpNaiJfnp33LK1eoe1hu0DHcc9IHGGhD00Bl7vwfycnj2C4h +yxOVRP7g0bnd9Xpkfiieekon2u9gvVPNpBcAZbXoJvf1r2LllsQviHb9bLYslhPxDcH ii4r7SAhXLlRHpv95FU9si5PNHuxUBRzmcPDGx23eknHia8W3pmLVNzVf52YX8ZGdy/H aVH7l3ATQvJVhLvWWvzeW1d4LK++dfV1INMhmMzB5dcwQtMt50aOHn/TeFTFbGFV48T+ OM/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716584603; x=1717189403; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hxT1J6TEpAgvO5DZP/UxXlPe1jaIeEw8wHuXNfn0DlA=; b=wDS15CnGCovge32bk/G/M910rYMtH/hiQ4G4dEfEXaWKPqZgoPXNnBVTN1DwdW86CV HPi9LnOgQ9gXweXS/7Rx/jdNTeqzd53SaWw6CGi3dw9A8L1XpwpiIOrbUnUei5pvQatC LGFM7qW2mqiZ2NfOpE7Af8i9cc8pCSMwUh7yZjWPd+oNfxOrqOfhVdjSLPUPu4f8wVze wAftT2xg/7/UrfOy0xadCtkyW5ervAqpHTJxsjgrJ9+D9Vz2+At++h9vrdMrSkfT+lRR /5OtJ2EScxyXowPUkxZmkhCgXb/qdPNgI294+u0UWOaKi5kFrcdlanA4pXJ04RtVNv2U RysQ== X-Forwarded-Encrypted: i=1; AJvYcCU5niaFeKq+xKx9SV+8EI02WvumthNZMkxVCierTci6Sn7FmEjyaayNI6nSueIPlL8KhVOHey54Q4o23Csn86LEvYGWTBx1W89ah3ykLI7Ygrk0yG0= X-Gm-Message-State: AOJu0YzTdFQJikP7x7jCIula9fNXPiD6OTbOE2NE2kxb6bT4bHp0MUHA D4KvTuR+GhtPgiHfPbS7u1Cf1CjsVK1fZdLhRZTcN8IS2O+DOdIS X-Google-Smtp-Source: AGHT+IHiFHbJSkm3a+YnVrAqiEBUxqU0zl1zz3q7VRqSYd34a0x8WLy+5xT5KHOoe8SsJpqmPTpH8g== X-Received: by 2002:a05:6512:3b86:b0:51e:2282:63cf with SMTP id 2adb3069b0e04-529666db5f9mr2844583e87.45.1716584602922; Fri, 24 May 2024 14:03:22 -0700 (PDT) Received: from localhost ([95.79.182.53]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5296ee4aa90sm241351e87.92.2024.05.24.14.03.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 14:03:22 -0700 (PDT) From: Serge Semin To: Russell King , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin , Byungho An , Giuseppe CAVALLARO Cc: Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , bpf@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC net-next 2/3] net: stmmac: Activate Inband/PCS flag based on the selected iface Date: Sat, 25 May 2024 00:02:58 +0300 Message-ID: <20240524210304.9164-2-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240524210304.9164-1-fancer.lancer@gmail.com> References: <20240524210304.9164-1-fancer.lancer@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240524_140330_784638_EF3654EB X-CRM114-Status: GOOD ( 17.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The HWFEATURE.PCSSEL flag is set if the PCS block has been synthesized into the DW GMAC controller. It's always done if the controller supports at least one of the SGMII, TBI, RTBI PHY interfaces. If none of these interfaces support was activated during the IP-core synthesize the PCS block won't be activated either and the HWFEATURE.PCSSEL flag won't be set. Based on that the RGMII in-band status detection procedure implemented in the driver hasn't been working for the devices with the RGMII interface support and with none of the SGMII, TBI, RTBI PHY interfaces available in the device. Fix that just by dropping the dma_cap.pcs flag check from the conditional statement responsible for the In-band/PCS functionality activation. If the RGMII interface is supported by the device then the in-band link status detection will be also supported automatically (it's always embedded into the RGMII RTL code). If the SGMII interface is supported by the device then the PCS block will be supported too (it's unconditionally synthesized into the controller). The later is also correct for the TBI/RTBI PHY interfaces. Note while at it drop the netdev_dbg() calls since at the moment of the stmmac_check_pcs_mode() invocation the network device isn't registered. So the debug prints will be for the unknown/NULL device. Fixes: e58bb43f5e43 ("stmmac: initial support to manage pcs modes") Signed-off-by: Serge Semin --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 90c065920af2..6c4e90b1fea3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -1146,18 +1146,10 @@ static void stmmac_check_pcs_mode(struct stmmac_priv *priv) { int interface = priv->plat->mac_interface; - if (priv->dma_cap.pcs) { - if ((interface == PHY_INTERFACE_MODE_RGMII) || - (interface == PHY_INTERFACE_MODE_RGMII_ID) || - (interface == PHY_INTERFACE_MODE_RGMII_RXID) || - (interface == PHY_INTERFACE_MODE_RGMII_TXID)) { - netdev_dbg(priv->dev, "PCS RGMII support enabled\n"); - priv->hw->pcs = STMMAC_PCS_RGMII; - } else if (interface == PHY_INTERFACE_MODE_SGMII) { - netdev_dbg(priv->dev, "PCS SGMII support enabled\n"); - priv->hw->pcs = STMMAC_PCS_SGMII; - } - } + if (phy_interface_mode_is_rgmii(interface)) + priv->hw.pcs = STMMAC_PCS_RGMII; + else if (interface == PHY_INTERFACE_MODE_SGMII) + priv->hw.pcs = STMMAC_PCS_SGMII; } /** From patchwork Fri May 24 21:02:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Serge Semin X-Patchwork-Id: 13673753 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 14EDEC25B79 for ; Fri, 24 May 2024 21:04:03 +0000 (UTC) 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:References:In-Reply-To: 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: List-Owner; bh=YT+08laol/rxHhAD1FJF3IpHisq/RaFwSUBKO/a5tR8=; b=ru9DT3Wkrdf/lU 7zQRdjBtGwEagCBVjec6pnWgJFQBXIybINRLeNWtSBXa33a9gXedveULZpSssVeZfv+4vcwx4VoVh SfD2KKD0jeaFjJSFE5gy2N6Wx6lp/VjChNmogdS3SgYFc62UC5/k8czQNfH3zZ7m4xy9ZYKCvH7MQ qT4DfIJNarBKwTdwCZRwJOLIHQTHr2Fqvsf6wsEo7igfVDOkinGTrlDCWBBCiwDhSxX8LwuE8jHpo qlfcT+REMnIsnfitia1ZwtIbo91prdcbL9DPHK7j2DSn7dhSx1WHN6LSadZXdDwPVKVznfrl4Rrf+ TZQ6rFfGxWNGGIPp5fkA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sAc4u-00000009szj-2Gj0; Fri, 24 May 2024 21:03:52 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sAc4Y-00000009srE-3iKC for linux-arm-kernel@lists.infradead.org; Fri, 24 May 2024 21:03:33 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-5295f201979so1547602e87.2 for ; Fri, 24 May 2024 14:03:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1716584605; x=1717189405; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=6SsA/DX4FQd1mwIvYQLseyq3XbpKYYuZmRUlHTPnong=; b=YRmmHh7WVa2vwlfD9E9Zb9tMB8JCz6xlXuUhUQGmBQ1wXHzCfCeL8P10TAkLRh4UGU vmBLTuISBEyTMCERq9Dve8/k+SSNUs4cOuPWZZ11E74BKQIWbPBYkMeVvou58nAUqcJa TuuuwjEuHRdGu4V0mqj0f2ihP9rZh/4DxrZ4asY2eVJt36oC1NLOr6NBns+MeNmDbSaw Lri/kBQmRTUngBzvI6Nl83xorADXJqZ/yrow9MPuAL0pRC+cCQLFF7qfXdU1u3Y4vWSN SIlcpAZIegUIdhz9P5aeR+ZLZlNmUoMf1VSzlgJbD/xbAaXtFguerPy5yFVO2e0faE1l eNsw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716584605; x=1717189405; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6SsA/DX4FQd1mwIvYQLseyq3XbpKYYuZmRUlHTPnong=; b=vo2hF2a7+gqeFyYGyO00MvL7yiO1vB1dHvrT9y6r/TzIHf5KV5+Ux7VASH+Wb09DwB Ouh4VSvNBypQkVxOZrNXSkFfgcQ/9UZAB6EDRNnE2bqr+cGKTzLydeVuvrjUxS1sxiXs jMn72oshq9MkYV9yqdnyRS9D6gBDJT8PPamjSVYC8oaOUeVj9K7RAY0BfeExhFWTzRx9 05QzNyKzx8Idlesufu0Y3HCvL9wb9ixq5QifUSIGklu6Q6BXbxiecVvRCPuNbpyhFc07 4M91uSC8Uy5hrp+5W2Gn2jFEtLjItFrztAqmIFHEPclrhrei2zaPPHZkysIW2zgHDMj6 KpWQ== X-Forwarded-Encrypted: i=1; AJvYcCUV1IcERmCHMgWPHp+znV+YsjJdOyM8GZgCxEpMnYv9724cKIoV3oRLqGeHrUoIExyz/QvLo4IuS0c8zumaLa5GQKYEAUTdApnTmfGvbrhAFSHn07Q= X-Gm-Message-State: AOJu0YwJETXuZV7S/oAUun5tJWqRAuMZe2UE7rGPpf6BTi438jocOfiE TR4pqc9Z+aI40D4YiIrQrNw8JlzxlBcYSRgYFc2wNcKz3BDrZrfL X-Google-Smtp-Source: AGHT+IG0PT+7TnzaGJ6HfS/LUBBacBaRk08p6C1KaUcsx5/G5OJ+ElDL8rqeNbSK5PYnnNXLPfqj6Q== X-Received: by 2002:ac2:454c:0:b0:523:a924:3268 with SMTP id 2adb3069b0e04-52964109a01mr1779610e87.6.1716584604952; Fri, 24 May 2024 14:03:24 -0700 (PDT) Received: from localhost ([95.79.182.53]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-5297066bcd6sm237510e87.164.2024.05.24.14.03.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 14:03:24 -0700 (PDT) From: Serge Semin To: Russell King , Alexandre Torgue , Jose Abreu , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Maxime Coquelin Cc: Alexei Starovoitov , Daniel Borkmann , Jesper Dangaard Brouer , John Fastabend , bpf@vger.kernel.org, netdev@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH RFC net-next 3/3] net: stmmac: Drop TBI/RTBI PCS flags Date: Sat, 25 May 2024 00:02:59 +0300 Message-ID: <20240524210304.9164-3-fancer.lancer@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240524210304.9164-1-fancer.lancer@gmail.com> References: <20240524210304.9164-1-fancer.lancer@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240524_140331_067341_561A6AA3 X-CRM114-Status: GOOD ( 18.79 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org First of all the flags are never set by any of the driver parts. If nobody have them set then the respective statements will always have the same result. Thus the statements can be simplified or even dropped with no risk to break things. Secondly shall any of the TBI or RTBI flag is set the MDIO-bus registration will be bypassed. Why? It really seems weird. It's perfectly fine to have a TBI/RTBI-capable PHY configured over the MDIO bus interface. Based on the notes above the TBI/RTBI PCS flags can be freely dropped thus simplifying the driver code. Signed-off-by: Serge Semin --- drivers/net/ethernet/stmicro/stmmac/common.h | 2 - .../net/ethernet/stmicro/stmmac/stmmac_main.c | 37 ++++++------------- 2 files changed, 11 insertions(+), 28 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/common.h b/drivers/net/ethernet/stmicro/stmmac/common.h index b02b905bc892..40a930ea4ff3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/common.h +++ b/drivers/net/ethernet/stmicro/stmmac/common.h @@ -268,8 +268,6 @@ struct stmmac_safety_stats { /* PCS defines */ #define STMMAC_PCS_RGMII (1 << 0) #define STMMAC_PCS_SGMII (1 << 1) -#define STMMAC_PCS_TBI (1 << 2) -#define STMMAC_PCS_RTBI (1 << 3) #define SF_DMA_MODE 1 /* DMA STORE-AND-FORWARD Operation Mode */ diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 6c4e90b1fea3..06f95dfdf09e 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -471,13 +471,6 @@ bool stmmac_eee_init(struct stmmac_priv *priv) { int eee_tw_timer = priv->eee_tw_timer; - /* Using PCS we cannot dial with the phy registers at this stage - * so we do not support extra feature like EEE. - */ - if (priv->hw->pcs == STMMAC_PCS_TBI || - priv->hw->pcs == STMMAC_PCS_RTBI) - return false; - /* Check if MAC core supports the EEE feature. */ if (!priv->dma_cap.eee) return false; @@ -3945,9 +3938,7 @@ static int __stmmac_open(struct net_device *dev, if (ret < 0) return ret; - if (priv->hw->pcs != STMMAC_PCS_TBI && - priv->hw->pcs != STMMAC_PCS_RTBI && - (!priv->hw->xpcs || + if ((!priv->hw->xpcs || xpcs_get_an_mode(priv->hw->xpcs, mode) != DW_AN_C73) && !priv->hw->lynx_pcs) { ret = stmmac_init_phy(dev); @@ -7724,16 +7715,12 @@ int stmmac_dvr_probe(struct device *device, if (!pm_runtime_enabled(device)) pm_runtime_enable(device); - if (priv->hw->pcs != STMMAC_PCS_TBI && - priv->hw->pcs != STMMAC_PCS_RTBI) { - /* MDIO bus Registration */ - ret = stmmac_mdio_register(ndev); - if (ret < 0) { - dev_err_probe(priv->device, ret, - "%s: MDIO bus (id: %d) registration failed\n", - __func__, priv->plat->bus_id); - goto error_mdio_register; - } + ret = stmmac_mdio_register(ndev); + if (ret < 0) { + dev_err_probe(priv->device, ret, + "MDIO bus (id: %d) registration failed\n", + priv->plat->bus_id); + goto error_mdio_register; } if (priv->plat->speed_mode_2500) @@ -7776,9 +7763,7 @@ int stmmac_dvr_probe(struct device *device, phylink_destroy(priv->phylink); error_xpcs_setup: error_phy_setup: - if (priv->hw->pcs != STMMAC_PCS_TBI && - priv->hw->pcs != STMMAC_PCS_RTBI) - stmmac_mdio_unregister(ndev); + stmmac_mdio_unregister(ndev); error_mdio_register: stmmac_napi_del(ndev); error_hw_init: @@ -7817,9 +7802,9 @@ void stmmac_dvr_remove(struct device *dev) if (priv->plat->stmmac_rst) reset_control_assert(priv->plat->stmmac_rst); reset_control_assert(priv->plat->stmmac_ahb_rst); - if (priv->hw->pcs != STMMAC_PCS_TBI && - priv->hw->pcs != STMMAC_PCS_RTBI) - stmmac_mdio_unregister(ndev); + + stmmac_mdio_unregister(ndev); + destroy_workqueue(priv->wq); mutex_destroy(&priv->lock); bitmap_free(priv->af_xdp_zc_qps);