Re: [PATCH] net: usb: lan78xx: add weak dependency with micrel phy module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> For MDIO are the ID registers too complicated to expose to user space
> and let it match the drivers using modinfo (avoiding the need to boot
> a kitchen sink kernel)?

That is how it actually works for MDIO. Mostly.

We read the ID from register 2 and 3. That gives us a 32 bit
value. That gets turned into a binary string. Which is then matched
against what is in modules.alias

alias mdio:0000000000100010010101010010???? amd
alias mdio:0011000111000011000111001011???? aquantia
alias mdio:0011000111000011000111000001???? aquantia
alias mdio:0011000111000011000111000100???? aquantia

The ? means the value of the bit does not matter. The least
significant nibble is often the revision of the PHY and the driver can
driver any revision.

The 'mostly' is because some PHYs need help from the driver to enable
clocks etc before you can read register 2 and 3. A chicken/egg
problem. So you can put the ID in device tree, and the exact same
lookup is performed to load the driver.

It gets a bit more complex with C45 devices, because they have
multiple ID registers. But the same basic lookup is performed using
them one by one until a driver is found.

You can also find the C22 ID which matched the driver in
/sys/bus/mdio_bus/devices/*/phy_id.

       Andrew




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux