diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-02-19 23:38:32 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-03-06 11:41:27 +0100 |
commit | 8a185a4ff2283c670ffc8724c1b7bdbf8d458cbe (patch) | |
tree | 0c1b954b5915c5d4384c7a5d5be21a03ca710ef6 /arch/arm/boards/highbank | |
parent | 3afab2a83ef55f37c85c8abf13722a1f0b4c82cf (diff) | |
download | barebox-8a185a4ff2283c670ffc8724c1b7bdbf8d458cbe.tar.gz barebox-8a185a4ff2283c670ffc8724c1b7bdbf8d458cbe.tar.xz |
of: let of_unflatten_dtb return the unflattened tree
In order to be able to handle multiple devicetrees, do not assume
the tree to be unflattened is the barebox internal one. Instead,
just return a pointer to it and assign the barebox internal root_node
external to the unflatten function.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/boards/highbank')
-rw-r--r-- | arch/arm/boards/highbank/init.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/arch/arm/boards/highbank/init.c b/arch/arm/boards/highbank/init.c index e36674f0eb..0f64fc8aae 100644 --- a/arch/arm/boards/highbank/init.c +++ b/arch/arm/boards/highbank/init.c @@ -17,6 +17,7 @@ #include <sizes.h> #include <io.h> #include <libfdt.h> +#include <of.h> #define FIRMWARE_DTB_BASE 0x1000 @@ -63,19 +64,21 @@ static int hb_fixup(struct fdt_header *fdt) static int highbank_mem_init(void) { - struct device_node *np; + struct device_node *root, *np; int ret; /* load by the firmware at 0x1000 */ fdt = IOMEM(FIRMWARE_DTB_BASE); - ret = of_unflatten_dtb(fdt); - if (ret) { + root = of_unflatten_dtb(NULL, fdt); + if (!root) { pr_warn("no dtb found at 0x1000 use default configuration\n"); fdt = NULL; goto not_found; } + of_set_root_node(root); + np = of_find_node_by_path("/memory"); if (!np) { pr_warn("no memory node use default configuration\n"); @@ -109,7 +112,7 @@ static int highbank_devices_init(void) highbank_register_xgmac(0); highbank_register_xgmac(1); } else { - fdt = of_get_fixed_tree(fdt); + fdt = of_get_fixed_tree(NULL); add_mem_device("dtb", (unsigned long)fdt, fdt_totalsize(fdt), IORESOURCE_MEM_WRITEABLE); devfs_add_partition("ram0", FIRMWARE_DTB_BASE, SZ_64K, DEVFS_PARTITION_FIXED, "firmware-dtb"); |