2018-05-06 21:58:06 +00:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0+ */
|
2016-05-31 17:45:06 +00:00
|
|
|
/*
|
|
|
|
* Configuration settings for the Allwinner A64 (sun50i) CPU
|
|
|
|
*/
|
|
|
|
|
2017-01-02 11:48:36 +00:00
|
|
|
#if defined(CONFIG_RESERVE_ALLWINNER_BOOT0_HEADER) && !defined(CONFIG_SPL_BUILD)
|
2016-05-31 17:45:06 +00:00
|
|
|
/* reserve space for BOOT0 header information */
|
2017-01-02 11:48:34 +00:00
|
|
|
b reset
|
2016-05-31 17:45:06 +00:00
|
|
|
.space 1532
|
2017-01-02 11:48:36 +00:00
|
|
|
#elif defined(CONFIG_ARM_BOOT_HOOK_RMR)
|
|
|
|
/*
|
|
|
|
* Switch into AArch64 if needed.
|
|
|
|
* Refer to arch/arm/mach-sunxi/rmr_switch.S for the original source.
|
|
|
|
*/
|
|
|
|
tst x0, x0 // this is "b #0x84" in ARM
|
|
|
|
b reset
|
|
|
|
.space 0x7c
|
sunxi: Add arm64 FEL support
So far we did not support the BootROM based FEL USB debug mode on the
64-bit builds for Allwinner SoCs: The BootROM is using AArch32, but the
SPL runs in AArch64.
Returning back to AArch32 was not working as expected, since the RMR
reset into 32-bit mode always starts execution in the BootROM, but not
in the FEL routine.
After some debug and research and with help via IRC, the CPU hotplug
mechanism emerged as a solution: If a certain R_CPUCFG register contains
some magic, the BootROM will immediately branch to an address stored in
some other register. This works well for our purposes.
Enable the FEL feature by providing early AArch32 code to first save the
FEL state, *before* initially entering AArch64.
If we eventually determine that we should return to FEL, we reset back
into AArch32, and use the CPU hotplug mechanism to run some small
AArch32 code snippet that restores the initially saved FEL state.
That allows the normal AArch64 SPL build to be loaded via the sunxi-fel
tool, with it returning into FEL mode, so that other payloads can be
transferred via FEL as well.
Tested on A64, H5 and H6.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Icenowy Zheng <icenowy@aosc.io>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Priit Laes <plaes@plaes.org> (on Olimex A64-Olinuxino)
2016-08-23 21:19:30 +00:00
|
|
|
|
|
|
|
.word 0xe28f0058 // add r0, pc, #88
|
|
|
|
.word 0xe59f1054 // ldr r1, [pc, #84]
|
|
|
|
.word 0xe0800001 // add r0, r0, r1
|
|
|
|
.word 0xe580d000 // str sp, [r0]
|
|
|
|
.word 0xe580e004 // str lr, [r0, #4]
|
|
|
|
.word 0xe10fe000 // mrs lr, CPSR
|
|
|
|
.word 0xe580e008 // str lr, [r0, #8]
|
|
|
|
.word 0xee11ef10 // mrc 15, 0, lr, cr1, cr0, {0}
|
|
|
|
.word 0xe580e00c // str lr, [r0, #12]
|
|
|
|
.word 0xee1cef10 // mrc 15, 0, lr, cr12, cr0, {0}
|
|
|
|
.word 0xe580e010 // str lr, [r0, #16]
|
|
|
|
|
2017-01-02 11:48:36 +00:00
|
|
|
.word 0xe59f1024 // ldr r1, [pc, #36] ; 0x170000a0
|
|
|
|
.word 0xe59f0024 // ldr r0, [pc, #36] ; CONFIG_*_TEXT_BASE
|
|
|
|
.word 0xe5810000 // str r0, [r1]
|
|
|
|
.word 0xf57ff04f // dsb sy
|
|
|
|
.word 0xf57ff06f // isb sy
|
|
|
|
.word 0xee1c0f50 // mrc 15, 0, r0, cr12, cr0, {2} ; RMR
|
|
|
|
.word 0xe3800003 // orr r0, r0, #3
|
|
|
|
.word 0xee0c0f50 // mcr 15, 0, r0, cr12, cr0, {2} ; RMR
|
|
|
|
.word 0xf57ff06f // isb sy
|
|
|
|
.word 0xe320f003 // wfi
|
|
|
|
.word 0xeafffffd // b @wfi
|
2021-01-11 20:11:34 +00:00
|
|
|
#ifndef CONFIG_SUN50I_GEN_H6
|
2017-01-02 11:48:36 +00:00
|
|
|
.word 0x017000a0 // writeable RVBAR mapping address
|
2018-07-21 08:20:22 +00:00
|
|
|
#else
|
|
|
|
.word 0x09010040 // writeable RVBAR mapping address
|
|
|
|
#endif
|
2017-01-02 11:48:36 +00:00
|
|
|
#ifdef CONFIG_SPL_BUILD
|
|
|
|
.word CONFIG_SPL_TEXT_BASE
|
|
|
|
#else
|
2022-10-21 00:22:39 +00:00
|
|
|
.word CONFIG_TEXT_BASE
|
2017-01-02 11:48:36 +00:00
|
|
|
#endif
|
sunxi: Add arm64 FEL support
So far we did not support the BootROM based FEL USB debug mode on the
64-bit builds for Allwinner SoCs: The BootROM is using AArch32, but the
SPL runs in AArch64.
Returning back to AArch32 was not working as expected, since the RMR
reset into 32-bit mode always starts execution in the BootROM, but not
in the FEL routine.
After some debug and research and with help via IRC, the CPU hotplug
mechanism emerged as a solution: If a certain R_CPUCFG register contains
some magic, the BootROM will immediately branch to an address stored in
some other register. This works well for our purposes.
Enable the FEL feature by providing early AArch32 code to first save the
FEL state, *before* initially entering AArch64.
If we eventually determine that we should return to FEL, we reset back
into AArch32, and use the CPU hotplug mechanism to run some small
AArch32 code snippet that restores the initially saved FEL state.
That allows the normal AArch64 SPL build to be loaded via the sunxi-fel
tool, with it returning into FEL mode, so that other payloads can be
transferred via FEL as well.
Tested on A64, H5 and H6.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Tested-by: Icenowy Zheng <icenowy@aosc.io>
Acked-by: Jagan Teki <jagan@amarulasolutions.com>
Tested-by: Priit Laes <plaes@plaes.org> (on Olimex A64-Olinuxino)
2016-08-23 21:19:30 +00:00
|
|
|
.word fel_stash - .
|
2017-01-02 11:48:36 +00:00
|
|
|
#else
|
|
|
|
/* normal execution */
|
|
|
|
b reset
|
|
|
|
#endif
|