Re: [net-next RFC PATCH v2 2/3] net: phy: Add support for Aeonsemi AS21xxx PHYs

From: Russell King (Oracle)
Date: Wed Mar 26 2025 - 14:08:40 EST


On Wed, Mar 26, 2025 at 03:56:15PM +0100, Andrew Lunn wrote:
> After the firmware download, the phylib core will still have the wrong
> ID values. So you cannot use PHY_ID_MATCH_EXACT(PHY_ID_AS21011JB1).
> But what you can do is have a .match_phy_device function. It will get
> called, and it can read the real ID from the device, and perform a
> match. If it does not match return -ENODEV, and the core will try the
> next entry.

Before it returns -ENODEV, it could re-read the ID values and fill
them into struct phy_device. This would allow phylib's matching to
work.

> You either need N match_phy_device functions, one per ID value, or you
> can make use of the .driver_data in phy_driver, and place the matching
> data there.

An alternative would be to change the match_phy_device() method to
pass the phy_driver, which would allow a single match_phy_device
function to match the new hardware ID values against the PHY IDs in
the phy_driver without needing to modify the IDs in phy_device.

--
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!