[PATCH net v2 2/2] net: ibm: emac: read the fixed-link status before adjusting the link

From: Linkui Xiao

Date: Mon Nov 23 2026 - 04:33:13 EST


From: Linkui Xiao <xiaolinkui@xxxxxxxxxx>

For a fixed link emac_init_phy() calls emac_adjust_link() once to copy
the link parameters from the phy_device into dev->phy, and never starts
the PHY state machine.

That worked while fixed_phy_register() copied the device tree status into
the phy_device itself. Commit d99b408ed8e5 ("net: phy: fixed_phy: remove
not needed initialization of phy_device members") dropped that, expecting
the state machine to fill the members in once the PHY is started. EMAC
does not start it, so emac_adjust_link() now copies SPEED_UNKNOWN and
DUPLEX_UNKNOWN, and emac_configure() programs the MAC for 10 Mbit/s half
duplex with flow control off, whatever the fixed-link property says.

Read the status once after attaching, as emac_mdio_read_link() already
does for the phy-handle path. The PHY is emulated, so genphy_read_status()
resolves speed, duplex and pause from the registers swphy generates out of
the device tree status.

Fixes: d99b408ed8e5 ("net: phy: fixed_phy: remove not needed initialization of phy_device members")
Signed-off-by: Linkui Xiao <xiaolinkui@xxxxxxxxxx>
---
drivers/net/ethernet/ibm/emac/core.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
index ba02cf878a12..8b9ffbcd2ff4 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -2677,9 +2677,16 @@ static int emac_init_phy(struct emac_instance *dev)
return res;

if (!of_phy_connect(ndev, np, &emac_adjust_link, 0,
- dev->phy_mode)) {
+ dev->phy_mode))
+ res = -EINVAL;
+ else
+ res = phy_read_status(ndev->phydev);
+
+ if (res) {
+ if (ndev->phydev)
+ phy_disconnect(ndev->phydev);
of_phy_deregister_fixed_link(np);
- return -EINVAL;
+ return res;
}

emac_adjust_link(ndev);
--
2.25.1