Re: [PATCH 2/2] net: lpc_eth: parse phy nodes from device tree
From: Andrew Lunn
Date: Mon Oct 14 2019 - 19:45:11 EST
On Thu, Oct 10, 2019 at 10:45:30PM +0200, Alexandre Belloni wrote:
> When connected to a micrel phy, phy_find_first doesn't work properly
> because the first phy found is on address 0, the broadcast address but, the
> first thing the phy driver is doing is disabling this broadcast address.
> The phy is then available only on address 1 but the mdio driver doesn't
> know about it.
> Instead, register the mdio bus using of_mdiobus_register and try to find
> the phy description in device tree before falling back to phy_find_first.
> This ultimately also allows to describe the interrupt the phy is connected
> Signed-off-by: Alexandre Belloni <alexandre.belloni@xxxxxxxxxxx>
> - if (mdiobus_register(pldat->mii_bus))
> + if (of_mdiobus_register(pldat->mii_bus, pldat->pdev->dev.of_node))
> goto err_out_unregister_bus;
It is normal to use a container node 'mdio' in the ethernet node to
contain the PHY nodes. If you don't do this, you run into issues when
you have Ethernet switches on the MDIO bus.