spl_mmc: add Falcon mode support for raw variant
authorPeter Korsgaard <peter.korsgaard@barco.com>
Mon, 13 May 2013 08:36:29 +0000 (08:36 +0000)
committerTom Rini <trini@ti.com>
Fri, 7 Jun 2013 18:17:00 +0000 (14:17 -0400)
If Falcon mode support is enabled (and the system isn't directed into
booting u-boot), it will instead try to load kernel from sector
CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR and
CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS of kernel argument parameters
starting from sector CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR.

Signed-off-by: Peter Korsgaard <peter.korsgaard@barco.com>
README
common/spl/spl_mmc.c

diff --git a/README b/README
index c7b60e462d33b46ef9834af037641b40aee37340..f371e0e2997dd8c2fff59e966eb3f8a36f3a12db 100644 (file)
--- a/README
+++ b/README
@@ -2932,6 +2932,16 @@ FIT uImage format:
                Address, size and 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)
+
+               CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR,
+               CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS
+               Sector and number of sectors to load kernel argument
+               parameters from when MMC is being used in raw mode
+               (for falcon mode)
+
                CONFIG_SPL_FAT_SUPPORT
                Support for fs/fat/libfat.o in SPL binary
 
index d710c0dd4f5aa46fe9954e628aaa1b8a32726f8c..170fa3871a120190ce947cc55d6b8f2e22a4ddcd 100644 (file)
@@ -63,6 +63,21 @@ end:
        return (err == 0);
 }
 
+#ifdef CONFIG_SPL_OS_BOOT
+static int mmc_load_image_raw_os(struct mmc *mmc)
+{
+       if (!mmc->block_dev.block_read(0,
+                                      CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTOR,
+                                      CONFIG_SYS_MMCSD_RAW_MODE_ARGS_SECTORS,
+                                      (void *)CONFIG_SYS_SPL_ARGS_ADDR)) {
+               printf("mmc args blk read error\n");
+               return -1;
+       }
+
+       return mmc_load_image_raw(mmc, CONFIG_SYS_MMCSD_RAW_MODE_KERNEL_SECTOR);
+}
+#endif
+
 #ifdef CONFIG_SPL_FAT_SUPPORT
 static int mmc_load_image_fat(struct mmc *mmc, const char *filename)
 {
@@ -130,6 +145,9 @@ void spl_mmc_load_image(void)
        boot_mode = spl_boot_mode();
        if (boot_mode == MMCSD_MODE_RAW) {
                debug("boot mode - RAW\n");
+#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);
 #ifdef CONFIG_SPL_FAT_SUPPORT