b9a2e18533
When the Allwinner BROM loads the SPL from an eMMC boot partition, it sets the boot source byte to the same value as when booting from the user data partition. This prevents us from determining the boot source to load U-Boot proper from the proper partition for sure. The generic SPL MMC code already looks at the enabled boot partition number, to load U-Boot proper from the same partition, but this fails if there is nothing bootable in this partition, as the BROM then silently falls back to the user data partition, which the SPL misses. To learn about the actual boot source anyway, we repeat the algorithm the BROM used to select the boot partition in the first place: - Test EXT_CSD[179] to check if an eMMC boot partition is enabled. - Test EXT_CSD[177] to check for valid MMC interface settings. - Check if BOOT_ACK is enabled. - Check the beginning of the first sector for a valid eGON signature. - Load the whole SPL. - Recalculate the checksum to verify the SPL is valid. If one of those steps fails, we bail out and continue loading from the user data partition. Otherwise we load from the selected boot partition. Since the boot source is needed twice in the boot process, we cache the result of this test to avoid doing this costly test multiple times. This allows the very same image file to be put onto an SD card, into the eMMC user data partition or into the eMMC boot partition, and safely loads the whole of U-Boot from there. Signed-off-by: Andre Przywara <andre.przywara@arm.com> |
||
---|---|---|
.. | ||
dram_timings | ||
board.c | ||
clock_sun4i.c | ||
clock_sun6i.c | ||
clock_sun8i_a83t.c | ||
clock_sun9i.c | ||
clock_sun50i_h6.c | ||
clock.c | ||
cpu_info.c | ||
dram_helpers.c | ||
dram_sun4i.c | ||
dram_sun6i.c | ||
dram_sun8i_a23.c | ||
dram_sun8i_a33.c | ||
dram_sun8i_a83t.c | ||
dram_sun9i.c | ||
dram_sun50i_h6.c | ||
dram_sun50i_h616.c | ||
dram_suniv.c | ||
dram_sunxi_dw.c | ||
gtbus_sun9i.c | ||
Kconfig | ||
Makefile | ||
pinmux.c | ||
pmic_bus.c | ||
prcm.c | ||
rmr_switch.S | ||
spl_spi_sunxi.c | ||
timer.c |