[PATCH 04/20] net: phy: fixed: Convert to use APIs which support live DT

Bin Meng bmeng.cn at gmail.com
Tue Mar 2 16:34:35 CET 2021


Use ofnode_ APIs instead of fdt_ APIs so that the fixed PHY driver
can support live DT.

Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
---

 drivers/net/phy/phy.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index d08e8026ba..69e02685fa 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1002,18 +1002,19 @@ static struct phy_device *phy_connect_fixed(struct mii_dev *bus,
 					    phy_interface_t interface)
 {
 	struct phy_device *phydev = NULL;
-	int sn;
+	ofnode node = dev_ofnode(dev);
 	const char *name;
 
-	sn = fdt_first_subnode(gd->fdt_blob, dev_of_offset(dev));
-	while (sn > 0) {
-		name = fdt_get_name(gd->fdt_blob, sn, NULL);
+	node = ofnode_first_subnode(node);
+	while (ofnode_valid(node)) {
+		name = ofnode_get_name(node);
 		if (name && strcmp(name, "fixed-link") == 0) {
-			phydev = phy_device_create(bus, sn, PHY_FIXED_ID, false,
+			phydev = phy_device_create(bus, ofnode_to_offset(node),
+						   PHY_FIXED_ID, false,
 						   interface);
 			break;
 		}
-		sn = fdt_next_subnode(gd->fdt_blob, sn);
+		node = ofnode_next_subnode(node);
 	}
 
 	return phydev;
-- 
2.25.1



More information about the U-Boot mailing list