If we point to a PHY node by phandle, that PHY might well be on a MDIO bus that hasn't been scanned when we look for the PHY. Fortunately we know exactly where to look for the PHY, so make sure to scan the bus at the right address. Signed-off-by: Lucas Stach <l.stach@xxxxxxxxxxxxxx> --- v2: Only enter MII bus loop when the address property was found. --- drivers/net/phy/phy.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index 35a9ce7ea823..2b8fa63c0641 100644 --- a/drivers/net/phy/phy.c +++ b/drivers/net/phy/phy.c @@ -319,6 +319,8 @@ static struct phy_device *of_mdio_find_phy(struct eth_device *edev) { struct device_d *dev; struct device_node *phy_node; + struct mii_bus *bus; + int addr; if (!IS_ENABLED(CONFIG_OFDEVICE)) return NULL; @@ -340,6 +342,16 @@ static struct phy_device *of_mdio_find_phy(struct eth_device *edev) if (!phy_node) return NULL; + if (!of_property_read_u32(phy_node, "reg", &addr)) { + for_each_mii_bus(bus) { + if (bus->parent->device_node == phy_node->parent) { + struct phy_device *phy = mdiobus_scan(bus, addr); + if (!IS_ERR(phy)) + return phy; + } + } + } + bus_for_each_device(&mdio_bus_type, dev) { if (dev->device_node == phy_node) return container_of(dev, struct phy_device, dev); -- 2.11.0 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox