[U-Boot] [PATCH 1/1] OMAP3: igep00x0: allow booting with a FDT from MMC

Javier Martinez Canillas javier at dowhile0.org
Sun Jul 14 23:58:48 CEST 2013


IGEP boards now have Device Tree support in the mainline
kernel. To boot an IGEP board using a DT, a uEnv.txt plain
text file could be used to define a custom uenvcmd that will
be run by the default boot command.

It is more convenient to change the default boot command to
allow loading a FDT if it is stored in a uSD/MMC partition.
If no FDT is found then the command behaves just as it used
so this change won't break existing setup for current users.

Signed-off-by: Javier Martinez Canillas <javier.martinez at collabora.co.uk>
---
 board/isee/igep00x0/igep00x0.c |   14 ++++++++++++++
 include/configs/igep00x0.h     |    9 +++++++++
 2 files changed, 23 insertions(+), 0 deletions(-)

diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c
index 0d4679d..fdd2773 100644
--- a/board/isee/igep00x0/igep00x0.c
+++ b/board/isee/igep00x0/igep00x0.c
@@ -154,6 +154,18 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
+void set_fdt(void)
+{
+	switch (gd->bd->bi_arch_number) {
+	case MACH_TYPE_IGEP0020:
+		setenv("fdtfile", "omap3-igep0020.dtb");
+		break;
+	case MACH_TYPE_IGEP0030:
+		setenv("fdtfile", "omap3-igep0030.dtb");
+		break;
+	}
+}
+
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
@@ -166,6 +178,8 @@ int misc_init_r(void)
 
 	dieid_num_r();
 
+	set_fdt();
+
 	return 0;
 }
 
diff --git a/include/configs/igep00x0.h b/include/configs/igep00x0.h
index 1d8090b..72752af 100644
--- a/include/configs/igep00x0.h
+++ b/include/configs/igep00x0.h
@@ -149,6 +149,7 @@
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"usbtty=cdc_acm\0" \
 	"loadaddr=0x82000000\0" \
+	"fdtaddr=0x81600000\0" \
 	"usbtty=cdc_acm\0" \
 	"console=ttyO2,115200n8\0" \
 	"mpurate=auto\0" \
@@ -180,9 +181,12 @@
 	"importbootenv=echo Importing environment from mmc ...; " \
 		"env import -t $loadaddr $filesize\0" \
 	"loaduimage=fatload mmc ${mmcdev} ${loadaddr} uImage\0" \
+	"loadfdt=fatload mmc ${mmcdev} ${fdtaddr} ${fdtfile}\0" \
 	"mmcboot=echo Booting from mmc ...; " \
 		"run mmcargs; " \
 		"bootm ${loadaddr}\0" \
+	"mmcbootfdt=echo Booting with DT from mmc ...; " \
+		"bootm ${loadaddr} - ${fdtaddr}\0" \
 	"nandboot=echo Booting from onenand ...; " \
 		"run nandargs; " \
 		"onenand read ${loadaddr} 280000 400000; " \
@@ -199,6 +203,11 @@
 			"run uenvcmd;" \
 		"fi;" \
 		"if run loaduimage; then " \
+			"if test -n $fdtfile; then " \
+				"if run loadfdt; then " \
+					"run mmcbootfdt;" \
+				"fi;" \
+			"fi;" \
 			"run mmcboot;" \
 		"fi;" \
 	"fi;" \
-- 
1.7.7.6



More information about the U-Boot mailing list