diff mbox

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

Message ID 1375890799-30350-3-git-send-email-javier.martinez@collabora.co.uk
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Javier Martinez Canillas Aug. 7, 2013, 3:53 p.m. UTC
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 the boot dir of the
rootfs uSD/MMC partition.

If no FDT is found then the defaul command tries to boot a
zImage without a DT using legacy boot.

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

Comments

Tom Rini Aug. 16, 2013, 1:36 p.m. UTC | #1
On Wed, Aug 07, 2013 at 05:53:19PM +0200, Javier Martinez Canillas wrote:

> 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 the boot dir of the
> rootfs uSD/MMC partition.
> 
> If no FDT is found then the defaul command tries to boot a
> zImage without a DT using legacy boot.
> 
> Signed-off-by: Javier Martinez Canillas <javier.martinez@collabora.co.uk>

Applied to u-boot-ti/master, thanks!
diff mbox

Patch

diff --git a/board/isee/igep00x0/igep00x0.c b/board/isee/igep00x0/igep00x0.c
index 77a9bc6..7a7500b 100644
--- a/board/isee/igep00x0/igep00x0.c
+++ b/board/isee/igep00x0/igep00x0.c
@@ -138,6 +138,18 @@  int board_mmc_init(bd_t *bis)
 }
 #endif
 
+void set_fdt(void)
+{
+	switch (gd->bd->bi_arch_number) {
+	case MACH_TYPE_IGEP0020:
+		setenv("dtbfile", "omap3-igep0020.dtb");
+		break;
+	case MACH_TYPE_IGEP0030:
+		setenv("dtbfile", "omap3-igep0030.dtb");
+		break;
+	}
+}
+
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
@@ -150,6 +162,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 b3c57f4..13d58a4 100644
--- a/include/configs/igep00x0.h
+++ b/include/configs/igep00x0.h
@@ -137,6 +137,9 @@ 
 #define CONFIG_EXTRA_ENV_SETTINGS \
 	"usbtty=cdc_acm\0" \
 	"loadaddr=0x82000000\0" \
+	"dtbaddr=0x81600000\0" \
+	"bootdir=/boot\0" \
+	"bootfile=zImage\0" \
 	"usbtty=cdc_acm\0" \
 	"console=ttyO2,115200n8\0" \
 	"mpurate=auto\0" \
@@ -167,10 +170,13 @@ 
 	"loadbootenv=load mmc ${mmcdev} ${loadaddr} uEnv.txt\0" \
 	"importbootenv=echo Importing environment from mmc ...; " \
 		"env import -t $loadaddr $filesize\0" \
-	"loadzimage=load mmc ${mmcdev} ${loadaddr} zImage\0" \
+	"loadzimage=load mmc ${mmcdev}:2 ${loadaddr} ${bootdir}/${bootfile}\0" \
+	"loadfdt=load mmc ${mmcdev}:2 ${dtbaddr} ${bootdir}/${dtbfile}\0" \
 	"mmcboot=echo Booting from mmc ...; " \
 		"run mmcargs; " \
 		"bootz ${loadaddr}\0" \
+	"mmcbootfdt=echo Booting with DT from mmc ...; " \
+		"bootz ${loadaddr} - ${dtbaddr}\0" \
 	"nandboot=echo Booting from onenand ...; " \
 		"run nandargs; " \
 		"onenand read ${loadaddr} 280000 400000; " \
@@ -187,6 +193,11 @@ 
 			"run uenvcmd;" \
 		"fi;" \
 		"if run loadzimage; then " \
+			"if test -n $dtbfile; then " \
+				"if run loadfdt; then " \
+					"run mmcbootfdt;" \
+				"fi;" \
+			"fi;" \
 			"run mmcboot;" \
 		"fi;" \
 	"fi;" \