Re: how to distinguish between PHYs that are not distinguished in the device tree?
From: <hidden>
Date: 2018-12-12 16:03:06
Quoting Andrew Lunn [off-list ref]:
On Wed, Dec 12, 2018 at 08:16:55AM -0500, rpjday@crashcourse.ca wrote:quoted
(i asked about this on the kernel newbies list earlier as a kind of puzzle but i think i really want a definitive answer so i'm taking it to the experts. (i will *try* to be concise.) imagine i'm building a bunch of 8-port switches, using PHYs from acme corp, who manufacture four different PHYs that differ only in their supported speeds, with PHY IDs that differ only in the final nybble which identifies the PHY speed: 0x1234.5671 1G 0x1234.5672 2.5G 0x1234.5675 5G 0x1234.567A 10G the problem i have is that i have been handed a bucket of mixed PHYs of all four types that are visually indistinguishable -- the only way to tell them apart is, upon system boot, i can read a given H/W register which precisely identifies the type of PHY of the four possible types. however, in this situation, all i can do is reach into the bucket, grab eight random PHYs, bolt them in, and somehow later dynamically identify them at runtime. how to do this? first, i can't identify the precise PHY ID in the device tree file since i have no idea what type will be at each of the eight PHY addresses, so i will "wildcard" the compatible value for each of them thusly (where the final nybble of zero is, of course, irrelevant): compatible = "ethernet-phy-id1234.5670"You don't need to specify any compatible string in the device tree. The PHY subsystem looks at the ID registers to determine which PHY driver to load. You only need to use ethernet-phy-id1234.5670 when the PHY has the wrong ID in its registers.
ah, that clarifies things quite a lot, thanks. rday