summaryrefslogtreecommitdiff
path: root/arch/arm/cpu/armv8/fel_utils.S
AgeCommit message (Collapse)Author
12 dayssunxi: add basic A523 supportAndre Przywara
Add the basic Kconfig options, addresses and other values for the existing Kconfig settings for the new Allwinner A523/T527/H728 SoC. Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2025-06-24sunxi: add support for the Allwinner A100/A133 SoCAndre Przywara
The Allwinner A100 SoC has been around for a while, mostly on cheap tablets, but didn't generate much interest in the community so far. There were some efforts by two Allwinner employees in 2020, which led to basic upstream Linux support for that SoC, although this momentum dried up pretty quickly, leaving a lot of peripherals unsupported. The A100 was silently replaced with the seemingly identical Allwinner A133, which is reportedly a better bin of the A100. So far we assume that both are compatible from a software perspective. There are some more devices with the A133 out there now, so people are working on filling the gaps, and adding U-Boot (and TF-A) support. Based on the just added pinctrl, clock and DRAM support, this adds the missing bits, mostly addresses and values for the SPL. The A133 seems to be an predecessor to the H6, so we can share a lot of code with that (and the H616 code), and just need to adjust some details. Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2025-04-28sunxi: armv8: FEL: save and restore SP_IRQAndre Przywara
Thanks for Jernej's JTAG debugging effort, it turns out that the BROM expects SP_IRQ to be saved and restored, when we want to enter back into FEL after the SPL's AArch64 stint. Save and restore SP_IRQ as part of the FEL state handling. The banked MRS/MSR access to SP_IRQ, without actually being in IRQ mode, was introduced with the ARMv7 virtualisation extensions. The Arm Cortex-A8 cores used in the A10/A13s or older F1C100s SoCs would not support that, but this code here is purely in the ARMv8/AArch64 code path, so it's safe to use unconditionally. Reported-by: Jernej Skrabec <jernej.skrabec@gmail.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
2025-04-28sunxi: armv8: FEL: save and restore GICv3 registersAndre Przywara
To be able to return to the BootROM FEL USB debug code, we must restore the core's state as accurately as possible after the SPL has been run. Since the BootROM runs in AArch32, but the SPL uses AArch64, this requires a core reset, which clears the core's state. So far we were saving and restoring the required registers like SCTLR and VBAR, but could ignore the interrupt controller's state (GICC), since that lives in MMIO registers, unaffected by a core reset. Newer Allwinner SoCs now feature a GICv3 interrupt controller, which keeps some GIC state in architected system registers, and those are cleared when we switch back to AArch32. To enable FEL operation on the Allwinner A523 SoC, Add AArch32 assembly code to save and restore the ICC_PMR and ICC_IGRPEN1 system registers. The other GICv3 sysregs are either not relevant for the BROM operation, or haven't been changed from their reset defaults by the BROM anyway. This enables FEL operation on the Allwinner A523 family of SoCs. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
2025-03-27sunxi: armv8: fel: move fel_stash variable to the frontAndre Przywara
To return a 64-bit Allwinner chip back to the 32-bit BootROM code, we have some embedded AArch32 code that restores the CPU state, before branching back to the BootROM. At the moment the pointer to the buffer with that state is located *after* the code, which makes the PC relative code fragile: adding or removing instructions will change the distance to that pointer variable. The "new" Allwinner A523 SoC requires more state to be restored (GICv3 system registers), but we must do that *only* on that SoC. Conditional compilation sounds like the easiest solution, but would mean that the distance to that pointer would change. Solve this rather easily by moving the pointer to the *front* of the code: we load that pointer in the first instruction, so the distance would always stay the same. Later in the code we won't need PC relative addressing anymore, so this code can grow or shrink easily, for instance due to conditional compilation. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Jernej Skrabec <jernej.skrabec@gmail.com>
2023-10-22sunxi: refactor serial base addresses to avoid asm/arch/cpu.hAndre Przywara
At the moment we have each SoC's memory map defined in its own cpu.h, which is included in include/configs/sunxi_common.h. This will be a problem with the introduction of Allwinner RISC-V support. Remove the inclusion of that header file from the common config header, instead move the required serial base addresses (for the SPL) into a separate header file. Then include the original cpu.h file only where we really need it, which is only under arch/arm now. This disentangles the architecture specific header files from the generic code. Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2023-01-21sunxi: armv8: fel: load only 32-bit valuesAndre Przywara
Both the values and the MMIO addresses that we need during the 64-bit FEL restore are smaller than 2^32, so we don't need to do any 64-bit loads. Change the loads to only load 32 bits worth of data, that saves us some bytes for storing the values. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Samuel Holland <samuel@sholland.org> Tested-by: Samuel Holland <samuel@sholland.org>
2021-09-30WS cleanup: remove SPACE(s) followed by TABWolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de>
2021-01-25sunxi: Add H616 FEL supportJernej Skrabec
H616 uses different address for reset. Add it. Signed-off-by: Jernej Skrabec <jernej.skrabec@siol.net> Reviewed-by: Andre Przywara <andre.przywara@arm.com> Signed-off-by: Andre Przywara <andre.przywara@arm.com>
2021-01-11sunxi: Add arm64 FEL supportAndre Przywara
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)