driving Eth PHYs as udevices

Alexandru Marginean alexm.osslist at gmail.com
Tue Dec 3 13:14:13 CET 2019


Hi,

does anyone have any strong feelings either way about the idea of 
driving Eth PHYs as udevices?
I'm looking for a solution for a few problems:
- There are a few Eth switches that are accessed over MDIO and 
could/should be driven as DSA switches instead of PHYs.  This requires 
that MDIO does probing of child devices like any regular bus and doesn't 
assume they are all PHYs.  Also it requires that MDIO enumerates (at 
least some) of its children instead of wating for an Eth device to come 
connect to a specific PHY/addr.
- PHY scanning using empty 'reg' in PHY DT nodes works for anything more 
complicated than a single PHY on the bus only only if there is some 
state in the bus.  In Linux child nodes with valid reg are bound first 
and then any others left are associated with PHYs found scanning.  This 
doesn't work if there is no enumeration on the MDIO bus and it just 
waits for Eth drivers to connect to PHYs.
- there are a few other peculiarities with current PHY support, 
mentioned by Grygorii on this list, like phy probe being called before 
its DT node was populated in phydev structure.  Using the regular 
udevice infrastructure should fix that and make PHYs consistent with 
just about anything else.

What I'm thinking to do is to enumerate all child DT nodes when MDIO is 
probed and bind drivers to them.  If some are missing the 'reg' property 
the bus is scanned.
The devices associated with DT child nodes are bound to drivers, probed, 
if they are PHYs then they have to wait for someone to come connect to 
them, but if they are switches or anything else they are set up as expected.

Thoughts?
Alex


More information about the U-Boot mailing list