Skip to content

Commit

Permalink
net: stmmac: Handle disabled MDIO busses from devicetree
Browse files Browse the repository at this point in the history
Many hardware configurations have the MDIO bus disabled, and are instead
using some other MDIO bus to talk to the MAC's phy.

of_mdiobus_register() returns -ENODEV in this case. Let's handle it
gracefully instead of failing to probe the MAC.

Fixes: 47dd7a5 ("net: add support for STMicroelectronics Ethernet controllers.")
Signed-off-by: Andrew Halaney <[email protected]>
Reviewed-by: Serge Semin <[email protected]>
Link: https://lore.kernel.org/r/20231212-b4-stmmac-handle-mdio-enodev-v2-1-600171acf79f@redhat.com
Signed-off-by: Paolo Abeni <[email protected]>
  • Loading branch information
ahalaney authored and Paolo Abeni committed Dec 14, 2023
1 parent 981d947 commit e23c0d2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -591,7 +591,11 @@ int stmmac_mdio_register(struct net_device *ndev)
new_bus->parent = priv->device;

err = of_mdiobus_register(new_bus, mdio_node);
if (err != 0) {
if (err == -ENODEV) {
err = 0;
dev_info(dev, "MDIO bus is disabled\n");
goto bus_register_fail;
} else if (err) {
dev_err_probe(dev, err, "Cannot register the MDIO bus\n");
goto bus_register_fail;
}
Expand Down

0 comments on commit e23c0d2

Please sign in to comment.