return of_read_u32_index(ofnode_to_np(node), propname, index,
outp);
- cell = fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), propname,
- &len);
+ cell = fdt_getprop(ofnode_to_fdt(node), ofnode_to_offset(node),
+ propname, &len);
if (!cell) {
debug("(not found)\n");
return -EINVAL;
if (ofnode_is_np(node))
return of_read_u64(ofnode_to_np(node), propname, outp);
- cell = fdt_getprop(gd->fdt_blob, ofnode_to_offset(node), propname,
- &len);
+ cell = fdt_getprop(ofnode_to_fdt(node), ofnode_to_offset(node),
+ propname, &len);
if (!cell || len < sizeof(*cell)) {
debug("(not found)\n");
return -EINVAL;
len = prop->length;
}
} else {
- val = fdt_getprop(gd->fdt_blob, ofnode_to_offset(node),
+ val = fdt_getprop(ofnode_to_fdt(node), ofnode_to_offset(node),
propname, &len);
}
if (!val) {
}
subnode = np_to_ofnode(np);
} else {
- int ooffset = fdt_subnode_offset(gd->fdt_blob,
+ int ooffset = fdt_subnode_offset(ofnode_to_fdt(node),
ofnode_to_offset(node), subnode_name);
subnode = offset_to_ofnode(ooffset);
}
} else {
int ret;
- ret = fdtdec_get_int_array(gd->fdt_blob,
+ ret = fdtdec_get_int_array(ofnode_to_fdt(node),
ofnode_to_offset(node), propname,
out_values, sz);
if (ofnode_is_np(node)) {
return of_device_is_available(ofnode_to_np(node));
} else {
- return fdtdec_get_is_enabled(gd->fdt_blob,
+ return fdtdec_get_is_enabled(ofnode_to_fdt(node),
ofnode_to_offset(node));
}
}
return np_to_ofnode(node.np->child);
return offset_to_ofnode(
- fdt_first_subnode(gd->fdt_blob, ofnode_to_offset(node)));
+ fdt_first_subnode(ofnode_to_fdt(node), ofnode_to_offset(node)));
}
ofnode ofnode_next_subnode(ofnode node)
return np_to_ofnode(node.np->sibling);
return offset_to_ofnode(
- fdt_next_subnode(gd->fdt_blob, ofnode_to_offset(node)));
+ fdt_next_subnode(ofnode_to_fdt(node), ofnode_to_offset(node)));
}
#endif /* !DM_INLINE_OFNODE */
if (ofnode_is_np(node))
parent = np_to_ofnode(of_get_parent(ofnode_to_np(node)));
else
- parent.of_offset = fdt_parent_offset(gd->fdt_blob,
+ parent.of_offset = fdt_parent_offset(ofnode_to_fdt(node),
ofnode_to_offset(node));
return parent;
if (ofnode_is_np(node))
return node.np->name;
- return fdt_get_name(gd->fdt_blob, ofnode_to_offset(node), NULL);
+ return fdt_get_name(ofnode_to_fdt(node), ofnode_to_offset(node), NULL);
}
int ofnode_get_path(ofnode node, char *buf, int buflen)
} else {
int res;
- res = fdt_get_path(gd->fdt_blob, ofnode_to_offset(node), buf,
+ res = fdt_get_path(ofnode_to_fdt(node), ofnode_to_offset(node), buf,
buflen);
if (!res)
return res;
} else {
na = ofnode_read_simple_addr_cells(ofnode_get_parent(node));
ns = ofnode_read_simple_size_cells(ofnode_get_parent(node));
- return fdtdec_get_addr_size_fixed(gd->fdt_blob,
+ return fdtdec_get_addr_size_fixed(ofnode_to_fdt(node),
ofnode_to_offset(node), "reg",
index, na, ns, size,
translate);
} else {
int ret;
- ret = fdt_stringlist_search(gd->fdt_blob,
+ ret = fdt_stringlist_search(ofnode_to_fdt(node),
ofnode_to_offset(node), property,
string);
if (ret == -FDT_ERR_NOTFOUND)
} else {
int len;
- *outp = fdt_stringlist_get(gd->fdt_blob, ofnode_to_offset(node),
+ *outp = fdt_stringlist_get(ofnode_to_fdt(node),
+ ofnode_to_offset(node),
property, index, &len);
if (len < 0)
return -EINVAL;
if (ofnode_is_np(node)) {
return of_property_count_strings(ofnode_to_np(node), property);
} else {
- return fdt_stringlist_count(gd->fdt_blob,
+ return fdt_stringlist_count(ofnode_to_fdt(node),
ofnode_to_offset(node), property);
}
}
struct fdtdec_phandle_args args;
int ret;
- ret = fdtdec_parse_phandle_with_args(gd->fdt_blob,
+ ret = fdtdec_parse_phandle_with_args(ofnode_to_fdt(node),
ofnode_to_offset(node),
list_name, cells_name,
cell_count, index, &args);
return of_count_phandle_with_args(ofnode_to_np(node),
list_name, cells_name, cell_count);
else
- return fdtdec_parse_phandle_with_args(gd->fdt_blob,
+ return fdtdec_parse_phandle_with_args(ofnode_to_fdt(node),
ofnode_to_offset(node), list_name, cells_name,
cell_count, -1, NULL);
}
if (ofnode_is_np(node))
return of_get_property(ofnode_to_np(node), propname, lenp);
else
- return fdt_getprop(gd->fdt_blob, ofnode_to_offset(node),
+ return fdt_getprop(ofnode_to_fdt(node), ofnode_to_offset(node),
propname, lenp);
}
return -FDT_ERR_NOTFOUND;
} else {
prop->offset =
- fdt_first_property_offset(gd->fdt_blob,
+ fdt_first_property_offset(ofnode_to_fdt(node),
ofnode_to_offset(prop->node));
if (prop->offset < 0)
return prop->offset;
if (!prop->prop)
return -FDT_ERR_NOTFOUND;
} else {
- prop->offset = fdt_next_property_offset(gd->fdt_blob,
- prop->offset);
+ prop->offset =
+ fdt_next_property_offset(ofnode_to_fdt(prop->node),
+ prop->offset);
if (prop->offset < 0)
return prop->offset;
}
return of_get_property_by_prop(ofnode_to_np(prop->node),
prop->prop, propname, lenp);
else
- return fdt_getprop_by_offset(gd->fdt_blob,
+ return fdt_getprop_by_offset(ofnode_to_fdt(prop->node),
prop->offset,
propname, lenp);
}
else
return of_read_number(prop, na);
} else {
- return fdtdec_get_addr_size(gd->fdt_blob,
+ return fdtdec_get_addr_size(ofnode_to_fdt(node),
ofnode_to_offset(node), property,
sizep);
}
return (uint8_t *)prop;
} else {
- return fdtdec_locate_byte_array(gd->fdt_blob,
+ return fdtdec_locate_byte_array(ofnode_to_fdt(node),
ofnode_to_offset(node), propname, sz);
}
}
if (ofnode_is_np(node)) {
return of_n_addr_cells(ofnode_to_np(node));
} else {
- int parent = fdt_parent_offset(gd->fdt_blob,
+ int parent = fdt_parent_offset(ofnode_to_fdt(node),
ofnode_to_offset(node));
- return fdt_address_cells(gd->fdt_blob, parent);
+ return fdt_address_cells(ofnode_to_fdt(node), parent);
}
}
if (ofnode_is_np(node)) {
return of_n_size_cells(ofnode_to_np(node));
} else {
- int parent = fdt_parent_offset(gd->fdt_blob,
+ int parent = fdt_parent_offset(ofnode_to_fdt(node),
ofnode_to_offset(node));
- return fdt_size_cells(gd->fdt_blob, parent);
+ return fdt_size_cells(ofnode_to_fdt(node), parent);
}
}
if (ofnode_is_np(node))
return of_simple_addr_cells(ofnode_to_np(node));
else
- return fdt_address_cells(gd->fdt_blob, ofnode_to_offset(node));
+ return fdt_address_cells(ofnode_to_fdt(node),
+ ofnode_to_offset(node));
}
int ofnode_read_simple_size_cells(ofnode node)
if (ofnode_is_np(node))
return of_simple_size_cells(ofnode_to_np(node));
else
- return fdt_size_cells(gd->fdt_blob, ofnode_to_offset(node));
+ return fdt_size_cells(ofnode_to_fdt(node),
+ ofnode_to_offset(node));
}
bool ofnode_pre_reloc(ofnode node)
struct fdt_resource fres;
int ret;
- ret = fdt_get_resource(gd->fdt_blob, ofnode_to_offset(node),
+ ret = fdt_get_resource(ofnode_to_fdt(node),
+ ofnode_to_offset(node),
"reg", index, &fres);
if (ret < 0)
return -EINVAL;
if (ofnode_is_np(node))
return of_translate_address(ofnode_to_np(node), in_addr);
else
- return fdt_translate_address(gd->fdt_blob, ofnode_to_offset(node), in_addr);
+ return fdt_translate_address(ofnode_to_fdt(node),
+ ofnode_to_offset(node), in_addr);
}
u64 ofnode_translate_dma_address(ofnode node, const fdt32_t *in_addr)
if (ofnode_is_np(node))
return of_translate_dma_address(ofnode_to_np(node), in_addr);
else
- return fdt_translate_dma_address(gd->fdt_blob, ofnode_to_offset(node), in_addr);
+ return fdt_translate_dma_address(ofnode_to_fdt(node),
+ ofnode_to_offset(node), in_addr);
}
int ofnode_get_dma_range(ofnode node, phys_addr_t *cpu, dma_addr_t *bus, u64 *size)
if (ofnode_is_np(node))
return of_get_dma_range(ofnode_to_np(node), cpu, bus, size);
else
- return fdt_get_dma_range(gd->fdt_blob, ofnode_to_offset(node),
+ return fdt_get_dma_range(ofnode_to_fdt(node),
+ ofnode_to_offset(node),
cpu, bus, size);
}
return of_device_is_compatible(ofnode_to_np(node), compat,
NULL, NULL);
else
- return !fdt_node_check_compatible(gd->fdt_blob,
+ return !fdt_node_check_compatible(ofnode_to_fdt(node),
ofnode_to_offset(node),
compat);
}
compat));
} else {
return offset_to_ofnode(fdt_node_offset_by_compatible(
- gd->fdt_blob, ofnode_to_offset(from), compat));
+ ofnode_to_fdt(from),
+ ofnode_to_offset(from), compat));
}
}
propval, proplen));
} else {
return offset_to_ofnode(fdt_node_offset_by_prop_value(
- gd->fdt_blob, ofnode_to_offset(from),
+ ofnode_to_fdt(from), ofnode_to_offset(from),
propname, propval, proplen));
}
}
if (of_live_active())
return of_write_prop(ofnode_to_np(node), propname, len, value);
else
- return fdt_setprop((void *)gd->fdt_blob, ofnode_to_offset(node),
+ return fdt_setprop(ofnode_to_fdt(node), ofnode_to_offset(node),
propname, value, len);
return 0;
return ret;
subnode = np_to_ofnode(child);
} else {
- void *fdt = (void *)gd->fdt_blob;
+ void *fdt = ofnode_to_fdt(node);
int poffset = ofnode_to_offset(node);
int offset;