net: stmmac: Skip PHY attach if custom PCS is in use

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: f0ef433fc2 ("net: stmmac: introduce pcs_init/pcs_exit stmmac operations")
Signed-off-by: Zxyan Zhu <zxyan0222@gmail.com>
Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Link: https://patch.msgid.link/20260729074237.2624940-2-zxyan0222@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Zxyan Zhu 2026-07-29 15:42:36 +08:00 committed by Jakub Kicinski
parent 5aed8f4044
commit af4d934164

View File

@ -1330,6 +1330,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;
}