public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 1/8] SPL: Add CONFIG_SUPPORT_EMMC_BOOT support to CONFIG_SPL_FRAMEWORK
@ 2014-01-30 21:31 Tom Rini
  2014-01-30 21:31 ` [U-Boot] [PATCH v2 2/8] omap5_uevm: Add CONFIG_SUPPORT_EMMC_BOOT, document usage Tom Rini
                   ` (6 more replies)
  0 siblings, 7 replies; 23+ messages in thread
From: Tom Rini @ 2014-01-30 21:31 UTC (permalink / raw)
  To: u-boot

We use the switch CONFIG_SUPPORT_EMMC_BOOT today to enable some
additional features of the eMMC boot partitions.  Add support for being
told that we have booted from one of these partitions to the spl
framework and implement this on TI OMAP/related.

Cc: Pantelis Antoniou <panto@antoniou-consulting.com>
Signed-off-by: Tom Rini <trini@ti.com>
---
 arch/arm/cpu/armv7/omap-common/boot-common.c |    8 +++++++-
 common/spl/spl_mmc.c                         |   24 ++++++++++++++++++++++++
 include/spl.h                                |    1 +
 3 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/arch/arm/cpu/armv7/omap-common/boot-common.c b/arch/arm/cpu/armv7/omap-common/boot-common.c
index 69fff32..ec0f936 100644
--- a/arch/arm/cpu/armv7/omap-common/boot-common.c
+++ b/arch/arm/cpu/armv7/omap-common/boot-common.c
@@ -66,7 +66,13 @@ u32 spl_boot_device(void)
 
 u32 spl_boot_mode(void)
 {
-	return gd->arch.omap_boot_params.omap_bootmode;
+	u32 val = gd->arch.omap_boot_params.omap_bootmode;
+
+#ifdef CONFIG_SUPPORT_EMMC_BOOT
+	if (val == 0)
+		val = MMCSD_MODE_EMMCBOOT;
+#endif
+	return val;
 }
 
 void spl_board_init(void)
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 13fbff0..fa6f891 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -111,6 +111,30 @@ void spl_mmc_load_image(void)
 					CONFIG_SYS_MMC_SD_FAT_BOOT_PARTITION,
 					CONFIG_SPL_FAT_LOAD_PAYLOAD_NAME);
 #endif
+#ifdef CONFIG_SUPPORT_EMMC_BOOT
+	} else if (boot_mode == MMCSD_MODE_EMMCBOOT) {
+		/*
+		 * We need to check what the partition is configured to.
+		 * 1 and 2 match up to boot0 / boot1 and 7 is user data
+		 * which is the first physical partition (0).
+		 */
+		int part = (mmc->part_config >> 3) & PART_ACCESS_MASK;
+
+		if (part == 7)
+			part = 0;
+
+		if (mmc_switch_part(0, part)) {
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+			puts("MMC partition switch failed\n");
+#endif
+			hang();
+		}
+#ifdef CONFIG_SPL_OS_BOOT
+		if (spl_start_uboot() || mmc_load_image_raw_os(mmc))
+#endif
+		err = mmc_load_image_raw(mmc,
+			CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
+#endif
 	} else {
 #ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
 		puts("spl: wrong MMC boot mode\n");
diff --git a/include/spl.h b/include/spl.h
index 5e24856..dad00c0 100644
--- a/include/spl.h
+++ b/include/spl.h
@@ -16,6 +16,7 @@
 #define MMCSD_MODE_UNDEFINED	0
 #define MMCSD_MODE_RAW		1
 #define MMCSD_MODE_FAT		2
+#define MMCSD_MODE_EMMCBOOT	3
 
 struct spl_image_info {
 	const char *name;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2014-04-22 15:41 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-30 21:31 [U-Boot] [PATCH v2 1/8] SPL: Add CONFIG_SUPPORT_EMMC_BOOT support to CONFIG_SPL_FRAMEWORK Tom Rini
2014-01-30 21:31 ` [U-Boot] [PATCH v2 2/8] omap5_uevm: Add CONFIG_SUPPORT_EMMC_BOOT, document usage Tom Rini
2014-01-30 21:31 ` [U-Boot] [PATCH v2 3/8] dra7xx_evm: " Tom Rini
2014-01-30 21:31 ` [U-Boot] [PATCH v2 4/8] cmd_mmc.c: Change 'bootpart' code to match normal coding style Tom Rini
2014-02-04  0:54   ` Jaehoon Chung
2014-01-30 21:31 ` [U-Boot] [PATCH v2 5/8] cmd_mmc.c: Rename 'bootpart' to 'bootpart-resize' Tom Rini
2014-02-04  0:55   ` Jaehoon Chung
2014-01-30 21:31 ` [U-Boot] [PATCH v2 6/8] cmd_mmc.c: Add 'partconf' command to mmc Tom Rini
2014-02-04  0:58   ` Jaehoon Chung
2014-02-05 13:03     ` Tom Rini
2014-02-06  4:48       ` Jaehoon Chung
2014-01-30 21:31 ` [U-Boot] [PATCH v2 7/8] cmd_mmc.c: Add bootbus mmc sub-command Tom Rini
2014-02-04  0:59   ` Jaehoon Chung
2014-04-18  9:25   ` Michael Trimarchi
2014-04-22 15:41     ` Tom Rini
2014-01-30 21:32 ` [U-Boot] [PATCH v2 8/8] cmd_mmc.c: Drop open/close mmc sub-commands Tom Rini
2014-02-04  0:51   ` Jaehoon Chung
2014-02-04 14:08   ` Otavio Salvador
2014-02-04 14:11     ` Tom Rini
2014-02-04 14:15     ` Otavio Salvador
2014-02-04 14:55       ` Tom Rini
2014-02-17  8:40   ` Lukasz Majewski
2014-02-17  9:30     ` Lukasz Majewski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox