Hi Florian, 1. Let's go back to original topic, Can we move all mdio dirvers into drivers/net/mdio ? Last time you said half convinced. If you insist not do it, l will follow your decision.
2. Per may understanding, I don't know why create a struct mii_bus instance to represent a mdio device in current mdio driver. Why not create a struct mdio_device instance, it's easy to understand. (We can move part of member of mii_bus to mdio_device). Then in mdio layer, there will mdio_device and mdio_driver. Other module(dsa) base on mdio should not register mdio_driver directly. thanks > -----Original Message----- > From: Florian Fainelli [mailto:f.faine...@gmail.com] > Sent: Tuesday, February 21, 2017 6:31 AM > 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 > > > > 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