On Fri, Jun 23, 2023 at 12:29:19PM +0200, Michael Walle wrote:
...
@@ -178,24 +209,26 @@ int __of_mdiobus_register(struct mii_bus *mdio, struct device_node *np,
if (rc)
return rc;
- /* Loop over the child nodes and register a phy_device for each phy */
+ /* Loop over the child nodes, skipping C45 PHYs so we can scan for
+ * broken C22 PHYs. The C45 PHYs will be registered afterwards.
+ */
for_each_available_child_of_node(np, child) {
- addr = of_mdio_parse_addr(&mdio->dev, child);
- if (addr < 0) {
- scanphys = true;
+ if (of_mdiobus_child_is_c45_phy(child))
continue;
- }
+ rc = of_mdiobus_register_child(mdio, child, &scanphys);
+ if (rc)
+ goto unregister;
+ }
- if (of_mdiobus_child_is_phy(child))
- rc = of_mdiobus_register_phy(mdio, child, addr);
- else
- rc = of_mdiobus_register_device(mdio, child, addr);
+ /* Some C22 PHYs are broken with C45 transactions. */
+ mdiobus_scan_for_broken_c45_access(mdio);
Hi Michael,
Unfortunately this seems to cause a build fauilure
for x86_64 allmodconfig.
ERROR: modpost: "mdiobus_scan_for_broken_c45_access" [drivers/net/mdio/of_mdio.ko] undefined!