On 02/19/2017 10:29 PM, YUAN Linyu wrote: > > >> -----Original Message----- >> From: Florian Fainelli [mailto:f.faine...@gmail.com] >> Sent: Monday, February 20, 2017 1:42 PM >> To: YUAN Linyu; David S . Miller; Andrew Lunn >> Cc: netdev@vger.kernel.org; cug...@163.com >> Subject: Re: create drivers/net/mdio and move mdio drivers into it >>> 4. support mdio auto probe phy device. >> >> That's already the case, even in a Device Tree enabled system if you >> omit to provide a "reg" property for child nodes, the bus is >> automatically scanned. >> > I check of_mdiobus_registe() which not do auto scan. > Which function should I refer?
of_mdiobus_register() does this: /* Loop over the child nodes and register a phy_device for each phy */ for_each_available_child_of_node(np, child) { addr = of_mdio_parse_addr(&mdio->dev, child); if (addr < 0) { scanphys = true; continue; } if (of_mdiobus_child_is_phy(child)) of_mdiobus_register_phy(mdio, child, addr); else of_mdiobus_register_device(mdio, child, addr); } if (!scanphys) return 0; It does continue with scanning the PHY child nodes which don't have a correct "reg" property set here. -- Florian