From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
To: Andrew Lunn <andrew@lunn.ch>, Heiner Kallweit <hkallweit1@gmail.com>
Cc: Alexandre Torgue <alexandre.torgue@foss.st.com>,
"Alexis Lothor__" <alexis.lothore@bootlin.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
Boon Khai Ng <boon.khai.ng@altera.com>,
Daniel Machon <daniel.machon@microchip.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>, Furong Xu <0x1207@gmail.com>,
Jacob Keller <jacob.e.keller@intel.com>,
Jakub Kicinski <kuba@kernel.org>,
linux-arm-kernel@lists.infradead.org,
linux-stm32@st-md-mailman.stormreply.com,
Maxime Chevallier <maxime.chevallier@bootlin.com>,
Maxime Coquelin <mcoquelin.stm32@gmail.com>,
netdev@vger.kernel.org, Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Yu-Chun Lin <eleanor15x@gmail.com>
Subject: [PATCH net-next 1/3] net: stmmac: configure AN control according to phylink
Date: Sat, 25 Oct 2025 21:48:47 +0100 [thread overview]
Message-ID: <E1vClBv-0000000BcbP-0Qd1@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <aP03aQLADMg-J_4W@shell.armlinux.org.uk>
Provide phylink with the autonegotiation capabilities for this PCS, and
configure the PCS's AN settings according to phylink's requested
requirements.
This may cause regressions.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
.../net/ethernet/stmicro/stmmac/stmmac_pcs.c | 23 +++++++++++++++++--
1 file changed, 21 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c
index e2f531c11986..77d38936d898 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pcs.c
@@ -2,6 +2,15 @@
#include "stmmac.h"
#include "stmmac_pcs.h"
+static unsigned int dwmac_integrated_pcs_inband_caps(struct phylink_pcs *pcs,
+ phy_interface_t interface)
+{
+ if (interface != PHY_INTERFACE_MODE_SGMII)
+ return 0;
+
+ return LINK_INBAND_ENABLE | LINK_INBAND_DISABLE;
+}
+
static int dwmac_integrated_pcs_enable(struct phylink_pcs *pcs)
{
struct stmmac_pcs *spcs = phylink_pcs_to_stmmac_pcs(pcs);
@@ -32,13 +41,23 @@ 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);
-
- dwmac_ctrl_ane(spcs->base, 0, 1, spcs->priv->hw->reverse_sgmii_enable);
+ void __iomem *an_control = spcs->base + GMAC_AN_CTRL(0);
+ u32 ctrl;
+
+ 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 (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED)
+ ctrl |= GMAC_AN_CTRL_ANE;
+ else
+ ctrl |= GMAC_AN_CTRL_SGMRAL;
+ writel(ctrl, an_control);
return 0;
}
static const struct phylink_pcs_ops dwmac_integrated_pcs_ops = {
+ .pcs_inband_caps = dwmac_integrated_pcs_inband_caps,
.pcs_enable = dwmac_integrated_pcs_enable,
.pcs_disable = dwmac_integrated_pcs_disable,
.pcs_get_state = dwmac_integrated_pcs_get_state,
--
2.47.3
next prev parent reply other threads:[~2025-10-25 20:48 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-25 20:47 [PATCH net-next 0/3] net: stmmac: phylink PCS conversion part 3 (dodgy stuff) Russell King (Oracle)
2025-10-25 20:48 ` Russell King (Oracle) [this message]
2025-10-25 20:48 ` [PATCH net-next 2/3] net: stmmac: report PCS configuration changes Russell King (Oracle)
2025-10-25 20:48 ` [PATCH net-next 3/3] net: stmmac: add support specifying PCS supported interfaces Russell King (Oracle)
2025-10-28 10:16 ` Maxime Chevallier
2025-10-28 10:35 ` Russell King (Oracle)
2025-10-28 10:40 ` Russell King (Oracle)
2025-10-28 11:26 ` Maxime Chevallier
2025-10-28 21:12 ` [PATCH net-next 0/3] net: stmmac: phylink PCS conversion part 3 (dodgy stuff) Mohd Ayaan Anwar
2025-10-29 9:22 ` Russell King (Oracle)
2025-10-30 13:20 ` Mohd Ayaan Anwar
2025-10-30 15:19 ` Russell King (Oracle)
2025-10-30 15:22 ` Russell King (Oracle)
2025-11-03 8:58 ` Mohd Ayaan Anwar
2025-11-03 9:52 ` Russell King (Oracle)
2025-11-03 10:18 ` Mohd Ayaan Anwar
2025-11-03 10:47 ` Russell King (Oracle)
2025-11-03 10:48 ` Vladimir Oltean
2025-11-03 11:20 ` Mohd Ayaan Anwar
2025-11-03 11:43 ` Russell King (Oracle)
2025-11-03 12:13 ` Vladimir Oltean
2025-11-03 14:47 ` Mohd Ayaan Anwar
2025-11-03 17:15 ` Russell King (Oracle)
2025-11-03 17:02 ` Russell King (Oracle)
2025-11-03 12:17 ` Mohd Ayaan Anwar
2025-11-03 17:13 ` Russell King (Oracle)
2025-11-05 15:46 ` Mohd Ayaan Anwar
2025-11-05 18:12 ` Russell King (Oracle)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1vClBv-0000000BcbP-0Qd1@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=0x1207@gmail.com \
--cc=alexandre.torgue@foss.st.com \
--cc=alexis.lothore@bootlin.com \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=boon.khai.ng@altera.com \
--cc=daniel.machon@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eleanor15x@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=horms@kernel.org \
--cc=jacob.e.keller@intel.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-stm32@st-md-mailman.stormreply.com \
--cc=maxime.chevallier@bootlin.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).