From 16a98285f8c15678210c378f7f5f568a383eb1c1 Mon Sep 17 00:00:00 2001 From: Brian Hill Date: Thu, 10 Mar 2011 12:39:06 -0700 Subject: [PATCH] Xilinx: ARM: Introduce Device Tree support. Add support for fdt and bootm commands. Use of bootm requires a proper uImage, which may be built by: mkimage -A arm -O linux -T kernel -C none -a 0x8000 -e 0x8000 -n 'Linux' -d arch/arm/boot/Image uImage EXAMPLE USAGE: tftp 0x1000000 linux-2.6-xarm/arch/arm/boot/uImage tftp 0x900000 arm-support/ramdisks/ramdisk8M-amp.image.gz tftp 0x2000000 xilinx.dtb fdt addr 0x2000000 fdt print setenv bootargs console=ttyDF0,9600 root=/dev/ram rw initrd=0x900000,8M earlyprintk debug fdt chosen fdt list /chosen bootm 0x1000000 - 0x2000000 The uImage CRC is verified, and it is copied to the load location. The device tree location is set in r2 for the kernel. --- arch/arm/lib/bootm.c | 20 ++++++++++++++++++++ include/configs/xpele.h | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/arch/arm/lib/bootm.c b/arch/arm/lib/bootm.c index 310132126cd..f9d8d1b6855 100644 --- a/arch/arm/lib/bootm.c +++ b/arch/arm/lib/bootm.c @@ -64,6 +64,22 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima if ((flag != 0) && (flag != BOOTM_STATE_OS_GO)) return 1; +/* HACK BHILL FIXME */ +#if defined(CONFIG_OF_LIBFDT) + int ret; + char *of_flat_tree = NULL; + ulong of_size = 0; + + /* find flattened device tree */ + ret = boot_get_fdt (flag, argc, argv, images, &of_flat_tree, &of_size); + if (ret) { + printf("Error getting device tree: 0x%x\n", ret); + return 1; + } else { + printf("Using device tree at: 0x%08x\n", (unsigned)of_flat_tree); + } +#endif + theKernel = (void (*)(int, int, uint))images->ep; s = getenv ("machid"); @@ -114,7 +130,11 @@ int do_bootm_linux(int flag, int argc, char * const argv[], bootm_headers_t *ima cleanup_before_linux (); +#if defined(CONFIG_OF_LIBFDT) + theKernel (0, machid, of_flat_tree); +#else theKernel (0, machid, bd->bi_boot_params); +#endif /* does not return */ return 1; diff --git a/include/configs/xpele.h b/include/configs/xpele.h index 6f5b3ae7e25..004a8edbe53 100644 --- a/include/configs/xpele.h +++ b/include/configs/xpele.h @@ -13,6 +13,11 @@ #include "../board/xilinx/dfe/xparameters.h" +/* + * Open Firmware flat tree + */ +#define CONFIG_OF_LIBFDT 1 + /* Default environment */ #define CONFIG_IPADDR 10.10.70.102 #define CONFIG_ETHADDR 00:0a:35:00:01:22 -- 2.47.3