[PATCH master] net: designware: eqos: fix MDIO regression for STM32MP1 boards

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Aug 31 08:32:14 PDT 2021


The STM32MP1 boards call their mdio subnode mdio0, which is now skipped
since ed8c7bdf8592 ("net: designware: eqos: set mdio bus device node").

Fix networking for them by only falling back to the mdio node name when a
child node with the correct compatible could not be found.

Fixes: ed8c7bdf8592 ("net: designware: eqos: set mdio bus device node")
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/net/designware_eqos.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/net/designware_eqos.c b/drivers/net/designware_eqos.c
index f83ec127143c..5eee844e289a 100644
--- a/drivers/net/designware_eqos.c
+++ b/drivers/net/designware_eqos.c
@@ -824,6 +824,7 @@ static void eqos_probe_dt(struct device_d *dev, struct eqos *eqos)
 
 int eqos_probe(struct device_d *dev, const struct eqos_ops *ops, void *priv)
 {
+	struct device_node *np = dev->device_node;
 	struct mii_bus *miibus;
 	struct resource *iores;
 	struct eqos *eqos;
@@ -862,7 +863,10 @@ int eqos_probe(struct device_d *dev, const struct eqos_ops *ops, void *priv)
 	miibus->read = eqos_mdio_read;
 	miibus->write = eqos_mdio_write;
 	miibus->priv = eqos;
-	miibus->dev.device_node = of_get_child_by_name(dev->device_node, "mdio");
+
+	miibus->dev.device_node = of_get_compatible_child(np, "snps,dwmac-mdio");
+	if (!miibus->dev.device_node)
+		miibus->dev.device_node = of_get_child_by_name(np, "mdio");
 
 	ret = eqos_init(dev, eqos);
 	if (ret)
-- 
2.30.2




More information about the barebox mailing list