Re: [PATCH net v3] net: ibm: emac: attach and start the fixed-link PHY

From: Andrew Lunn

Date: Tue Nov 24 2026 - 08:51:12 EST


On Tue, Nov 24, 2026 at 04:39:41PM +0800, Linkui Xiao wrote:
> From: Linkui Xiao <xiaolinkui@xxxxxxxxxx>
>
> emac_init_phy() sets ndev->phydev by hand for a fixed link, so
> phy_attach_direct() never runs. The PHY is missing from the netdev's PHY
> link topology and ETHTOOL_MSG_PHY_GET dereferences the NULL link_topo in
> phy_prepare_data().
>
> Attach it with of_phy_connect(), as this driver already does for the
> phy-handle case and as gianfar, fec, davinci_emac and nixge do, and start
> it with phy_start().

There is also a call to phy_start() in emac_mdio_init_phy(). If that
is how a real PHY is started, a fixed link PHY should be started in
the same way.

However, this code is a horrible mix of phylib and mii. It really
needs a rewrite to make it pure phylib, or ideally phylink.

Andrew