mach-sunxi: Add boot device detection for SUNIV/F1C100s
authorJesse Taube <mr.bossman075@gmail.com>
Sat, 12 Feb 2022 00:32:33 +0000 (19:32 -0500)
committerAndre Przywara <andre.przywara@arm.com>
Thu, 3 Mar 2022 01:23:58 +0000 (01:23 +0000)
commita08b04b5c75a7e9122dfc733c66b978aa0afe4ba
treed94dd6efde92cbaaccaa42cd0dccf9d309eee85e
parentf64aac4a69007771963eaa52a86e733071f9fdd4
mach-sunxi: Add boot device detection for SUNIV/F1C100s

In contrast to other Allwinner SoCs the F1C100s BROM does not store a
boot source indicator in the eGON header in SRAM. This leaves the SPL
guessing where we were exactly booted from, and for instance trying
the SD card first, even though we booted from SPI flash.

By inspecting the BROM code and by experimentation, Samuel found that the
top of the BROM stack contains unique pointers for each of the boot
sources, which we can use as a boot source indicator.

This patch removes the existing board_boot_order bodge and replace it
with a proper boot source indication function.

The only caveat is that this only works in the SPL, as the SPL header
gets overwritten with the exception vectors, once U-Boot proper takes
over. Always return MMC0 as the boot source, when called from U-Boot
proper, as a placeholder for now, until we find another way.

Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
Suggested-by: Samuel Holland <samuel@sholland.org>
Reviewed-by: Andre Przywara <andre.przywara@arm.com>
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
arch/arm/include/asm/arch-sunxi/spl.h
arch/arm/mach-sunxi/board.c