Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v3 0/2] net: stmmac: Fix PHY attach when custom PCS is in use
@ 2026-07-29  7:42 Zxyan Zhu
  2026-07-29  7:42 ` [PATCH net-next v3 1/2] net: stmmac: Skip PHY attach if " Zxyan Zhu
  2026-07-29  7:42 ` [PATCH net-next v3 2/2] net: phylink: allow PHYs to be attached in 802.3z inband mode Zxyan Zhu
  0 siblings, 2 replies; 3+ messages in thread
From: Zxyan Zhu @ 2026-07-29  7:42 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

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 skips the PHY attach in stmmac when a custom PCS is already
configured via priv->hw->phylink_pcs and phy_addr is invalid, avoiding
the "no phy found" error for platforms that manage link state entirely
through the PCS.

Patch 2 is Russell King's phylink patch that relaxes phylink_expects_phy()
to allow PHYs to be attached in 802.3z inband mode.

v3:
- Move the priv->hw->phylink_pcs check inside the "addr < 0" branch
  to avoid skipping the phy_addr fallback for boards with both a PCS
  and a PHY
- Reverse patch order: stmmac fix first, phylink change second

v2:
- Include Russell's phylink patch as prerequisite
- This is now a 2-patch series targeting net-next

Zxyan Zhu (1):
  net: stmmac: Skip PHY attach if custom PCS is in use

Russell King (Oracle) (1):
  net: phylink: allow PHYs to be attached in 802.3z inband mode

 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++++
 drivers/net/phy/phylink.c                         | 8 ++------
 2 files changed, 6 insertions(+), 6 deletions(-)

-- 
2.34.1



^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH net-next v3 1/2] net: stmmac: Skip PHY attach if custom PCS is in use
  2026-07-29  7:42 [PATCH net-next v3 0/2] net: stmmac: Fix PHY attach when custom PCS is in use Zxyan Zhu
@ 2026-07-29  7:42 ` Zxyan Zhu
  2026-07-29  7:42 ` [PATCH net-next v3 2/2] net: phylink: allow PHYs to be attached in 802.3z inband mode Zxyan Zhu
  1 sibling, 0 replies; 3+ messages in thread
From: Zxyan Zhu @ 2026-07-29  7:42 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, 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 set and
phy_addr is invalid.

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..575132b9cdbf 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -1347,6 +1347,10 @@ static int stmmac_init_phy(struct net_device *dev)
 		struct phy_device *phydev;
 
 		if (addr < 0) {
+			/* If a custom PCS is in use, no PHY is needed */
+			if (priv->hw->phylink_pcs)
+				return 0;
+
 			netdev_err(priv->dev, "no phy found\n");
 			return -ENODEV;
 		}
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH net-next v3 2/2] net: phylink: allow PHYs to be attached in 802.3z inband mode
  2026-07-29  7:42 [PATCH net-next v3 0/2] net: stmmac: Fix PHY attach when custom PCS is in use Zxyan Zhu
  2026-07-29  7:42 ` [PATCH net-next v3 1/2] net: stmmac: Skip PHY attach if " Zxyan Zhu
@ 2026-07-29  7:42 ` Zxyan Zhu
  1 sibling, 0 replies; 3+ messages in thread
From: Zxyan Zhu @ 2026-07-29  7:42 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 59dfe35afa54..fd4e80eeeda7 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -1964,9 +1964,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;
 }
@@ -2205,9 +2203,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] 3+ messages in thread

end of thread, other threads:[~2026-07-29  7:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-29  7:42 [PATCH net-next v3 0/2] net: stmmac: Fix PHY attach when custom PCS is in use Zxyan Zhu
2026-07-29  7:42 ` [PATCH net-next v3 1/2] net: stmmac: Skip PHY attach if " Zxyan Zhu
2026-07-29  7:42 ` [PATCH net-next v3 2/2] net: phylink: allow PHYs to be attached in 802.3z inband mode Zxyan Zhu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox