[PATCH net-next v2 2/2] net: stmmac: Skip PHY attach if custom PCS is in use

Maxime Chevallier maxime.chevallier at bootlin.com
Tue Jul 28 23:22:08 PDT 2026


Hi,

I think sashiko's are correct that we can err on the safe side and move
the check inside the "if (addr < 0)" check (even though I don't think we
have platforms with a PCS but no fwnode-described PHYs, but just to be
safe).

Also, sashiko reports an issue on patch 1 that this exact patch is solving, so
you may want to re-send but with patches in the reverse order.

Maxime

On 7/26/26 15:26, Zxyan Zhu wrote:
> 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 at 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;




More information about the linux-arm-kernel mailing list