mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>,
	UNGLinuxDriver@microchip.com, davem@davemloft.net,
	edumazet@google.com, gregkh@linuxfoundation.org,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org,
	lucas.demarchi@intel.com, mcgrof@kernel.org,
	netdev@vger.kernel.org, pabeni@redhat.com,
	woojung.huh@microchip.com
Subject: Re: [PATCH] net: usb: lan78xx: add weak dependency with micrel phy module
Date: Fri, 26 Jul 2024 23:15:43 +0200	[thread overview]
Message-ID: <fc40244c-b26f-421e-8387-98c7f9f0c8ca@lunn.ch> (raw)
In-Reply-To: <20240726074925.1c7df571@kernel.org>

> 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

  reply	other threads:[~2024-07-26 21:15 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-24 10:23 Jose Ignacio Tornos Martinez
2024-07-24 11:49 ` Andrew Lunn
2024-07-24 13:36   ` Greg KH
2024-07-24 14:46     ` Jose Ignacio Tornos Martinez
2024-07-24 15:31       ` Florian Fainelli
2024-07-24 14:54     ` Jose Ignacio Tornos Martinez
2024-07-24 16:10       ` Jose Ignacio Tornos Martinez
2024-07-24 22:57         ` Andrew Lunn
2024-07-25  4:25           ` Lucas De Marchi
2024-07-25  4:42             ` Florian Fainelli
2024-07-25  6:50               ` Lucas De Marchi
2024-07-25  9:53                 ` Paolo Abeni
2024-07-26 11:33                   ` Andrew Lunn
2024-07-26 12:15                     ` Jose Ignacio Tornos Martinez
2024-07-26 20:59                       ` Andrew Lunn
2024-07-27 17:15                         ` Dragan Simic
2024-07-27 23:29                           ` Andrew Lunn
2024-07-28 14:10                             ` Dragan Simic
2024-07-28 19:45                               ` Andrew Lunn
2024-07-28 20:46                                 ` Dragan Simic
2024-07-28 20:57                                   ` Andrew Lunn
2024-07-29  4:43                                     ` Dragan Simic
2024-07-29  6:13                                       ` Greg KH
2024-07-29  6:29                                         ` Dragan Simic
2024-07-29  8:34                                           ` Jose Ignacio Tornos Martinez
2024-07-29  9:28                                             ` Dragan Simic
2024-07-29 12:32                                               ` Jose Ignacio Tornos Martinez
2024-07-29 18:56                                                 ` Andrew Lunn
2024-07-30  7:55                                                   ` Jose Ignacio Tornos Martinez
2024-07-28  7:37                       ` Masahiro Yamada
2024-07-28  9:53                         ` Dragan Simic
2024-07-26 14:49           ` Jakub Kicinski
2024-07-26 21:15             ` Andrew Lunn [this message]
2024-07-29  8:37               ` Jose Ignacio Tornos Martinez
2024-07-29 12:42                 ` Andrew Lunn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fc40244c-b26f-421e-8387-98c7f9f0c8ca@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=UNGLinuxDriver@microchip.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jtornosm@redhat.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=lucas.demarchi@intel.com \
    --cc=mcgrof@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=woojung.huh@microchip.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®