summaryrefslogtreecommitdiffstats
path: root/arch/arm/cpu/dtb.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2013-06-23 16:27:20 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-06-26 18:20:53 +0200
commit76571ed68dd16b7fc26f99f12f62c06bde6a193b (patch)
treece1b87ad7f3e757d91884e7fccfb24f392120e5a /arch/arm/cpu/dtb.c
parent0cbb2155193ae04b4b9be501d22339ab80c03fee (diff)
downloadbarebox-76571ed68dd16b7fc26f99f12f62c06bde6a193b.tar.gz
barebox-76571ed68dd16b7fc26f99f12f62c06bde6a193b.tar.xz
ARM: Allow to pass a devicetree via boarddata
Addionally to having a builtin DTB provide the possibility for the board to provide a dtb via boarddata. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/cpu/dtb.c')
-rw-r--r--arch/arm/cpu/dtb.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/arch/arm/cpu/dtb.c b/arch/arm/cpu/dtb.c
index 10b73bd519..a5881dd721 100644
--- a/arch/arm/cpu/dtb.c
+++ b/arch/arm/cpu/dtb.c
@@ -17,20 +17,38 @@
#include <common.h>
#include <init.h>
#include <of.h>
+#include <asm/barebox-arm.h>
extern char __dtb_start[];
static int of_arm_init(void)
{
struct device_node *root;
+ void *fdt;
+ /* See if we already have a dtb */
root = of_get_root_node();
if (root)
return 0;
- root = of_unflatten_dtb(NULL, __dtb_start);
- if (root) {
+ /* See if we are provided a dtb in boarddata */
+ fdt = barebox_arm_boot_dtb();
+ if (fdt)
+ pr_debug("using boarddata provided DTB\n");
+
+ /* Next see if we have a builtin dtb */
+ if (!fdt && IS_ENABLED(CONFIG_BUILTIN_DTB)) {
+ fdt = __dtb_start;
pr_debug("using internal DTB\n");
+ }
+
+ if (!fdt) {
+ pr_debug("No DTB found\n");
+ return 0;
+ }
+
+ root = of_unflatten_dtb(NULL, fdt);
+ if (root) {
of_set_root_node(root);
if (IS_ENABLED(CONFIG_OFDEVICE))
of_probe();