[PATCH v3 3/6] net: eth-phy: manage subnode mdio0

Patrick Delaunay patrick.delaunay at foss.st.com
Tue Jul 20 20:09:53 CEST 2021


Bind any subnode with name beginning by mdio, mdio0 for example,
and not only the "mdio" as namei of subnode.

Reviewed-by: Ramon Fried <rfried.dev at gmail.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay at foss.st.com>
---

(no changes since v2)

Changes in v2:
- update eth-phy driver to support STM32 binding with a mdio0 subnode (NEW)

 drivers/net/eth-phy-uclass.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/drivers/net/eth-phy-uclass.c b/drivers/net/eth-phy-uclass.c
index aa5b05abc8..293579dc34 100644
--- a/drivers/net/eth-phy-uclass.c
+++ b/drivers/net/eth-phy-uclass.c
@@ -27,12 +27,18 @@ int eth_phy_binds_nodes(struct udevice *eth_dev)
 	const char *node_name;
 	int ret;
 
-	mdio_node = dev_read_subnode(eth_dev, "mdio");
+	/* search a subnode named "mdio.*" */
+	dev_for_each_subnode(mdio_node, eth_dev) {
+		node_name = ofnode_get_name(mdio_node);
+		if (!strncmp(node_name, "mdio", 4))
+			break;
+	}
 	if (!ofnode_valid(mdio_node)) {
-		dev_dbg(eth_dev, "%s: %s mdio subnode not found!", __func__,
+		dev_dbg(eth_dev, "%s: %s mdio subnode not found!\n", __func__,
 			eth_dev->name);
 		return -ENXIO;
 	}
+	dev_dbg(eth_dev, "%s: %s subnode found!\n", __func__, node_name);
 
 	ofnode_for_each_subnode(phy_node, mdio_node) {
 		node_name = ofnode_get_name(phy_node);
-- 
2.25.1



More information about the U-Boot mailing list