diff options
Diffstat (limited to 'drivers/core')
-rw-r--r-- | drivers/core/device.c | 27 | ||||
-rw-r--r-- | drivers/core/regmap.c | 4 | ||||
-rw-r--r-- | drivers/core/root.c | 4 | ||||
-rw-r--r-- | drivers/core/simple-bus.c | 6 | ||||
-rw-r--r-- | drivers/core/uclass.c | 8 |
5 files changed, 28 insertions, 21 deletions
diff --git a/drivers/core/device.c b/drivers/core/device.c index ed553d70a6..70fcfc23e0 100644 --- a/drivers/core/device.c +++ b/drivers/core/device.c @@ -355,7 +355,7 @@ int device_probe(struct udevice *dev) goto fail; } - if (drv->ofdata_to_platdata && dev->of_offset >= 0) { + if (drv->ofdata_to_platdata && dev_of_offset(dev) >= 0) { ret = drv->ofdata_to_platdata(dev); if (ret) goto fail; @@ -524,7 +524,7 @@ int device_find_child_by_of_offset(struct udevice *parent, int of_offset, *devp = NULL; list_for_each_entry(dev, &parent->child_head, sibling_node) { - if (dev->of_offset == of_offset) { + if (dev_of_offset(dev) == of_offset) { *devp = dev; return 0; } @@ -549,7 +549,7 @@ static struct udevice *_device_find_global_by_of_offset(struct udevice *parent, { struct udevice *dev, *found; - if (parent->of_offset == of_offset) + if (dev_of_offset(parent) == of_offset) return parent; list_for_each_entry(dev, &parent->child_head, sibling_node) { @@ -637,19 +637,21 @@ fdt_addr_t dev_get_addr_index(struct udevice *dev, int index) int len = 0; int na, ns; - na = fdt_address_cells(gd->fdt_blob, dev->parent->of_offset); + na = fdt_address_cells(gd->fdt_blob, + dev_of_offset(dev->parent)); if (na < 1) { debug("bad #address-cells\n"); return FDT_ADDR_T_NONE; } - ns = fdt_size_cells(gd->fdt_blob, dev->parent->of_offset); + ns = fdt_size_cells(gd->fdt_blob, dev_of_offset(dev->parent)); if (ns < 0) { debug("bad #size-cells\n"); return FDT_ADDR_T_NONE; } - reg = fdt_getprop(gd->fdt_blob, dev->of_offset, "reg", &len); + reg = fdt_getprop(gd->fdt_blob, dev_of_offset(dev), "reg", + &len); if (!reg || (len <= (index * sizeof(fdt32_t) * (na + ns)))) { debug("Req index out of range\n"); return FDT_ADDR_T_NONE; @@ -662,16 +664,15 @@ fdt_addr_t dev_get_addr_index(struct udevice *dev, int index) * bus setups. */ addr = fdt_translate_address((void *)gd->fdt_blob, - dev->of_offset, reg); + dev_of_offset(dev), reg); } else { /* * Use the "simple" translate function for less complex * bus setups. */ addr = fdtdec_get_addr_size_auto_parent(gd->fdt_blob, - dev->parent->of_offset, - dev->of_offset, "reg", - index, NULL, false); + dev_of_offset(dev->parent), dev_of_offset(dev), + "reg", index, NULL, false); if (CONFIG_IS_ENABLED(SIMPLE_BUS) && addr != FDT_ADDR_T_NONE) { if (device_get_uclass_id(dev->parent) == UCLASS_SIMPLE_BUS) @@ -702,7 +703,7 @@ fdt_addr_t dev_get_addr_size_index(struct udevice *dev, int index, * next call to the exisiting dev_get_xxx function which handles * all config options. */ - fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, dev->of_offset, + fdtdec_get_addr_size_auto_noparent(gd->fdt_blob, dev_of_offset(dev), "reg", index, size, false); /* @@ -720,7 +721,7 @@ fdt_addr_t dev_get_addr_name(struct udevice *dev, const char *name) #if CONFIG_IS_ENABLED(OF_CONTROL) int index; - index = fdt_stringlist_search(gd->fdt_blob, dev->of_offset, + index = fdt_stringlist_search(gd->fdt_blob, dev_of_offset(dev), "reg-names", name); if (index < 0) return index; @@ -799,7 +800,7 @@ bool of_device_is_compatible(struct udevice *dev, const char *compat) { const void *fdt = gd->fdt_blob; - return !fdt_node_check_compatible(fdt, dev->of_offset, compat); + return !fdt_node_check_compatible(fdt, dev_of_offset(dev), compat); } bool of_machine_is_compatible(const char *compat) diff --git a/drivers/core/regmap.c b/drivers/core/regmap.c index c68bcba54f..833cd78e84 100644 --- a/drivers/core/regmap.c +++ b/drivers/core/regmap.c @@ -71,12 +71,12 @@ int regmap_init_mem(struct udevice *dev, struct regmap **mapp) int parent; int len; - parent = dev->parent->of_offset; + parent = dev_of_offset(dev->parent); addr_len = fdt_address_cells(blob, parent); size_len = fdt_size_cells(blob, parent); both_len = addr_len + size_len; - cell = fdt_getprop(blob, dev->of_offset, "reg", &len); + cell = fdt_getprop(blob, dev_of_offset(dev), "reg", &len); len /= sizeof(*cell); count = len / both_len; if (!cell || !count) diff --git a/drivers/core/root.c b/drivers/core/root.c index 9edfc1efb6..175fd3fb25 100644 --- a/drivers/core/root.c +++ b/drivers/core/root.c @@ -227,10 +227,10 @@ int dm_scan_fdt_node(struct udevice *parent, const void *blob, int offset, int dm_scan_fdt_dev(struct udevice *dev) { - if (dev->of_offset == -1) + if (dev_of_offset(dev) == -1) return 0; - return dm_scan_fdt_node(dev, gd->fdt_blob, dev->of_offset, + return dm_scan_fdt_node(dev, gd->fdt_blob, dev_of_offset(dev), gd->flags & GD_FLG_RELOC ? false : true); } diff --git a/drivers/core/simple-bus.c b/drivers/core/simple-bus.c index 5c955da334..a300217d39 100644 --- a/drivers/core/simple-bus.c +++ b/drivers/core/simple-bus.c @@ -27,10 +27,13 @@ fdt_addr_t simple_bus_translate(struct udevice *dev, fdt_addr_t addr) static int simple_bus_post_bind(struct udevice *dev) { +#if CONFIG_IS_ENABLED(OF_PLATDATA) + return 0; +#else u32 cell[3]; int ret; - ret = fdtdec_get_int_array(gd->fdt_blob, dev->of_offset, "ranges", + ret = fdtdec_get_int_array(gd->fdt_blob, dev_of_offset(dev), "ranges", cell, ARRAY_SIZE(cell)); if (!ret) { struct simple_bus_plat *plat = dev_get_uclass_platdata(dev); @@ -41,6 +44,7 @@ static int simple_bus_post_bind(struct udevice *dev) } return dm_scan_fdt_dev(dev); +#endif } UCLASS_DRIVER(simple_bus) = { diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c index 60610e5a1f..7de370644d 100644 --- a/drivers/core/uclass.c +++ b/drivers/core/uclass.c @@ -278,7 +278,7 @@ int uclass_find_device_by_of_offset(enum uclass_id id, int node, return ret; list_for_each_entry(dev, &uc->dev_head, uclass_node) { - if (dev->of_offset == node) { + if (dev_of_offset(dev) == node) { *devp = dev; return 0; } @@ -299,7 +299,7 @@ static int uclass_find_device_by_phandle(enum uclass_id id, int ret; *devp = NULL; - find_phandle = fdtdec_get_int(gd->fdt_blob, parent->of_offset, name, + find_phandle = fdtdec_get_int(gd->fdt_blob, dev_of_offset(parent), name, -1); if (find_phandle <= 0) return -ENOENT; @@ -308,7 +308,9 @@ static int uclass_find_device_by_phandle(enum uclass_id id, return ret; list_for_each_entry(dev, &uc->dev_head, uclass_node) { - uint phandle = fdt_get_phandle(gd->fdt_blob, dev->of_offset); + uint phandle; + + phandle = fdt_get_phandle(gd->fdt_blob, dev_of_offset(dev)); if (phandle == find_phandle) { *devp = dev; |