[PATCH 3/3] ARM Linux: Add device tree support

Sascha Hauer s.hauer at pengutronix.de
Wed Aug 24 16:46:03 EDT 2011


If the user has parsed a tree, we start Linux using the
device tree, otherwise we use the traditional ATAG
mechanism.

Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/lib/armlinux.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/arch/arm/lib/armlinux.c b/arch/arm/lib/armlinux.c
index 5bdbb92..f34e721 100644
--- a/arch/arm/lib/armlinux.c
+++ b/arch/arm/lib/armlinux.c
@@ -35,6 +35,7 @@
 #include <malloc.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <of.h>
 
 #include <asm/byteorder.h>
 #include <asm/setup.h>
@@ -202,8 +203,16 @@ void armlinux_set_serial(u64 serial)
 void start_linux(void *adr, int swap, struct image_data *data)
 {
 	void (*kernel)(int zero, int arch, void *params) = adr;
-
-	setup_tags(data, swap);
+	void *params = NULL;
+#ifdef CONFIG_OFTREE
+	params = of_get_fixed_tree();
+	if (params)
+		printf("booting Linux kernel with devicetree\n");
+#endif
+	if (!params) {
+		setup_tags(data, swap);
+		params = armlinux_bootparams;
+	}
 
 	shutdown_barebox();
 	if (swap) {
@@ -213,5 +222,5 @@ void start_linux(void *adr, int swap, struct image_data *data)
 		__asm__ __volatile__("mcr p15, 0, %0, c1, c0" :: "r" (reg));
 	}
 
-	kernel(0, armlinux_architecture, armlinux_bootparams);
+	kernel(0, armlinux_architecture, params);
 }
-- 
1.7.5.4




More information about the barebox mailing list