spl: mmc: Add option to set eMMC HW boot partition
authorMans Rullgard <mans@mansr.com>
Tue, 3 Sep 2019 14:16:50 +0000 (16:16 +0200)
committerTom Rini <trini@konsulko.com>
Fri, 11 Oct 2019 19:33:27 +0000 (15:33 -0400)
This change allows setting pre-defined eMMC boot partition for SPL eMMC
booting. It is necessary in the case when one wants to boot (through falcon
boot) from eMMC after loading SPL from other memory (like SPI-NOR).

Signed-off-by: Mans Rullgard <mans@mansr.com>
[lukma: Edit the commit message]
Signed-off-by: Lukasz Majewski <lukma@denx.de>
Acked-by: Andreas Dannenberg <dannenberg@ti.com>
common/spl/Kconfig
common/spl/spl_mmc.c

index 282d246ea3896d087035f6a77782386afd8bfbe1..7862a0128c774c4df1eb9ac206499f957959b101 100644 (file)
@@ -325,6 +325,12 @@ config SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR
          Address on the MMC to load U-Boot from, when the MMC is being used
          in raw mode. Units: MMC sectors (1 sector = 512 bytes).
 
+config SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
+       int "Number of the eMMC boot partition to use"
+       default 1
+       help
+         eMMC boot partition number to use when the eMMC in raw mode.
+
 config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
        bool "MMC Raw mode: by partition"
        help
index fa19aa76b3e7f48ddff6685b8bfb1a0d40a5ad44..c5cae97099113136f2e778ee0387f5c76246bc0a 100644 (file)
@@ -355,6 +355,9 @@ int spl_mmc_load(struct spl_image_info *spl_image,
        err = -EINVAL;
        switch (boot_mode) {
        case MMCSD_MODE_EMMCBOOT:
+#ifdef CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
+               part = CONFIG_SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION;
+#else
                /*
                 * We need to check what the partition is configured to.
                 * 1 and 2 match up to boot0 / boot1 and 7 is user data
@@ -364,6 +367,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
 
                if (part == 7)
                        part = 0;
+#endif
 
                if (CONFIG_IS_ENABLED(MMC_TINY))
                        err = mmc_switch_part(mmc, part);