From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1BDB72D0601; Sun, 28 Sep 2025 09:34:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759052076; cv=none; b=RdvgY8OdUT7aKNmmEWyFLNBq6JWRAv9Bkm2LD1VzUkkv/QhjbD5Dt0AWk9BYKFMXXm0MW3S0+3sI/sQCBq+uYWM4bdTYdvXgqAZgyl3edLe+yib9DZByHtUX957nWQtl5mht7bZXfFy01Ee4CyszBWYfppaNHCXBVI0+OG9YWDQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1759052076; c=relaxed/simple; bh=YgN4hzWJa2zI9fXP+KUofHp52+XQtD22oj7uLDZy5hc=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=g49sYRqZU5n8gREUuRWLjKJ9U0gNP2bpw4BXbtlVhUDNJVb/HS4EFaBdNfv1QrQTncCmTUtNPV8fxTpyfdfQGr5mR2hA4j8TvwL2RsWjuIEc2Gk61CYu7arDgDkU2qCF/4ip639LOd5uTyKUGFgeGzq3oUKNw345Lie/H7fKgLk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=SEZzeCJV; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="SEZzeCJV" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=tsa26LUtnB+yfGPkqGfu37+Ohz48A6hBpNafuHU0e9c=; b=SEZzeCJVfHKpg/VhUKmr2dw/Wn Q9O8HlrQHLLQ+Uz0Co3yGIjiTEucMl4bHAvvtCSUziAn4wcuTwhd3E22zBISlfvNuVwgBE9njf7cg zJOguokDB1z3byb2XjrlXQo1yoO1CgkLIYByVbjT/y2t0nksKZUoyP2xpqOpGLIEUzo5laS1CJrbP FV1QDdGRCy1IHzP2trmjeM7EtIfogdcMJIYeNfoQtprl5J4jcFwmEUN3vEPGnE+8Ran6RKOwgZKfl YmpuVrVEDU+4F13vGFyB0iStgSYTmohdJY5VgKDmbVNI2P3B9TBj7bcQG5hJ78i6OPlw55T4z128o gO3ZrQhw==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:55602 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1v2nbE-000000005Kb-11Vl; Sun, 28 Sep 2025 10:21:44 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.98.2) (envelope-from ) id 1v2nbB-00000007oM3-2PPb; Sun, 28 Sep 2025 10:21:41 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn , Heiner Kallweit Cc: Abhishek Chauhan , Alexandre Torgue , Alexis Lothore , "Alexis Lothor__" , Andrew Lunn , Boon Khai Ng , Choong Yong Liang , Daniel Machon , "David S. Miller" , Eric Dumazet , Faizal Rahim , Furong Xu <0x1207@gmail.com>, Huacai Chen , Inochi Amaoto , Jacob Keller , Jakub Kicinski , "Jan Petrous (OSS)" , Jisheng Zhang , Kees Cook , Kunihiko Hayashi , Lad Prabhakar , Ley Foon Tan , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Mateusz Polchlopek , Matthew Gerlach , Maxime Chevallier , Maxime Coquelin , netdev@vger.kernel.org, Oleksij Rempel , Paolo Abeni , Rohan G Thomas , Shenwei Wang , Simon Horman , Song Yoong Siang , Swathi K S , Tiezhu Yang , Vinod Koul , Vladimir Oltean , Vladimir Oltean , Yu-Chun Lin Subject: [PATCH RFC net-next v2 19/19] net: stmmac: add support specifying PCS supported interfaces Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Sun, 28 Sep 2025 10:21:41 +0100 Signed-off-by: Russell King (Oracle) --- drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c | 7 ++++++- drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c | 7 ++++++- drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c | 6 ++++-- drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h | 3 ++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c index a2ae136d2c0e..0d85902bafd0 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac1000_core.c @@ -24,12 +24,17 @@ static int dwmac1000_pcs_init(struct stmmac_priv *priv) { + phy_interface_t mode; + if (!priv->dma_cap.pcs) return 0; + mode = PHY_INTERFACE_MODE_SGMII; + return stmmac_integrated_pcs_init(priv, GMAC_PCS_BASE, GMAC_INT_DISABLE_PCSLINK | - GMAC_INT_DISABLE_PCSAN); + GMAC_INT_DISABLE_PCSAN, + &mode, 1); } static void dwmac1000_core_init(struct mac_device_info *hw, diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c index a4282fd7c3c7..af9a336a32e6 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_core.c @@ -24,11 +24,16 @@ static int dwmac4_pcs_init(struct stmmac_priv *priv) { + phy_interface_t mode; + if (!priv->dma_cap.pcs) return 0; + mode = PHY_INTERFACE_MODE_SGMII; + return stmmac_integrated_pcs_init(priv, GMAC_PCS_BASE, - GMAC_INT_PCS_LINK | GMAC_INT_PCS_ANE); + GMAC_INT_PCS_LINK | GMAC_INT_PCS_ANE, + &mode, 1); } static void dwmac4_core_init(struct mac_device_info *hw, diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c index 77d38936d898..5293c52cf7af 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c @@ -65,7 +65,8 @@ static const struct phylink_pcs_ops dwmac_integrated_pcs_ops = { }; int stmmac_integrated_pcs_init(struct stmmac_priv *priv, unsigned int offset, - u32 int_mask) + u32 int_mask, const phy_interface_t *modes, + int num) { struct stmmac_pcs *spcs; @@ -78,7 +79,8 @@ int stmmac_integrated_pcs_init(struct stmmac_priv *priv, unsigned int offset, spcs->int_mask = int_mask; spcs->pcs.ops = &dwmac_integrated_pcs_ops; - __set_bit(PHY_INTERFACE_MODE_SGMII, spcs->pcs.supported_interfaces); + while (num--) + __set_bit(*modes++, spcs->pcs.supported_interfaces); priv->integrated_pcs = spcs; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h index e42a98162c2b..36da4dab4f8f 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.h @@ -63,7 +63,8 @@ phylink_pcs_to_stmmac_pcs(struct phylink_pcs *pcs) } int stmmac_integrated_pcs_init(struct stmmac_priv *priv, unsigned int offset, - u32 int_mask); + u32 int_mask, const phy_interface_t *modes, + int num); /** * dwmac_pcs_isr - TBI, RTBI, or SGMII PHY ISR -- 2.47.3