Skip to content

Commit

Permalink
net: macb: Use mdio child node for MDIO bus if it exists
Browse files Browse the repository at this point in the history
This allows explicitly specifying which children are present on the mdio
bus. Additionally, it allows for non-phy MDIO devices on the bus.

Signed-off-by: Sean Anderson <sean.anderson@seco.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Sean Anderson authored and David S. Miller committed Oct 24, 2021
1 parent 2579084 commit 4d98bb0
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions drivers/net/ethernet/cadence/macb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,17 @@ static int macb_mdiobus_register(struct macb *bp)
{
struct device_node *child, *np = bp->pdev->dev.of_node;

/* If we have a child named mdio, probe it instead of looking for PHYs
* directly under the MAC node
*/
child = of_get_child_by_name(np, "mdio");
if (np) {
int ret = of_mdiobus_register(bp->mii_bus, child);

of_node_put(child);
return ret;
}

if (of_phy_is_fixed_link(np))
return mdiobus_register(bp->mii_bus);

Expand Down

0 comments on commit 4d98bb0

Please sign in to comment.