lkml.org 
[lkml]   [2023]   [Dec]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
Subject[PATCH net] 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: 47dd7a540b8a (net: add support for STMicroelectronics Ethernet controllers.")
Signed-off-by: Andrew Halaney <ahalaney@redhat.com>
---
drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
index fa9e7e7040b9..a39be15d41a8 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c
@@ -591,7 +591,13 @@ 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) {
+ if (err == -ENODEV) {
+ /* The bus is disabled in the devicetree, that's ok */
+ mdiobus_free(new_bus);
+ return 0;
+ }
+
dev_err_probe(dev, err, "Cannot register the MDIO bus\n");
goto bus_register_fail;
}
---
base-commit: bbd220ce4e29ed55ab079007cff0b550895258eb
change-id: 20231211-b4-stmmac-handle-mdio-enodev-82168de68c6a
Best regards,
--
Andrew Halaney <ahalaney@redhat.com>

\
 
 \ /
  Last update: 2023-12-11 22:32    [W:0.757 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site