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 */
|
/* load by the firmware at 0x1000 */
|
||||||
fdt = IOMEM(FIRMWARE_DTB_BASE);
|
fdt = IOMEM(FIRMWARE_DTB_BASE);
|
||||||
|
|
||||||
root = of_unflatten_dtb(NULL, fdt);
|
root = of_unflatten_dtb(fdt);
|
||||||
if (!root) {
|
if (!root) {
|
||||||
pr_warn("no dtb found at 0x1000 use default configuration\n");
|
pr_warn("no dtb found at 0x1000 use default configuration\n");
|
||||||
fdt = NULL;
|
fdt = NULL;
|
||||||
|
|
|
@ -47,7 +47,7 @@ static int of_arm_init(void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
root = of_unflatten_dtb(NULL, fdt);
|
root = of_unflatten_dtb(fdt);
|
||||||
if (root) {
|
if (root) {
|
||||||
of_set_root_node(root);
|
of_set_root_node(root);
|
||||||
if (IS_ENABLED(CONFIG_OFDEVICE))
|
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)) {
|
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) {
|
if (!data->of_root_node) {
|
||||||
pr_err("unable to unflatten devicetree\n");
|
pr_err("unable to unflatten devicetree\n");
|
||||||
ret = -EINVAL;
|
ret = -EINVAL;
|
||||||
|
|
|
@ -48,7 +48,7 @@ static int of_mips_init(void)
|
||||||
if (root)
|
if (root)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
root = of_unflatten_dtb(NULL, __dtb_start);
|
root = of_unflatten_dtb(__dtb_start);
|
||||||
if (root) {
|
if (root) {
|
||||||
pr_debug("using internal DTB\n");
|
pr_debug("using internal DTB\n");
|
||||||
of_set_root_node(root);
|
of_set_root_node(root);
|
||||||
|
|
|
@ -63,7 +63,7 @@ static int do_of_dump(int argc, char *argv[])
|
||||||
return -errno;
|
return -errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
root = of_unflatten_dtb(NULL, fdt);
|
root = of_unflatten_dtb(fdt);
|
||||||
|
|
||||||
free(fdt);
|
free(fdt);
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ static int do_oftree(int argc, char *argv[])
|
||||||
int save = 0;
|
int save = 0;
|
||||||
int free_of = 0;
|
int free_of = 0;
|
||||||
int ret;
|
int ret;
|
||||||
struct device_node *n, *root;
|
struct device_node *root;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "pfl:s:")) > 0) {
|
while ((opt = getopt(argc, argv, "pfl:s:")) > 0) {
|
||||||
switch (opt) {
|
switch (opt) {
|
||||||
|
@ -130,16 +130,13 @@ static int do_oftree(int argc, char *argv[])
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
n = of_get_root_node();
|
root = of_unflatten_dtb(fdt);
|
||||||
|
|
||||||
root = of_unflatten_dtb(n, fdt);
|
|
||||||
if (IS_ERR(root))
|
if (IS_ERR(root))
|
||||||
ret = PTR_ERR(root);
|
ret = PTR_ERR(root);
|
||||||
else
|
else
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
|
||||||
if (!n)
|
ret = of_set_root_node(root);
|
||||||
ret = of_set_root_node(root);
|
|
||||||
|
|
||||||
if (ret) {
|
if (ret) {
|
||||||
printf("parse oftree: %s\n", strerror(-ret));
|
printf("parse oftree: %s\n", strerror(-ret));
|
||||||
|
|
|
@ -281,7 +281,7 @@ static bool entry_is_of_compatible(struct blspec_entry *entry)
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
root = of_unflatten_dtb(NULL, fdt);
|
root = of_unflatten_dtb(fdt);
|
||||||
if (IS_ERR(root)) {
|
if (IS_ERR(root)) {
|
||||||
ret = PTR_ERR(root);
|
ret = PTR_ERR(root);
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -297,7 +297,7 @@ static int bootm_open_oftree(struct image_data *data, const char *oftree, int nu
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
data->of_root_node = of_unflatten_dtb(NULL, fdt);
|
data->of_root_node = of_unflatten_dtb(fdt);
|
||||||
if (!data->of_root_node) {
|
if (!data->of_root_node) {
|
||||||
pr_err("unable to unflatten devicetree\n");
|
pr_err("unable to unflatten devicetree\n");
|
||||||
free(fdt);
|
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
|
* Parse a flat device tree binary blob and return a pointer to the
|
||||||
* unflattened tree.
|
* 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 */
|
const void *nodep; /* property node pointer */
|
||||||
uint32_t tag; /* tag */
|
uint32_t tag; /* tag */
|
||||||
int len; /* length of the property */
|
int len; /* length of the property */
|
||||||
const struct fdt_property *fdt_prop;
|
const struct fdt_property *fdt_prop;
|
||||||
const char *pathp, *name;
|
const char *pathp, *name;
|
||||||
struct device_node *node = NULL;
|
struct device_node *root, *node = NULL;
|
||||||
struct property *p;
|
struct property *p;
|
||||||
uint32_t dt_struct;
|
uint32_t dt_struct;
|
||||||
struct fdt_node_header *fnh;
|
struct fdt_node_header *fnh;
|
||||||
void *dt_strings;
|
void *dt_strings;
|
||||||
struct fdt_header f;
|
struct fdt_header f;
|
||||||
int ret, merge = 0;
|
int ret;
|
||||||
unsigned int maxlen;
|
unsigned int maxlen;
|
||||||
struct fdt_header *fdt = infdt;
|
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_struct = f.off_dt_struct;
|
||||||
dt_strings = (void *)fdt + f.off_dt_strings;
|
dt_strings = (void *)fdt + f.off_dt_strings;
|
||||||
|
|
||||||
if (root) {
|
root = of_new_node(NULL, NULL);
|
||||||
pr_debug("unflatten: merging into existing tree\n");
|
if (!root)
|
||||||
merge = 1;
|
return ERR_PTR(-ENOMEM);
|
||||||
} else {
|
|
||||||
root = of_new_node(NULL, NULL);
|
|
||||||
if (!root)
|
|
||||||
return ERR_PTR(-ENOMEM);
|
|
||||||
}
|
|
||||||
|
|
||||||
while (1) {
|
while (1) {
|
||||||
tag = be32_to_cpu(*(uint32_t *)(infdt + dt_struct));
|
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;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!node) {
|
if (!node)
|
||||||
node = root;
|
node = root;
|
||||||
} else {
|
else
|
||||||
if (merge)
|
node = of_new_node(node, pathp);
|
||||||
node = of_get_child_by_name(node,
|
|
||||||
pathp);
|
|
||||||
if (!merge || !node)
|
|
||||||
node = of_new_node(node, pathp);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -179,19 +169,9 @@ struct device_node *of_unflatten_dtb(struct device_node *root, void *infdt)
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
p = NULL;
|
p = of_new_property(node, name, nodep, len);
|
||||||
if (merge)
|
if (!strcmp(name, "phandle") && len == 4)
|
||||||
p = of_find_property(node, name, NULL);
|
node->phandle = be32_to_cpup(p->value);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ void of_print_cmdline(struct device_node *root);
|
||||||
void of_print_nodes(struct device_node *node, int indent);
|
void of_print_nodes(struct device_node *node, int indent);
|
||||||
int of_probe(void);
|
int of_probe(void);
|
||||||
int of_parse_dtb(struct fdt_header *fdt);
|
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;
|
struct cdev;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue