]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: eth-phy: manage subnode mdio0
authorPatrick Delaunay <patrick.delaunay@foss.st.com>
Tue, 20 Jul 2021 18:09:53 +0000 (20:09 +0200)
committerRamon Fried <rfried.dev@gmail.com>
Thu, 22 Jul 2021 19:05:44 +0000 (22:05 +0300)
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@gmail.com>
Signed-off-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
drivers/net/eth-phy-uclass.c

index aa5b05abc8a0fc99f1f4bb3f5d7a385c64df86bd..293579dc34e0ef9e50d1687bfe2c64b6e58f2a84 100644 (file)
@@ -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);