summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-01-16 12:52:07 -0500
committerTom Rini <trini@konsulko.com>2020-01-16 12:52:07 -0500
commit994bb86fc90aa9edff5a6685b28b44e2f77de196 (patch)
tree5d86ff6f1ce8373432414bae1ca351c9e38bea73
parent92329e2413f444d1edf29bab66aefccfd782e0a7 (diff)
parente6a5a5c72b63fd6d2c7ed48b3e49d8da726c69c2 (diff)
downloadu-boot-994bb86fc90aa9edff5a6685b28b44e2f77de196.tar.gz
Merge https://gitlab.denx.de/u-boot/custodians/u-boot-marvell
- Clearfog: Fix SD booting (Baruch) - Misc updates to MMC handling in SPL to support booting from main data partition (vs hardware boot partition) on MVEBU (Baruch)
-rw-r--r--board/solidrun/clearfog/README6
-rw-r--r--common/spl/Kconfig12
-rw-r--r--common/spl/spl_mmc.c15
-rw-r--r--configs/clearfog_defconfig3
4 files changed, 27 insertions, 9 deletions
diff --git a/board/solidrun/clearfog/README b/board/solidrun/clearfog/README
index 6171ce66f4..9375be8495 100644
--- a/board/solidrun/clearfog/README
+++ b/board/solidrun/clearfog/README
@@ -20,12 +20,6 @@ of "/dev/sdX" here!
Install U-Boot on eMMC:
-----------------------
-The ROM loads the bootloader from eMMC first boot partition at offset 0. This
-is unlike load from SD card that is at offset 512. As a result, the offset of
-the main U-Boot image on the eMMC boot partition changes. Set
-CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR to 0x140 for SPL to load U-Boot from
-the correct location.
-
To make SPL load the main U-Boot image from the eMMC boot partition enable
eMMC boot acknowledgement and boot partition with the following U-Boot
command:
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index c43eed2b2a..76f39dc04f 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -329,6 +329,18 @@ 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_U_BOOT_DATA_PART_OFFSET
+ hex "U-Boot main hardware partition image offset"
+ depends on SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
+ default 0x0
+ help
+ On some platforms SPL location depends on hardware partition. The ROM
+ code skips the MBR sector when loading SPL from main hardware data
+ partition. This adds offset to the main U-Boot image. Set this symbol
+ to the number of skipped sectors.
+
+ If unsure, leave the default.
+
config SYS_MMCSD_RAW_MODE_U_BOOT_USE_PARTITION
bool "MMC Raw mode: by partition"
help
diff --git a/common/spl/spl_mmc.c b/common/spl/spl_mmc.c
index 2ede096e61..3e6a17c110 100644
--- a/common/spl/spl_mmc.c
+++ b/common/spl/spl_mmc.c
@@ -49,6 +49,16 @@ static ulong h_spl_load_read(struct spl_load_info *load, ulong sector,
return blk_dread(mmc_get_blk_desc(mmc), sector, count, buf);
}
+static __maybe_unused unsigned long spl_mmc_raw_uboot_offset(int part)
+{
+#if IS_ENABLED(CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR)
+ if (part == 0)
+ return CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET;
+#endif
+
+ return 0;
+}
+
static __maybe_unused
int mmc_load_image_raw_sector(struct spl_image_info *spl_image,
struct mmc *mmc, unsigned long sector)
@@ -325,7 +335,7 @@ int spl_mmc_load(struct spl_image_info *spl_image,
static struct mmc *mmc;
u32 boot_mode;
int err = 0;
- __maybe_unused int part;
+ __maybe_unused int part = 0;
/* Perform peripheral init only once */
if (!mmc) {
@@ -391,7 +401,8 @@ int spl_mmc_load(struct spl_image_info *spl_image,
return err;
#endif
#ifdef CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_USE_SECTOR
- err = mmc_load_image_raw_sector(spl_image, mmc, raw_sect);
+ err = mmc_load_image_raw_sector(spl_image, mmc,
+ raw_sect + spl_mmc_raw_uboot_offset(part));
if (!err)
return err;
#endif
diff --git a/configs/clearfog_defconfig b/configs/clearfog_defconfig
index 787c6360a7..b48a4abfcb 100644
--- a/configs/clearfog_defconfig
+++ b/configs/clearfog_defconfig
@@ -26,7 +26,8 @@ CONFIG_USE_PREBOOT=y
CONFIG_SYS_CONSOLE_INFO_QUIET=y
# CONFIG_DISPLAY_BOARDINFO is not set
CONFIG_DISPLAY_BOARDINFO_LATE=y
-CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x141
+CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET=0x1
+CONFIG_SPL_DM_GPIO=y
CONFIG_SPL_I2C_SUPPORT=y
# CONFIG_CMD_FLASH is not set
CONFIG_CMD_GPIO=y