Skip to content

Commit e23c0d2

Browse files
ahalaneyPaolo Abeni
authored andcommitted
net: stmmac: Handle disabled MDIO busses from devicetree
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 <ahalaney@redhat.com> Reviewed-by: Serge Semin <fancer.lancer@gmail.com> Link: https://lore.kernel.org/r/20231212-b4-stmmac-handle-mdio-enodev-v2-1-600171acf79f@redhat.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 981d947 commit e23c0d2

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,11 @@ int stmmac_mdio_register(struct net_device *ndev)
591591
new_bus->parent = priv->device;
592592

593593
err = of_mdiobus_register(new_bus, mdio_node);
594-
if (err != 0) {
594+
if (err == -ENODEV) {
595+
err = 0;
596+
dev_info(dev, "MDIO bus is disabled\n");
597+
goto bus_register_fail;
598+
} else if (err) {
595599
dev_err_probe(dev, err, "Cannot register the MDIO bus\n");
596600
goto bus_register_fail;
597601
}

0 commit comments

Comments
 (0)