Re: [PATCH net v1] net: phy: motorcomm: yt8821: disable MDIO broadcast address 0

From: Andrew Lunn

Date: Sat Feb 21 2026 - 19:17:33 EST


On Sun, Feb 22, 2026 at 12:46:53AM +0100, Jakub Vaněk wrote:
> The YT8821 PHY responds on two MDIO addresses by default: the address
> selected by its strapping pins and the broadcast address 0.
>
> On platforms where another PHY is hardwired to respond only on address 0
> (e.g. the internal Gigabit PHY in the MediaTek MT7981B SoC), this can lead
> to MDIO bus conflicts. The YT8821 may incorrectly respond to transactions
> intended for the other PHY, leaving it in an inconsistent state. The
> following issues were observed on a Cudy M3000 router:

I don't think you can reliably fix this in this way.

Linux enumerates and probes the bus in two different ways.

When mdiobus_register() is used, it enumerates the bus in address
order. So the probe of the internal Gigabit PHY will happen first at
address 0, and then the YT8821 will later be probed, by which times it
has already caused bus conflicts and potentially messed up the
internal PHY.

If of_mdiobus_register() is used, it first probes the PHYs listed in
DT, based on the order of the child nodes. If the child nodes are
first reg=<0> for the internal PHY, and then reg=<??> for the YT8821,
you have the same issue, bus conflicts. And ordering the nodes this
way is part of the DT coding style...

Now you could vary carefully put the nodes in the correct order, with
a big fat warning that the board design is FUBAR and will only work
with the nodes in this specific order. And you need another big fat
warning in the YT8821 driver that just because broadcast is turned off
at probe does not on its own make it reliable, it could of already
destroyed another PHYs configuration by the time the driver probes.

So to me, this sounds unreliable, a potential foot gun.

I can think of two better ways to fix this:

1) In the bootloader. If the bootloader supports TFTP booting, or any
networking, it needs to fix the same issue. It can poke around on the
MDIO bus before it probes the PHYs.

2) Split of_mdiobus_register() into two, so that you can register the
bus, then do some platform specific fixups to disable the broadcast
address in the PHY, and then do the second half of
of_mdiobus_register() which probes the PHYs, once it is safe to use
address 0 on the bus.

I prefer 1).

Andrew