Re: [PATCH v2] net: macb: do not scan PHYs manually

Andrew Lunn
2016-04-29T12:56:28Z

> > +static int macb_mii_of_init(struct macb *bp, struct device_node *np)
> > +{
> > + struct device_node *mdio;
> > + int err, i;
> > +
> > + mdio = of_get_child_by_name(np, "mdio");
> > + if (mdio)
> > + return of_mdiobus_register(bp->mii_bus, mdio);
> > +
> > + dev_warn(&bp->pdev->dev,
> > + "using deprecated PHY probing mechanism. Please update device tree.");
>
> Do we need to warn here?
>
> Too bad I was not aware of that earlier, I even updated some of my DTs
> recently with only a phy node without the "mdio" one as parents :-\

It is messy. Unfortunately, there is no binding documentation (yet)
suggesting the right way to do this. And as a result, we have
drivers/device trees doing different things, leading to workarounds
like manually scanning the bus, not listing PHYs in the device tree
and so or falling back to the old methods, etc.

We need to document how we expect this to be done, and then add
warnings in various places to encourage developers to migrate their
device trees to what has been documented.

Andrew