Subject: Re: [PATCH] net: macb: Fix regression breaking non-MDIO fixed-link PHYs

From: Andrew Lunn <[email-masked]>
Date: Thu, 16 Aug 2018 16:24:43 +0200

On Thu, Aug 16, 2018 at 08:54:40AM +0200, Ahmad Fatoum wrote:
> On 08/15/2018 04:32 AM, Andrew Lunn wrote:
> > Ahmed, where is the device tree for the EVB-KSZ9477?
> 
> I've attached it [1]. It's still work-in-progress (DSA doesn't work yet for example), but Ethernet is usable with Linux v4.18 and my patch applied.
> 

Thanks. 

So the problem is, macb does not put phy DT nodes inside an mdio
subnode. It places them directly in the MAC node. So
of_mdiobus_register() is being called with the MAC
np. of_mdiobus_register() then looks for children of the MAC node,
assuming they are phys. But when you have a fixed phy node, it is not
a phy, it does not have a reg property, and you get these warnings.

There are cases when you need both fixed-phy and a mdio bus. e.g. a
DSA switch hanging off MDIO.

So we have a few things here...

1) A regression. We should find a fix for that. Maybe we should
   special case a child node called 'fixed-link' in
   of_mdiobus_register(). I would suggest adding a single warning if
   such node is found.

2) Missing functionality. Add support for an mdio container node. 

        node = of_get_child_by_name(np, "mdio");
        if (node)
		err = of_mdiobus_register(bp->mii_bus, node);
        else 
		err = of_mdiobus_register(bp->mii_bus, np);

3) Modify the existing dts files to make use of this container.
   Because of backwards compatibility, we cannot force the use of it,
   but we can encourage it.

   Andrew