Auto-probe of c45 devices with extended scanning in xgmac_mdio works well but fails to update device "fwnode" while registering PHYs on MDIO bus. This patch is based on https://www.spinics.net/lists/netdev/msg662173.html
This change will update the "fwnode" while PHYs get registered and allow lookup for registered PHYs on MDIO bus from other drivers while probing. Signed-off-by: Vikas Singh <vikas.si...@puresoftware.com> --- drivers/net/phy/mdio_bus.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c index 46b3370..7275eff 100644 --- a/drivers/net/phy/mdio_bus.c +++ b/drivers/net/phy/mdio_bus.c @@ -447,8 +447,25 @@ static void of_mdiobus_link_mdiodev(struct mii_bus *bus, struct device *dev = &mdiodev->dev; struct device_node *child; - if (dev->of_node || !bus->dev.of_node) + if (dev->of_node || !bus->dev.of_node) { + /* Checking for acpi node, before returning */ + struct fwnode_handle *fwnode; + + /* Set the device firmware node to look for child nodes */ + bus->dev.fwnode = bus->parent->fwnode; + + device_for_each_child_node(&bus->dev, fwnode) { + int addr; + + if (fwnode_property_read_u32(fwnode, "reg", &addr)) + continue; + if (addr == mdiodev->addr) { + dev->fwnode = fwnode; + break; + } + } return; + } for_each_available_child_of_node(bus->dev.of_node, child) { int addr; -- 2.7.4