
Hi,
this is my first take on the SPL support for the Allwinner A64 SoC. The actual meat - the DRAM initialization code - has been provided by Jens - many thanks for that! The rest of the patches mostly deal with the 32-bit/64-bit switch.
While it is possible and seems natural to let the SPL also run in 64-bit, this creates a really large binary (32600 Bytes in my case). With some hacks (plus some fixes to make the SPL 64-bit safe) I got this to work, but any addition will probably break it and exceed the 32KB limit that the BROM imposes. Debug is the first obvious victim here.
So this series lets the SPL run entirely in AArch32, which is what the BROM comes from anyway. With the help of patch 2/10 and 8/10 we detect that the next binary should be run in AArch64 mode, so patch 9/10 adds the required RMR switch to enter the 64-bit mode. It compiles for me into less than 20 KB, so plenty of room for debug and future code. Technically running the SPL in 32-bit or 64-bit does not make any difference, actually having it in AArch32 helps FEL boot (which works fine with this series).
The only real drawback of this approach is the build process, which is now split between the SPL (AArch32) and the U-Boot proper (AArch64). Patch 10/10 introduces a new defconfig, which defines CPU_V7 and thus creates a 32-bit binary. This requires an ARM cross-compiler or a native compile on an ARM board. The resulting sunxi-spl.bin can then be either directly written to the SD card or later combined with the AArch64 U-Boot proper into one image file.
What this series still lacks is proper Linux support, because we miss the ARM Trusted Firmware (ATF) binary to be loaded and executed. I have patches to extend the SPL FIT support to handle this very nicely in a generic way, but these patches need some clean up. I didn't want this series to be held back any longer, so I will send the FIT patches later.
I appreciate any comments on this series!
Cheers, Andre.
Andre Przywara (7): sun6i: Restrict some register initialization to Allwinner A31 SoC Makefile: use "arm64" architecture for U-Boot image files sunxi: provide default DRAM config for sun50i in Kconfig sunxi: H3/A64: fix non-ODT setting SPL: read and store arch property from U-Boot image sunxi: introduce RMR switch to enter payloads in 64-bit mode sunxi: A64: add 32-bit SPL support
Jens Kuske (3): sunxi: H3: add and rename some DRAM contoller registers sunxi: H3: add DRAM controller single bit delay support sunxi: A64: use H3 DRAM initialization code for A64
Makefile | 9 +- arch/arm/include/asm/arch-sunxi/clock_sun6i.h | 1 + arch/arm/include/asm/arch-sunxi/dram.h | 2 +- arch/arm/include/asm/arch-sunxi/dram_sun8i_h3.h | 51 +++--- arch/arm/lib/spl.c | 14 ++ arch/arm/mach-sunxi/Makefile | 2 + arch/arm/mach-sunxi/clock_sun6i.c | 7 +- arch/arm/mach-sunxi/dram_sun8i_h3.c | 213 +++++++++++++++++------- arch/arm/mach-sunxi/spl_switch.c | 60 +++++++ board/sunxi/Kconfig | 17 +- common/spl/spl.c | 1 + common/spl/spl_fit.c | 8 + configs/pine64_plus_defconfig | 4 +- configs/sun50i_spl32_defconfig | 11 ++ include/spl.h | 3 +- 15 files changed, 308 insertions(+), 95 deletions(-) create mode 100644 arch/arm/mach-sunxi/spl_switch.c create mode 100644 configs/sun50i_spl32_defconfig