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; } /**