[U-Boot] [u-boot][RFC v1] ARMV7: OMAP4+: Fix boot issues when using Alternative Boot operation mode

Oleksandr Tyshchenko oleksandr.tyshchenko at ti.com
Tue Aug 6 12:47:47 CEST 2013


The Alternative Boot operation mode (boot from eMMC boot partition)
is selected through sys_boot pads configuration:
- sys_boot[5:0]=0b101100 for OMAP4 (MMC2_BOOT)
- sys_boot[3:0]=0xb1110 for OMAP5 (eMMC, boot partition only)

So, add new bootdevice BOOT_DEVICE_MMC2_BOOT for OMAP4 and change bootmode
from MMCSD_MODE_UNDEFINED to MMCSD_MODE_RAW for it to support this mode.
As for OMAP5, then only change bootmode to MMCSD_MODE_RAW.

Signed-off-by: Oleksandr Tyshchenko <oleksandr.tyshchenko at ti.com>
---
 arch/arm/cpu/armv7/omap-common/boot-common.c |   21 ++++++++++++++++-----
 arch/arm/include/asm/arch-omap4/spl.h        |    3 ++-
 common/spl/spl.c                             |    1 +
 3 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap-common/boot-common.c b/arch/arm/cpu/armv7/omap-common/boot-common.c
index 76ae1b6..f693b0d 100644
--- a/arch/arm/cpu/armv7/omap-common/boot-common.c
+++ b/arch/arm/cpu/armv7/omap-common/boot-common.c
@@ -29,7 +29,7 @@ void save_omap_boot_params(void)
 {
 	u32 rom_params = *((u32 *)OMAP_SRAM_SCRATCH_BOOT_PARAMS);
 	u8 boot_device;
-	u32 dev_desc, dev_data;
+	u32 dev_desc, dev_data, boot_mode;
 
 	if ((rom_params <  NON_SECURE_SRAM_START) ||
 	    (rom_params > NON_SECURE_SRAM_END))
@@ -51,16 +51,26 @@ void save_omap_boot_params(void)
 #if !defined(CONFIG_AM33XX) && !defined(CONFIG_TI81XX)
 		if ((omap_hw_init_context() ==
 				      OMAP_INIT_CONTEXT_UBOOT_AFTER_SPL)) {
-			gd->arch.omap_boot_params.omap_bootmode =
-			*((u8 *)(rom_params + BOOT_MODE_OFFSET));
+			boot_mode = *((u8 *)(rom_params + BOOT_MODE_OFFSET));
 		} else
 #endif
 		{
 			dev_desc = *((u32 *)(rom_params + DEV_DESC_PTR_OFFSET));
 			dev_data = *((u32 *)(dev_desc + DEV_DATA_PTR_OFFSET));
-			gd->arch.omap_boot_params.omap_bootmode =
-					*((u32 *)(dev_data + BOOT_MODE_OFFSET));
+			boot_mode = *((u32 *)(dev_data + BOOT_MODE_OFFSET));
 		}
+		/*
+		 * Make spl_mmc_load_image() happy with Alternative
+		 * Boot operation mode
+		 */
+#if defined(CONFIG_OMAP44XX)
+		if (boot_device == BOOT_DEVICE_MMC2_BOOT)
+			boot_mode = MMCSD_MODE_RAW;
+#elif defined(CONFIG_OMAP54XX)
+		if (boot_device == BOOT_DEVICE_MMC2)
+			boot_mode = MMCSD_MODE_RAW;
+#endif
+		gd->arch.omap_boot_params.omap_bootmode = boot_mode;
 	}
 }
 
@@ -92,6 +102,7 @@ int board_mmc_init(bd_t *bis)
 		omap_mmc_init(0, 0, 0, -1, -1);
 		break;
 	case BOOT_DEVICE_MMC2:
+	case BOOT_DEVICE_MMC2_BOOT:
 	case BOOT_DEVICE_MMC2_2:
 		omap_mmc_init(1, 0, 0, -1, -1);
 		break;
diff --git a/arch/arm/include/asm/arch-omap4/spl.h b/arch/arm/include/asm/arch-omap4/spl.h
index f61627f..245b81f 100644
--- a/arch/arm/include/asm/arch-omap4/spl.h
+++ b/arch/arm/include/asm/arch-omap4/spl.h
@@ -30,8 +30,9 @@
 #define BOOT_DEVICE_ONENAND	4
 #define BOOT_DEVICE_MMC1	5
 #define BOOT_DEVICE_MMC2	6
+#define BOOT_DEVICE_MMC2_BOOT	8
 #define BOOT_DEVICE_MMC2_2	0xFF
 
 #define MMC_BOOT_DEVICES_START	BOOT_DEVICE_MMC1
-#define MMC_BOOT_DEVICES_END	BOOT_DEVICE_MMC2
+#define MMC_BOOT_DEVICES_END	BOOT_DEVICE_MMC2_BOOT
 #endif
diff --git a/common/spl/spl.c b/common/spl/spl.c
index 628c399..ba91b65 100644
--- a/common/spl/spl.c
+++ b/common/spl/spl.c
@@ -177,6 +177,7 @@ void board_init_r(gd_t *dummy1, ulong dummy2)
 #ifdef CONFIG_SPL_MMC_SUPPORT
 	case BOOT_DEVICE_MMC1:
 	case BOOT_DEVICE_MMC2:
+	case BOOT_DEVICE_MMC2_BOOT:
 	case BOOT_DEVICE_MMC2_2:
 		spl_mmc_load_image();
 		break;
-- 
1.7.9.5



More information about the U-Boot mailing list