Re: [PATCH net] net: ibm: emac: attach the fixed-link PHY with of_phy_connect()

From: Linkui Xiao

Date: Mon Nov 23 2026 - 04:11:32 EST


Hi Andrew,

Thanks for the review, and for pointing out the missing teardown.

> This commit message is overly verbose and contains a lot of irrelevant
> information.

Agreed. v2 1/2 is three paragraphs: what breaks, why of_phy_connect(), and
why the new phy_disconnect() calls belong in the same change. I dropped the
walk through phy_prepare_data(), the list of other drivers, the archaeology
about 08e39982ef64, and the "no in-tree DTS does this" paragraph. The cover
letter notes the AI assistance per
Documentation/process/generated-content.rst.

> Why is emacs_adjust_link() still called?

of_phy_connect() only stores the handler in phydev->adjust_link, attach
never calls it. The state machine is not started on this path either -
emac_mdio_init_phy() runs only for the phy-handle case - so nothing else
fills in dev->phy, which emac_configure() reads to build MR1. A fixed link
cannot change, so calling it once is enough.

Answering that turned up a second bug. Since d99b408ed8e5 ("net: phy:
fixed_phy: remove not needed initialization of phy_device members") the
phy_device no longer carries the DT status, so that call currently copies
SPEED_UNKNOWN and DUPLEX_UNKNOWN and the MAC is programmed for 10 Mbit/s
half duplex. That is 2/2 of v2, which adds a phy_read_status() after the
attach. emac_mdio_read_link() already does exactly that for the phy-handle
path.

> This last sentence about phy_disconnect() was one of the things i thought
> about while looking at the change, but because the commit messages was so
> long, i had given up reading it....

Fair, and leaving it out was the wrong call: this patch is what creates the
attached state, so it should also tear it down. v2 calls phy_disconnect() in
emac_remove() and at err_detach_tah, and of_phy_deregister_fixed_link() in
both places, plus the connect failure branch. That also fixes the
phy-handle path, which called phy_start() without ever calling phy_stop().
emac_remove() unregisters the netdev first, so detaching without RTNL is
fine.

v2 is posted as a new thread: [PATCH net v2 0/2].

Cross compiled for powerpc with W=1 out of ppc44x_defconfig, clean. No
hardware here, so no runtime test.

Thanks,
Linkui