[U-Boot] [PATCH 0/9] sunxi: Allow FEL capable SPLs with 32bit builds
andre.przywara at arm.com
Thu Feb 21 01:30:25 UTC 2019
At the moment we can't use the USB-OTG based Allwinner FEL booting method
with mainline U-Boot on ARMv8 Allwinner SoCs. As we run the SPL in AArch64
with the MMU enabled, returning to the BootROM in AArch32 with the MMU off
and matching the BootROM's expectation is not trivial.
To workaround the problem, we can compile at least the SPL in AArch32.
This creates FEL-capable SPLs without further ado.
A second effect is the much smaller code size, due to smaller data types
on one hand, and due to the more compact Thumb2 encoding on the other.
Whereas Aarch64 builds get dangerously close to the 32KB limit, the Thumb2
build is less than 21KB.
This is the cornerstone for more whacky experiments like DRAM autodetection
and supporting multiple SoCs in one build.
So this series adds a Kconfig symbol to toggle between AArch64 and Thumb2
builds for the 64-bit Allwinner SoCs. The latter generates pure 32-bit
binaries (including U-Boot proper), though this is not too useful at the
moment (would require an ATF hack, for instance).
However this can be the base for further 32-bit experiments.
The first patch removes the exception vectors in the SPL build (which were
accidentally disabled anyway), to keep the Aarch64 H6 SPL within the limit.
Patch 02 to 05 prepare the build system and some generic sunxi code parts
for proper 32-bit compilation of ARMv8 boards.
Patch 06 then adds the actual new Kconfig symbol, which toggles the bitness
for a build.
The final three patches add defconfigs for the respective SoCs and their
DRAM variants. They must be build with an ARM(32) (cross) compiler, the
FEL capable SPL can be plucked from spl/sunxi-spl.bin. Short of the DRAM
configuration, there is nothing really board specific in there, so one
SPL defconfig can cover multiple boards.
The 32-bit SPL is flexible enough to launch 64-bit binaries as well, so
it can be combined with a 64-bit U-Boot proper and ATF, and also works
on SD cards, from eMMC or SPI flash. Consider it a drop-in replacement
for the 64-bit SPL build, although this has to be done manually.
Also FEL booting requires the firmware components to be given separately
on the sunxi-fel command line at the moment.
This is tested on the Pine64, Pine64-LTS, Orangepi-PC2 and Pine H64,
with FEL booting, normal AArch64 boots from an SD card and a 32-bit SPL/
64-bit U-Boot proper combination on an SD card.
Looking forward to any comments!
Alexander Graf (1):
armv8: Disable exception vectors in SPL by default
Andre Przywara (8):
Makefile: use "arm64" architecture for U-Boot image files
SPL: read and store arch property from U-Boot image
sunxi: introduce RMR switch to enter payloads in 64-bit mode
sunxi: allow FIT image for 32-bit builds as well
sunxi: allow 32-bit builds for 64-bit SoCs
sunxi: H5: add generic H5 32-bit SPL defconfig
sunxi: A64: add generic A64 32-bit SPL defconfigs
sunxi: H6: add generic H6 32-bit SPL defconfig
Makefile | 12 +++++--
arch/arm/cpu/armv8/Kconfig | 2 +-
arch/arm/cpu/armv8/start.S | 4 +--
arch/arm/lib/spl.c | 14 ++++++++
arch/arm/mach-sunxi/Kconfig | 13 +++++--
arch/arm/mach-sunxi/Makefile | 3 ++
arch/arm/mach-sunxi/spl_switch.c | 64 +++++++++++++++++++++++++++++++++
common/spl/spl.c | 1 +
common/spl/spl_fit.c | 8 +++++
configs/sun50i-a64-ddr3-spl_defconfig | 13 +++++++
configs/sun50i-a64-lpddr3-spl_defconfig | 17 +++++++++
configs/sun50i-h5-ddr3-spl_defconfig | 16 +++++++++
configs/sun50i-h6-lpddr3-spl_defconfig | 12 +++++++
include/spl.h | 3 +-
14 files changed, 172 insertions(+), 10 deletions(-)
create mode 100644 arch/arm/mach-sunxi/spl_switch.c
create mode 100644 configs/sun50i-a64-ddr3-spl_defconfig
create mode 100644 configs/sun50i-a64-lpddr3-spl_defconfig
create mode 100644 configs/sun50i-h5-ddr3-spl_defconfig
create mode 100644 configs/sun50i-h6-lpddr3-spl_defconfig
More information about the U-Boot