summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-05-19 14:40:03 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2014-05-22 08:09:13 +0200
commitd384b5639fc1a3cff60610e375a2096de413b71f (patch)
tree5516633e836d4c9ed89517296c8e1176a8c90072
parentc72a0504c97490c7fdf704d9552c1a9816a797b7 (diff)
downloadbarebox-d384b5639fc1a3cff60610e375a2096de413b71f.tar.gz
barebox-d384b5639fc1a3cff60610e375a2096de413b71f.tar.xz
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>
-rw-r--r--arch/arm/boards/highbank/init.c2
-rw-r--r--arch/arm/cpu/dtb.c2
-rw-r--r--arch/arm/lib/bootm.c2
-rw-r--r--arch/mips/boot/dtb.c2
-rw-r--r--commands/of_dump.c2
-rw-r--r--commands/oftree.c9
-rw-r--r--common/blspec.c2
-rw-r--r--common/bootm.c2
-rw-r--r--drivers/of/fdt.c44
-rw-r--r--include/of.h2
10 files changed, 23 insertions, 46 deletions
diff --git a/arch/arm/boards/highbank/init.c b/arch/arm/boards/highbank/init.c
index d5d341a8ba..7b4f9637df 100644
--- a/arch/arm/boards/highbank/init.c
+++ b/arch/arm/boards/highbank/init.c
@@ -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;
diff --git a/arch/arm/cpu/dtb.c b/arch/arm/cpu/dtb.c
index a5881dd721..abc3ccb4c0 100644
--- a/arch/arm/cpu/dtb.c
+++ b/arch/arm/cpu/dtb.c
@@ -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))
diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c
index 8035468279..1d690522de 100644
--- a/arch/arm/lib/bootm.c
+++ b/arch/arm/lib/bootm.c
@@ -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;
diff --git a/arch/mips/boot/dtb.c b/arch/mips/boot/dtb.c
index c1962bfd0c..23d8979ad5 100644
--- a/arch/mips/boot/dtb.c
+++ b/arch/mips/boot/dtb.c
@@ -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);
diff --git a/commands/of_dump.c b/commands/of_dump.c
index 62140a8111..e3419427d6 100644
--- a/commands/of_dump.c
+++ b/commands/of_dump.c
@@ -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);
diff --git a/commands/oftree.c b/commands/oftree.c
index db31d5901f..2c45b935d2 100644
--- a/commands/oftree.c
+++ b/commands/oftree.c
@@ -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));
diff --git a/common/blspec.c b/common/blspec.c
index f165b77aaa..9314eeab04 100644
--- a/common/blspec.c
+++ b/common/blspec.c
@@ -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;
diff --git a/common/bootm.c b/common/bootm.c
index 12d3ee0c46..b250bd14d6 100644
--- a/common/bootm.c
+++ b/common/bootm.c
@@ -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);
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 3dc5d47602..8e4c7756fb 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -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;
diff --git a/include/of.h b/include/of.h
index 31834284c4..e6993fdde1 100644
--- a/include/of.h
+++ b/include/of.h
@@ -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;