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

Sascha Hauer s.hauer at pengutronix.de
Tue Oct 18 07:56:58 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 e3a74f4..d8ca477 100644
--- a/arch/arm/lib/armlinux.c
+++ b/arch/arm/lib/armlinux.c
@@ -36,6 +36,7 @@
 #include <fcntl.h>
 #include <errno.h>
 #include <memory.h>
+#include <of.h>
 
 #include <asm/byteorder.h>
 #include <asm/setup.h>
@@ -209,8 +210,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) {
@@ -220,5 +229,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.7




More information about the barebox mailing list