]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
imx: power-domain: Convert to use livetree API for fdt access
authorTim Harvey <tharvey@gateworks.com>
Wed, 23 Oct 2024 20:28:53 +0000 (13:28 -0700)
committerFabio Estevam <festevam@gmail.com>
Fri, 25 Oct 2024 12:07:35 +0000 (09:07 -0300)
Convert to using livetree API functions.

Without this if livetree is enabled (OF_LIVE) the imx8m-power-domain
driver will (silently) fail to probe its children leaving you with
no power domain support causing issues with certain devices.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Reviewed-by: Jaehoon Chung <jh80.chung@samsung.com>
drivers/power/domain/imx8m-power-domain.c

index 8b6870c8646335194cdc8edae34b944fde078f56..c22fbe60675e96a628f205d10a71b66c7b33ef00 100644 (file)
@@ -456,25 +456,22 @@ static int imx8m_power_domain_of_xlate(struct power_domain *power_domain,
 
 static int imx8m_power_domain_bind(struct udevice *dev)
 {
-       int offset;
+       ofnode subnode;
        const char *name;
        int ret = 0;
 
-       offset = dev_of_offset(dev);
-       for (offset = fdt_first_subnode(gd->fdt_blob, offset); offset > 0;
-            offset = fdt_next_subnode(gd->fdt_blob, offset)) {
+       ofnode_for_each_subnode(subnode, dev_ofnode(dev)) {
                /* Bind the subnode to this driver */
-               name = fdt_get_name(gd->fdt_blob, offset, NULL);
+               name = ofnode_get_name(subnode);
 
                /* Descend into 'pgc' subnode */
                if (!strstr(name, "power-domain")) {
-                       offset = fdt_first_subnode(gd->fdt_blob, offset);
-                       name = fdt_get_name(gd->fdt_blob, offset, NULL);
+                       subnode = ofnode_first_subnode(subnode);
+                       name = ofnode_get_name(subnode);
                }
-
                ret = device_bind_with_driver_data(dev, dev->driver, name,
                                                   dev->driver_data,
-                                                  offset_to_ofnode(offset),
+                                                  subnode,
                                                   NULL);
 
                if (ret == -ENODEV)
@@ -514,8 +511,7 @@ static int imx8m_power_domain_of_to_plat(struct udevice *dev)
        struct imx_pgc_domain_data *domain_data =
                (struct imx_pgc_domain_data *)dev_get_driver_data(dev);
 
-       pdata->resource_id = fdtdec_get_int(gd->fdt_blob, dev_of_offset(dev),
-                                           "reg", -1);
+       pdata->resource_id = ofnode_read_u32_default(dev_ofnode(dev), "reg", -1);
        pdata->domain = &domain_data->domains[pdata->resource_id];
        pdata->regs = domain_data->pgc_regs;
        pdata->base = dev_read_addr_ptr(dev->parent);