[PATCH 1/3] mdio-uclass.c: support fixed-link subnodes

Rasmus Villemoes rasmus.villemoes at prevas.dk
Tue Oct 6 08:21:40 CEST 2020


On 06/10/2020 08.02, Heiko Schocher wrote:
> Hello Rasmus,
> 
> Am 05.10.2020 um 15:15 schrieb Rasmus Villemoes:
>> When trying to port our mpc8309-based board to DM_ETH, on top of
>> Heiko's patches, I found that nothing in mdio-uclass.c seems to
>> support the use of a fixed-link subnode of the ethernet DT node. That
>> is, the ethernet node looks like
>>
>>         enet0: ethernet at 2000 {
>>             device_type = "network";
>>             compatible = "ucc_geth";
>>             ...
>>             fixed-link {
>>                 reg = <0xffffffff>;

Well, it looks like that when a dummy reg property has been added, not
IRL. Sorry.

>> ---
>>   net/mdio-uclass.c | 7 +++++++
>>   1 file changed, 7 insertions(+)
>>
>> diff --git a/net/mdio-uclass.c b/net/mdio-uclass.c
>> index 66ee2e1976..2f932b77df 100644
>> --- a/net/mdio-uclass.c
>> +++ b/net/mdio-uclass.c
>> @@ -139,6 +139,12 @@ static struct phy_device
>> *dm_eth_connect_phy_handle(struct udevice *ethdev,
>>       struct ofnode_phandle_args phandle = {.node = ofnode_null()};
>>       int i;
>>   +    if (CONFIG_IS_ENABLED(PHY_FIXED) &&
>> +        ofnode_valid(dev_read_subnode(ethdev, "fixed-link"))) {
>> +        phy = phy_connect(NULL, -1, ethdev, interface);
>> +        goto out;
>> +    }
>> +
>>       for (i = 0; i < PHY_HANDLE_STR_CNT; i++)
>>           if (!dev_read_phandle_with_args(ethdev, phy_handle_str[i],
>> NULL,
>>                           0, 0, &phandle))
>> @@ -168,6 +174,7 @@ static struct phy_device
>> *dm_eth_connect_phy_handle(struct udevice *ethdev,
>>         phy = dm_mdio_phy_connect(mdiodev, phy_addr, ethdev, interface);
>>   +out:
>>       if (phy)
>>           phy->node = phandle.node;
> 
> Looks good to me... but I am not an expert in net subsystem...
> nevertheless:
> 
> Reviewed-by: Heiko Schocher <hs at denx.de>

Thanks.

Yeah, as I said, I have no idea if this is the right way to do things.
Some ethernet drivers seem to call phy_connect directly instead of going
through dm_eth_phy_connect(), some handle fixed-link themselves, etc.
But from a very selfish POV, this is the minimal patch to make our board
(and others with a ucc_geth ethernet dev with a fixed-link) work with
DM_ETH.

Rasmus


More information about the U-Boot mailing list