net: mdio: fix duplicate registrations for phy with c45 in __of_mdiobus_register()
Subsystems (3)
PATCH 1/1 net: mdio: fix duplicate registrations for phy with c45 in __of_mdiobus_register()
Maybe mdiobus_scan_bus_c45() is called in __mdiobus_register(). Thus it should skip already registered PHYs later.
--- drivers/net/mdio/of_mdio.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/mdio/of_mdio.c +4 -0
@@ -186,6 +186,10 @@ int __of_mdiobus_register(struct mii_bus *mdio, struct device_node *np,continue ; } +/* skip already registered PHYs */ +if (mdiobus_is_registered_device (mdio, addr)) +continue ; +if (of_mdiobus_child_is_phy (child)) rc =of_mdiobus_register_phy (mdio, child, addr);else
Signature · 1 line
2.34.1
Andrew Lunn
maintainerQuoted 2 lines · Jianhui Zhao
Maybe
mdiobus_scan_bus_c45()is called in__mdiobus_register(). Thus it should skip already registered PHYs later.
Please could you expand on your commit message. I don't see what is going wrong here. What does your device tree look like? Do you have a PHY which responds to both C22 and C45?
Thanks
Andrew
PATCH 1/1 net: mdio: fix duplicate registrations for phy with c45 in __of_mdiobus_register()
In reply to Jianhui Zhao__of_mdiobus_register
__mdiobus_register
mdiobus_scan_bus_c45
of_mdiobus_child_is_phy
of_mdiobus_register_phy
fwnode_mdiobus_register_phy
is_c45 = fwnode_device_is_compatible(child, "ethernet-phy-ieee802.3-c45");
get_phy_device
phy_device_createThis is the function call chain. If a phy is already registered in mdiobus_scan_bus_c45(), and it's compatible "ethernet-phy-ieee802.3-c45", thus it will duplicated call get_phy_device later.
PATCH 1/1 net: mdio: fix duplicate registrations for phy with c45 in __of_mdiobus_register()
In reply to Jianhui ZhaoSorry, I misread the code.
Andrew Lunn
maintainerQuoted 1 line · Jianhui Zhao
Sorry, I misread the code.
So this is by code inspection, not an actual device tree booting on a board?
What should happen is that __of_mdiobus_register() has:
/* Mask out all PHYs from auto probing. Instead the PHYs listed in * the device tree are populated after the bus has been registered */ mdio->phy_mask = ~0;
So when
rc = __mdiobus_register(mdio, owner);
is called, no scanning happens. I _guess_ that is what you missed?
Andrew
Signature · 1 line
pw-bot: reject