lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <fc40244c-b26f-421e-8387-98c7f9f0c8ca@lunn.ch>
Date: Fri, 26 Jul 2024 23:15:43 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Jakub Kicinski <kuba@...nel.org>
Cc: Jose Ignacio Tornos Martinez <jtornosm@...hat.com>,
	UNGLinuxDriver@...rochip.com, davem@...emloft.net,
	edumazet@...gle.com, gregkh@...uxfoundation.org,
	linux-kernel@...r.kernel.org, linux-usb@...r.kernel.org,
	lucas.demarchi@...el.com, mcgrof@...nel.org, netdev@...r.kernel.org,
	pabeni@...hat.com, woojung.huh@...rochip.com
Subject: Re: [PATCH] net: usb: lan78xx: add weak dependency with micrel phy
 module

> 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ