Merge branch 'net-stmmac-fix-phy-attach-when-custom-pcs-is-in-use'

Zxyan Zhu says:

====================
net: stmmac: Fix PHY attach when custom PCS is in use

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.
====================

Link: https://patch.msgid.link/20260729074237.2624940-1-zxyan0222@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Jakub Kicinski
2026-08-03 16:49:36 -07:00
2 changed files with 6 additions and 6 deletions

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;
}

View File

@@ -1965,9 +1965,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;
}
@@ -2206,9 +2204,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)