sunxi: SPL SPI: Allow larger SPL
authorAndre Przywara <andre.przywara@arm.com>
Mon, 5 Jul 2021 23:04:43 +0000 (00:04 +0100)
committerAndre Przywara <andre.przywara@arm.com>
Mon, 25 Oct 2021 13:48:58 +0000 (14:48 +0100)
commit0ec88323dae7a91f535c2c9db45cb3c925507ea2
tree31382bccefce234825efad838a15c7d789a30b29
parent95d9ffd7b678414cc79365c8d2be0d12c326a7ad
sunxi: SPL SPI: Allow larger SPL

The more recent Allwinner SoCs BootROMs can actually load SPL images
larger than 32KB. We use this on the H616 to fit the extra code needed
for the PMIC into the image, and have provisions in board.c to respect
that larger SPL size when booting from MMC.

However the sunxi SPL SPI loader has a hardcoded load offset of 32KB,
which will fail on the H616.

To fix this, use the same algorithm we use for MMC: if the SPL size is
smaller than 32KB, we use 32KB, otherwise we expect the U-Boot payload
directly after the SPL code.

This prepares for SPI booting with larger SPLs like on the H616.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Jagan Teki <jagan@amarulasolutions.com>
arch/arm/mach-sunxi/spl_spi_sunxi.c