Re: [PATCH] net: mdio: enable optional clock when registering a phy from devicetree

From: Florian Fainelli
Date: Fri Dec 01 2023 - 17:41:16 EST


On 12/1/23 06:24, Heiko Stuebner wrote:
From: Heiko Stuebner <heiko.stuebner@xxxxxxxxx>

The ethernet-phy binding (now) specifys that phys can declare a clock
supply. Phy driver itself will handle this when probing the phy-driver.

But there is a gap when trying to detect phys, because the mdio-bus needs
to talk to the phy to get its phy-id. Using actual phy-ids in the dt like
compatible = "ethernet-phy-id0022.1640",
"ethernet-phy-ieee802.3-c22";
of course circumvents this, but in turn hard-codes the phy.

But it is the established practice for situations like those where you need specific resources to be available in order to identify the device you are trying to probe/register.

You can get away here with the clock API because it can operate on device_node, and you might be able with a bunch of other "resources" subsystems, but for instance with regulators, that won't work, we need a "struct device" which won't be created because that is exactly what we are trying to do.

Also this only works for OF, not for ACPI or other yet to come firmware interface.

Sorry but NACK.

I am sympathetic to the idea that if you have multiple boards and you may have multiple PHY vendors this may not really scale, but in 2023 you have boot loaders aware of the Device Tree which can do all sorts of live DTB patching to provide the kernel with a "perfect" view of the world.
--
Florian