Re: PHY reset question

From: Florian Fainelli
Date: Wed Oct 07 2020 - 11:44:58 EST




On 10/7/2020 3:47 AM, Marco Felsch wrote:
Florian did you send a new version of those patches?

I did not because we had a good conversation with Rob over IRC and the conclusion was that the only solution that scaled across drivers, subsystems and type of resources (regulators, clocks, resets, etc.) was to have a compatible string for the given device that contains the ID. For Ethernet PHY or MDIO device nodes that is "ethernet-phyAAAA.BBBB".

When the bus determines the presence of such a compatible string it needs to bypass the dynamic identification of the device and needs to bind the PHY driver and the device instance directly. MDIO does that, and so does I2C and SPI AFAICT with the modalias/compatible (there is not a standardized way to runtime detect an I2C or SPI client anyway), while PCI and USB do not, but arguably could in the future.

For the specific use case that I had which required turning on a clock to the Ethernet PHY, I ended up modifying the firmware to provide that compatible string "ethernetAAAA.BBBB" and have the driver request the clock from its probe function:

https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/drivers/net/phy/bcm7xxx.c?id=ba4ee3c053659119472135231dbef8f6880ce1fb
--
Florian