diff options
author | Andre Przywara <andre.przywara@arm.com> | 2020-01-10 01:47:32 +0000 |
---|---|---|
committer | Jagan Teki <jagan@amarulasolutions.com> | 2020-01-26 19:10:16 +0530 |
commit | 7c841d844f6d3192731603733e0d5986ce03f11c (patch) | |
tree | 9534a901024c56fb0d57ab7c2e0aa066fc590c8f /arch | |
parent | ee98d768930b7c8f9dffbfd06e3cec2f2cc146d9 (diff) | |
download | u-boot-7c841d844f6d3192731603733e0d5986ce03f11c.zip u-boot-7c841d844f6d3192731603733e0d5986ce03f11c.tar.gz u-boot-7c841d844f6d3192731603733e0d5986ce03f11c.tar.bz2 |
sunxi: Automate loading from 128KB MMC offset
Since commit 067e0b9684d4 ("sunxi: Allow booting from 128KB SD/eMMC offset")
we support having the SPL loaded from either the traditional 8KB SD
card/eMMC offset, or from the alternative location at 128KB. However the
sector to find the U-Boot image was still hard-coded at compile time,
and had to be adjusted for one of the two choices.
Since we can actually override the function to return the sector offset,
we can just check the boot source byte there to select the proper offset
based on from where the SPL was loaded.
This allows the very same binary image to be loaded from either 128KB or
8KB, with the U-Boot proper image always being located just behind the SPL.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-sunxi/board.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/arch/arm/mach-sunxi/board.c b/arch/arm/mach-sunxi/board.c index 9c0cf71..b487b26 100644 --- a/arch/arm/mach-sunxi/board.c +++ b/arch/arm/mach-sunxi/board.c @@ -274,6 +274,26 @@ uint32_t sunxi_get_boot_device(void) } #ifdef CONFIG_SPL_BUILD +/* + * The eGON SPL image can be located at 8KB or at 128KB into an SD card or + * an eMMC device. The boot source has bit 4 set in the latter case. + * By adding 120KB to the normal offset when booting from a "high" location + * we can support both cases. + */ +unsigned long spl_mmc_get_uboot_raw_sector(struct mmc *mmc) +{ + unsigned long sector = CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR; + + switch (sunxi_get_boot_source()) { + case SUNXI_BOOTED_FROM_MMC0_HIGH: + case SUNXI_BOOTED_FROM_MMC2_HIGH: + sector += (128 - 8) * 2; + break; + } + + return sector; +} + u32 spl_boot_device(void) { return sunxi_get_boot_device(); |