summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Kocialkowski <contact@paulk.fr>2014-11-08 23:14:56 +0100
committerTom Rini <trini@ti.com>2014-12-08 09:35:06 -0500
commitb97300b62f2702bf1c02179a52c9027c8110331a (patch)
tree061a383f3b236506318761cd20e092e3a714543a
parente2ccdf89a0196b40b445700670777ebee231756d (diff)
downloadu-boot-imx-b97300b62f2702bf1c02179a52c9027c8110331a.zip
u-boot-imx-b97300b62f2702bf1c02179a52c9027c8110331a.tar.gz
u-boot-imx-b97300b62f2702bf1c02179a52c9027c8110331a.tar.bz2
spl: MMC U-Boot image load from raw partition
Raw images of U-Boot can be stored inside MMC partitions, so it makes sense to read the partition table, looking for a partition number instead of using a fixed sector address. Signed-off-by: Paul Kocialkowski <contact@paulk.fr> Reviewed-by: Tom Rini <trini@ti.com> [trini: Only add mmc_load_image_raw_partition() when CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION to avoid warning, add missing conversion in spl_mmc_load_image()] Signed-off-by: Tom Rini <trini@ti.com>
-rw-r--r--README4
-rw-r--r--common/spl/spl_mmc.c30
2 files changed, 30 insertions, 4 deletions
diff --git a/README b/README
index f827546..bfefa21 100644
--- a/README
+++ b/README
@@ -3660,6 +3660,10 @@ FIT uImage format:
Address and partition on the MMC to load U-Boot from
when the MMC is being used in raw mode.
+ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
+ Partition on the MMC to load U-Boot from when the MMC is being
+ used in raw mode
+
CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR
Sector to load kernel uImage from when MMC is being
used in raw mode (for Falcon mode)
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index f9c3851..d199f0b 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -15,7 +15,7 @@
DECLARE_GLOBAL_DATA_PTR;
-static int mmc_load_image_raw(struct mmc *mmc, unsigned long sector)
+static int mmc_load_image_raw_sector(struct mmc *mmc, unsigned long sector)
{
unsigned long err;
u32 image_size_sectors;
@@ -51,6 +51,22 @@ end:
return (err == 0);
}
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
+static int mmc_load_image_raw_partition(struct mmc *mmc, int partition)
+{
+ disk_partition_t info;
+
+ if (get_partition_info(&mmc->block_dev, partition, &info)) {
+#ifdef CONFIG_SPL_LIBCOMMON_SUPPORT
+ printf("spl: partition error\n");
+#endif
+ return -1;
+ }
+
+ return mmc_load_image_raw_sector(mmc, info.start);
+}
+#endif
+
#ifdef CONFIG_SPL_OS_BOOT
static int mmc_load_image_raw_os(struct mmc *mmc)
{
@@ -64,7 +80,8 @@ static int mmc_load_image_raw_os(struct mmc *mmc)
return -1;
}
- return mmc_load_image_raw(mmc, CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR);
+ return mmc_load_image_raw_sector(mmc,
+ CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR);
}
#endif
@@ -98,8 +115,13 @@ void spl_mmc_load_image(void)
#ifdef CONFIG_SPL_OS_BOOT
if (spl_start_uboot() || mmc_load_image_raw_os(mmc))
#endif
- err = mmc_load_image_raw(mmc,
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION
+ err = mmc_load_image_raw_partition(mmc,
+ CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_PARTITION);
+#else
+ err = mmc_load_image_raw_sector(mmc,
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
+#endif
#if defined(CONFIG_SPL_FAT_SUPPORT) || defined(CONFIG_SPL_EXT_SUPPORT)
} else if (boot_mode == MMCSD_MODE_FS) {
debug("boot mode - FS\n");
@@ -146,7 +168,7 @@ void spl_mmc_load_image(void)
#ifdef CONFIG_SPL_OS_BOOT
if (spl_start_uboot() || mmc_load_image_raw_os(mmc))
#endif
- err = mmc_load_image_raw(mmc,
+ err = mmc_load_image_raw_sector(mmc,
CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR);
#endif
} else {