* [PATCH net-next v2 1/2] net: phylink: allow PHYs to be attached in 802.3z inband mode
2026-07-26 13:26 [PATCH net-next v2 0/2] net: stmmac: Fix PHY attach when custom PCS is in use Zxyan Zhu
@ 2026-07-26 13:26 ` Zxyan Zhu
2026-07-26 13:26 ` [PATCH net-next v2 2/2] net: stmmac: Skip PHY attach if custom PCS is in use Zxyan Zhu
2026-07-27 6:49 ` [PATCH net-next v2 0/2] net: stmmac: Fix PHY attach when " Maxime Chevallier
2 siblings, 0 replies; 4+ messages in thread
From: Zxyan Zhu @ 2026-07-26 13:26 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Maxime Coquelin, Alexandre Torgue, Russell King,
Russell King, Maxime Chevallier, Serge Semin, Romain Gantois,
Hariprasad Kelam, linux-stm32, linux-arm-kernel, linux-kernel,
Zxyan Zhu
From: "Russell King (Oracle)" <rmk+kernel@armlinux.org.uk>
Now that we have proper decision making for inband mode support which
makes it a "best efforts" feature based on the capabilities of the PHY
and PCS, we can relax whether we expect and permit a PHY to be
attached. This is especially true for the 2500BASE-X case which some
PHYs use without inband on their host side interface for 2.5G speeds,
but use inband for slower speeds switching to SGMII on their host side
interface.
We already have such a case for some qcom-ethqos setups, although
qcom-ethqos overrides phylink's inband settings by accessing the PCS
directly at the moment. This should allow qcom-ethqos to transition to
defaulting to inband when 2500BASE-X or SGMII is specified in its DTS.
Allow PHYs to be attached when inband mode has been specified, which
will be necessary to allow inband mode to be used on qcom-ethqos.
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Signed-off-by: Zxyan Zhu <zxyan0222@gmail.com>
---
drivers/net/phy/phylink.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index a7f78c82913a..66dddce05afe 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1983,9 +1983,7 @@ EXPORT_SYMBOL_GPL(phylink_destroy);
*/
bool phylink_expects_phy(struct phylink *pl)
{
- if (pl->cfg_link_an_mode == MLO_AN_FIXED ||
- (pl->cfg_link_an_mode == MLO_AN_INBAND &&
- phy_interface_mode_is_8023z(pl->link_interface)))
+ if (pl->cfg_link_an_mode == MLO_AN_FIXED)
return false;
return true;
}
@@ -2224,9 +2222,7 @@ static int phylink_attach_phy(struct phylink *pl, struct phy_device *phy,
{
u32 flags = 0;
- if (WARN_ON(pl->cfg_link_an_mode == MLO_AN_FIXED ||
- (pl->cfg_link_an_mode == MLO_AN_INBAND &&
- phy_interface_mode_is_8023z(interface) && !pl->sfp_bus)))
+ if (WARN_ON(pl->cfg_link_an_mode == MLO_AN_FIXED))
return -EINVAL;
if (pl->phydev)
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* [PATCH net-next v2 2/2] net: stmmac: Skip PHY attach if custom PCS is in use
2026-07-26 13:26 [PATCH net-next v2 0/2] net: stmmac: Fix PHY attach when custom PCS is in use Zxyan Zhu
2026-07-26 13:26 ` [PATCH net-next v2 1/2] net: phylink: allow PHYs to be attached in 802.3z inband mode Zxyan Zhu
@ 2026-07-26 13:26 ` Zxyan Zhu
2026-07-27 6:49 ` [PATCH net-next v2 0/2] net: stmmac: Fix PHY attach when " Maxime Chevallier
2 siblings, 0 replies; 4+ messages in thread
From: Zxyan Zhu @ 2026-07-26 13:26 UTC (permalink / raw)
To: netdev
Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Maxime Coquelin, Alexandre Torgue, Russell King,
Russell King, Maxime Chevallier, Serge Semin, Romain Gantois,
Hariprasad Kelam, linux-stm32, linux-arm-kernel, linux-kernel,
Zxyan Zhu
When a platform provides a custom PCS via the pcs_init callback,
the MAC's phylink_pcs is already configured. In this case, phylink
validates against the PCS's supported interfaces and manages link
state through the PCS, so no traditional PHY device is needed.
Without this, stmmac_init_phy() falls through to the no-phy-node
path and errors out with "no phy found" when the DT has no
phy-handle for such interfaces.
Skip the PHY attach when priv->hw->phylink_pcs is already set and no
phy-handle is specified in the device tree.
Fixes: f0ef433fc264 ("net: stmmac: introduce pcs_init/pcs_exit stmmac operations")
Signed-off-by: Zxyan Zhu <zxyan0222@gmail.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 562d20830b94..044ed3b89247 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1346,6 +1346,10 @@ static int stmmac_init_phy(struct net_device *dev)
int addr = priv->plat->phy_addr;
struct phy_device *phydev;
+ /* If a custom PCS is in use, no PHY is needed */
+ if (priv->hw->phylink_pcs)
+ return 0;
+
if (addr < 0) {
netdev_err(priv->dev, "no phy found\n");
return -ENODEV;
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net-next v2 0/2] net: stmmac: Fix PHY attach when custom PCS is in use
2026-07-26 13:26 [PATCH net-next v2 0/2] net: stmmac: Fix PHY attach when custom PCS is in use Zxyan Zhu
2026-07-26 13:26 ` [PATCH net-next v2 1/2] net: phylink: allow PHYs to be attached in 802.3z inband mode Zxyan Zhu
2026-07-26 13:26 ` [PATCH net-next v2 2/2] net: stmmac: Skip PHY attach if custom PCS is in use Zxyan Zhu
@ 2026-07-27 6:49 ` Maxime Chevallier
2 siblings, 0 replies; 4+ messages in thread
From: Maxime Chevallier @ 2026-07-27 6:49 UTC (permalink / raw)
To: Zxyan Zhu, netdev
Cc: Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski,
Paolo Abeni, Maxime Coquelin, Alexandre Torgue, Russell King,
Russell King, Serge Semin, Romain Gantois, Hariprasad Kelam,
linux-stm32, linux-arm-kernel, linux-kernel
Hi,
On 7/26/26 15:26, Zxyan Zhu wrote:
> This series fixes the issue where stmmac platforms using a custom PCS
> via the pcs_init callback fail to probe when no phy-handle is specified
> in the device tree.
>
> Patch 1 is Russell King's phylink patch that relaxes phylink_expects_phy()
> to allow PHYs to be attached in 802.3z inband mode.
>
> Patch 2 skips the PHY attach in stmmac when a custom PCS is already
> configured via priv->hw->phylink_pcs, avoiding the "no phy found" error
> for platforms that manage link state entirely through the PCS.
I've tested this series on the board that saw the regression from Russell's
first attempt, and now with the associated stmmac patch, it works :)
Thanks for that, for the series :
Tested-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Maxime
^ permalink raw reply [flat|nested] 4+ messages in thread