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 13BE2375F6B; Wed, 4 Mar 2026 08:49:39 +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=1772614180; cv=none; b=RTi+I/UMAUNgw3dQccVAoIWsPDXVrIGrS8ouX3IxXmhKHo2OaaeMUw92JnXSkKsnofnAiULc48x0Z0Ysukd3/mtIXp3D/qNNXD/29XU/gtCKYjByLpbpSvEwpA06QFFXa+NwjFuVTwT77o2yXp+1V2zrN0jUDXM+VXpt9k9CR5o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772614180; c=relaxed/simple; bh=e7L/6i4r2nRAWlL4JI6FybyOv/lOE9vW1MtmTZaxiAU=; h=In-Reply-To:References:From:To:Cc:Subject:MIME-Version: Content-Disposition:Content-Type:Message-Id:Date; b=AvMGk/wHZLShUIzhWddGZ5YEef/GkHMSyrDJXx2jbXfqH1/hHUAUPBpJ7TARdri04fC//K+PtFOHcXhmB3NsHuBpfT2tfKktydBTEcvDc4GUHEwOQtwxoQ5VmIiRdt7xRI6mrt/Xuhkn6lfNYL1mp+CL7em92Q7fBjtc4qow2zg= 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=bu/xsFZT; 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="bu/xsFZT" 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=QpVZHAyEJ8psaVdJL6ep6frfkNeyqoUFSmGxnRhF8MY=; b=bu/xsFZTbDAztM6khsx6TJTzI5 lldNIvO3V7OLpAee24johonSOJx5uT/3cpHV1I4fTGYSgvg7ZUTRN9L6ZH89OVAcqE05Y4x79z0XV FtADvtqcgO6XrGKZFkXaXi4j5nub6YRvWYgD4CW/O957Y3EJ8rINjeQS6goub6J4xwpIClnbh3mCj XFXvt7p5UB4u2UoOrxSfaRhLF09iWw/HYj628HZvYEBobJS7XWZAzh4RUZiOmDdZnsRSQEGLpmGhp wLwIze/shASbjcbb5cHvsaLvnAhwMVScuqU5+xVmcM9AUP5Z9heWsOWGxXfNwor3gaYi0hDQ5U7Pi X7YargNQ==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:35044 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 1vxhv6-000000006AS-3NAN; Wed, 04 Mar 2026 08:49:29 +0000 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.98.2) (envelope-from ) id 1vxhv3-0000000BqGp-23Ql; Wed, 04 Mar 2026 08:49:25 +0000 In-Reply-To: References: From: "Russell King (Oracle)" To: Andrew Lunn Cc: Alexandre Torgue , Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, Mohd Ayaan Anwar , netdev@vger.kernel.org, Paolo Abeni Subject: [PATCH RFC net-next v2 6/7] net: stmmac: configure SGMII AN control according to phylink Precedence: bulk X-Mailing-List: netdev@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: Wed, 04 Mar 2026 08:49:25 +0000 Provide phylink with the integrated PCS autonegotiation capabilities, and configure the PCS's AN settings according to phylink's requested requirements. This may cause regressions. Signed-off-by: Russell King (Oracle) --- .../net/ethernet/stmicro/stmmac/stmmac_pcs.c | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c index ba0cf51e67f7..0f9616fad4ef 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c @@ -32,6 +32,9 @@ static unsigned int dwmac_integrated_pcs_inband_caps(struct phylink_pcs *pcs, struct stmmac_pcs *spcs = phylink_pcs_to_stmmac_pcs(pcs); unsigned int ib_caps; + if (interface == PHY_INTERFACE_MODE_SGMII) + return LINK_INBAND_ENABLE | LINK_INBAND_DISABLE; + if (phy_interface_mode_is_8023z(interface)) { ib_caps = LINK_INBAND_DISABLE; @@ -139,22 +142,29 @@ static int dwmac_integrated_pcs_config(struct phylink_pcs *pcs, bool permit_pause_to_mac) { struct stmmac_pcs *spcs = phylink_pcs_to_stmmac_pcs(pcs); - bool changed = false, ane = true; + void __iomem *an_control = spcs->base + GMAC_AN_CTRL(0); + bool ane, changed = false; + u32 ctrl; + + ane = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED; /* Only configure the advertisement and allow AN in BASE-X mode if * the core supports TBI/RTBI. AN will be filtered out by via phylink * and the .pcs_inband_caps() method above. */ if (phy_interface_mode_is_8023z(interface) && - spcs->support_tbi_rtbi) { - ane = neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED; - + spcs->support_tbi_rtbi) changed = dwmac_integrated_pcs_config_aneg(spcs, interface, advertising); - } - dwmac_ctrl_ane(spcs->base, 0, ane, - spcs->priv->hw->reverse_sgmii_enable); + ctrl = readl(an_control) & ~(GMAC_AN_CTRL_ANE | GMAC_AN_CTRL_SGMRAL); + if (spcs->priv->hw->reverse_sgmii_enable) + ctrl |= GMAC_AN_CTRL_SGMRAL | GMAC_AN_CTRL_ANE; + else if (ane) + ctrl |= GMAC_AN_CTRL_ANE; + else + ctrl |= GMAC_AN_CTRL_SGMRAL; + writel(ctrl, an_control); return changed; } -- 2.47.3