of: Drop devicetree merge support
I assume I am the only person knowing that barebox is able to merge devicetrees. This feature seems broken for a while now since trying to merge devicetress results in: unflatten: too many end nodes Remove this feature to save the complexity. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
c72a0504c9
commit
d384b5639f
|
@ -76,7 +76,7 @@ static int highbank_mem_init(void)
|
|||
/* load by the firmware at 0x1000 */
|
||||
fdt = IOMEM(FIRMWARE_DTB_BASE);
|
||||
|
||||
root = of_unflatten_dtb(NULL, fdt);
|
||||
root = of_unflatten_dtb(fdt);
|
||||
if (!root) {
|
||||
pr_warn("no dtb found at 0x1000 use default configuration\n");
|
||||
fdt = NULL;
|
||||
|
|
|
@ -47,7 +47,7 @@ static int of_arm_init(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
root = of_unflatten_dtb(NULL, fdt);
|
||||
root = of_unflatten_dtb(fdt);
|
||||
if (root) {
|
||||
of_set_root_node(root);
|
||||
if (IS_ENABLED(CONFIG_OFDEVICE))
|
||||
|
|
|
@ -215,7 +215,7 @@ static int do_bootz_linux_fdt(int fd, struct image_data *data)
|
|||
}
|
||||
|
||||
if (IS_BUILTIN(CONFIG_OFTREE)) {
|
||||
data->of_root_node = of_unflatten_dtb(NULL, oftree);
|
||||
data->of_root_node = of_unflatten_dtb(oftree);
|
||||
if (!data->of_root_node) {
|
||||
pr_err("unable to unflatten devicetree\n");
|
||||
ret = -EINVAL;
|
||||
|
|
|
@ -48,7 +48,7 @@ static int of_mips_init(void)
|
|||
if (root)
|
||||
return 0;
|
||||
|
||||
root = of_unflatten_dtb(NULL, __dtb_start);
|
||||
root = of_unflatten_dtb(__dtb_start);
|
||||
if (root) {
|
||||
pr_debug("using internal DTB\n");
|
||||
of_set_root_node(root);
|
||||
|
|
|
@ -63,7 +63,7 @@ static int do_of_dump(int argc, char *argv[])
|
|||
return -errno;
|
||||
}
|
||||
|
||||
root = of_unflatten_dtb(NULL, fdt);
|
||||
root = of_unflatten_dtb(fdt);
|
||||
|
||||
free(fdt);
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ static int do_oftree(int argc, char *argv[])
|
|||
int save = 0;
|
||||
int free_of = 0;
|
||||
int ret;
|
||||
struct device_node *n, *root;
|
||||
struct device_node *root;
|
||||
|
||||
while ((opt = getopt(argc, argv, "pfl:s:")) > 0) {
|
||||
switch (opt) {
|
||||
|
@ -130,16 +130,13 @@ static int do_oftree(int argc, char *argv[])
|
|||
goto out;
|
||||
}
|
||||
|
||||
n = of_get_root_node();
|
||||
|
||||
root = of_unflatten_dtb(n, fdt);
|
||||
root = of_unflatten_dtb(fdt);
|
||||
if (IS_ERR(root))
|
||||
ret = PTR_ERR(root);
|
||||
else
|
||||
ret = 0;
|
||||
|
||||
if (!n)
|
||||
ret = of_set_root_node(root);
|
||||
ret = of_set_root_node(root);
|
||||
|
||||
if (ret) {
|
||||
printf("parse oftree: %s\n", strerror(-ret));
|
||||
|
|
|
@ -281,7 +281,7 @@ static bool entry_is_of_compatible(struct blspec_entry *entry)
|
|||
goto out;
|
||||
}
|
||||
|
||||
root = of_unflatten_dtb(NULL, fdt);
|
||||
root = of_unflatten_dtb(fdt);
|
||||
if (IS_ERR(root)) {
|
||||
ret = PTR_ERR(root);
|
||||
goto out;
|
||||
|
|
|
@ -297,7 +297,7 @@ static int bootm_open_oftree(struct image_data *data, const char *oftree, int nu
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
data->of_root_node = of_unflatten_dtb(NULL, fdt);
|
||||
data->of_root_node = of_unflatten_dtb(fdt);
|
||||
if (!data->of_root_node) {
|
||||
pr_err("unable to unflatten devicetree\n");
|
||||
free(fdt);
|
||||
|
|
|
@ -54,20 +54,20 @@ static inline char *dt_string(struct fdt_header *f, char *strstart, uint32_t ofs
|
|||
* Parse a flat device tree binary blob and return a pointer to the
|
||||
* unflattened tree.
|
||||
*/
|
||||
struct device_node *of_unflatten_dtb(struct device_node *root, void *infdt)
|
||||
struct device_node *of_unflatten_dtb(void *infdt)
|
||||
{
|
||||
const void *nodep; /* property node pointer */
|
||||
uint32_t tag; /* tag */
|
||||
int len; /* length of the property */
|
||||
const struct fdt_property *fdt_prop;
|
||||
const char *pathp, *name;
|
||||
struct device_node *node = NULL;
|
||||
struct device_node *root, *node = NULL;
|
||||
struct property *p;
|
||||
uint32_t dt_struct;
|
||||
struct fdt_node_header *fnh;
|
||||
void *dt_strings;
|
||||
struct fdt_header f;
|
||||
int ret, merge = 0;
|
||||
int ret;
|
||||
unsigned int maxlen;
|
||||
struct fdt_header *fdt = infdt;
|
||||
|
||||
|
@ -100,14 +100,9 @@ struct device_node *of_unflatten_dtb(struct device_node *root, void *infdt)
|
|||
dt_struct = f.off_dt_struct;
|
||||
dt_strings = (void *)fdt + f.off_dt_strings;
|
||||
|
||||
if (root) {
|
||||
pr_debug("unflatten: merging into existing tree\n");
|
||||
merge = 1;
|
||||
} else {
|
||||
root = of_new_node(NULL, NULL);
|
||||
if (!root)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
root = of_new_node(NULL, NULL);
|
||||
if (!root)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
while (1) {
|
||||
tag = be32_to_cpu(*(uint32_t *)(infdt + dt_struct));
|
||||
|
@ -132,15 +127,10 @@ struct device_node *of_unflatten_dtb(struct device_node *root, void *infdt)
|
|||
goto err;
|
||||
}
|
||||
|
||||
if (!node) {
|
||||
if (!node)
|
||||
node = root;
|
||||
} else {
|
||||
if (merge)
|
||||
node = of_get_child_by_name(node,
|
||||
pathp);
|
||||
if (!merge || !node)
|
||||
node = of_new_node(node, pathp);
|
||||
}
|
||||
else
|
||||
node = of_new_node(node, pathp);
|
||||
|
||||
break;
|
||||
|
||||
|
@ -179,19 +169,9 @@ struct device_node *of_unflatten_dtb(struct device_node *root, void *infdt)
|
|||
goto err;
|
||||
}
|
||||
|
||||
p = NULL;
|
||||
if (merge)
|
||||
p = of_find_property(node, name, NULL);
|
||||
if (merge && p) {
|
||||
free(p->value);
|
||||
p->value = xzalloc(len);
|
||||
p->length = len;
|
||||
memcpy(p->value, nodep, len);
|
||||
} else {
|
||||
p = of_new_property(node, name, nodep, len);
|
||||
if (!strcmp(name, "phandle") && len == 4)
|
||||
node->phandle = be32_to_cpup(p->value);
|
||||
}
|
||||
p = of_new_property(node, name, nodep, len);
|
||||
if (!strcmp(name, "phandle") && len == 4)
|
||||
node->phandle = be32_to_cpup(p->value);
|
||||
|
||||
break;
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ void of_print_cmdline(struct device_node *root);
|
|||
void of_print_nodes(struct device_node *node, int indent);
|
||||
int of_probe(void);
|
||||
int of_parse_dtb(struct fdt_header *fdt);
|
||||
struct device_node *of_unflatten_dtb(struct device_node *root, void *fdt);
|
||||
struct device_node *of_unflatten_dtb(void *fdt);
|
||||
|
||||
struct cdev;
|
||||
|
||||
|
|
Loading…
Reference in New Issue