Skip to content

sunxi: Allow FEL capable SPLs with 32bit builds

Andre Przywara u-boot 1 version New

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest9 patches 0 repliesNew

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9armv8: Disable exception vectors in SPL by defaultarch/arm/cpu/armv8/Kconfig arch/arm/cpu/armv8/start.S+3 -30 replies
2/9Makefile: use "arm64" architecture for U-Boot image filesMakefile+8 -22 replies
3/9SPL: read and store arch property from U-Boot imagecommon/spl/spl.c common/spl/spl_fit.c include/spl.h+11 -12 replies
3/9SPL: read and store arch property from U-Boot image+0 -02 replies
4/9sunxi: introduce RMR switch to enter payloads in 64-bit modearch/arm/lib/spl.c arch/arm/mach-sunxi/Makefile arch/arm/mach-sunxi/spl_switch.c+81 -01 reply
4/9sunxi: introduce RMR switch to enter payloads in 64-bit mode+0 -02 replies
5/9sunxi: allow FIT image for 32-bit builds as wellMakefile+1 -11 reply
5/9sunxi: allow FIT image for 32-bit builds as well+0 -01 reply
6/9sunxi: allow 32-bit builds for 64-bit SoCsarch/arm/mach-sunxi/Kconfig+10 -31 reply
6/9sunxi: allow 32-bit builds for 64-bit SoCs+0 -01 reply
7/9sunxi: H5: add generic H5 32-bit SPL defconfigconfigs/sun50i-h5-ddr3-spl_defconfig+16 -00 replies
8/9sunxi: A64: add generic A64 32-bit SPL defconfigsconfigs/sun50i-a64-ddr3-spl_defconfig configs/sun50i-a64-lpddr3-spl_defconfig+30 -00 replies
9/9sunxi: H6: add generic H6 32-bit SPL defconfigconfigs/sun50i-h6-lpddr3-spl_defconfig+12 -00 replies

Reviews trailers per patch

6 of 13 patches have a Reviewed-by or Acked-by.

PatchMatthias BruggerAndre PrzywaraAlexander GrafPhilipp Tomsich
1/9R-b R-b
2/9R-b R-b
3/9R-b
3/9R-b
4/9
4/9
5/9R-b
5/9R-b
6/9
6/9
7/9
8/9
9/9

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 4 reviewers.

Read the v1 thread

Cover letter [U-Boot] [PATCH 0/9] sunxi: Allow FEL capable SPLs with 32bit builds

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!

Cheers,
Andre.

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
Signature · 1 line
2.14.5