From 746a7e482afb150546b93161c6b7b897abae75c5 Mon Sep 17 00:00:00 2001 From: Andre Przywara Date: Sun, 25 Aug 2024 01:50:12 +0100 Subject: [PATCH] fel: a523: change buffer and load addresses The SRAM situation on the A523 family of SoCs is a bit more involved: while there is indeed a large 128KB SRAM region at offset 0x20000, this is labeled as "MCU0 SRAM" and is apparently switchable, to the RISC-V MCU. It is unclear at this point whether the MCU will take posession of this region at some point, and whether it might not be available when rebooting or doing some suspend/resume operations. The BootROM doesn't use this SRAM, and actually loads the initial boot0/SPL payload from MMC to 0x44000, so at an 16K offset into SRAM A2. To keep the SPL compatible between MMC/SPI and FEL loads (we cannot be position independent), move the SPL address to this 0x44000. This means we do need a swap buffer, since the FEL stack is right on early in this region. The region after 0x5c000 seem to be used by the BROM, so we cannot use that for buffers, without further limiting the FEL payload. To leave the MCU0 SRAM alone, put those buffers in the 16K *before* the new SPL load address. Since U-Boot will use 0x44000 for the initial SPL stack, put the thunk buffer at the beginning, where it should not be overwritten. The scratch address goes at the usual 4K offset of the SPL address, where it is located just before the FEL stack. Signed-off-by: Andre Przywara --- soc_info.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/soc_info.c b/soc_info.c index 92490bd9d..45485b5e0 100644 --- a/soc_info.c +++ b/soc_info.c @@ -180,6 +180,10 @@ sram_swap_buffers f1c100s_sram_swap_buffers[] = { { .size = 0 } /* End of the table */ }; +sram_swap_buffers a523_sram_swap_buffers[] = { + { .buf1 = 0x45000, .buf2 = 0x40200, .size = 0x0400 }, + { .size = 0 } /* End of the table */ +}; /* * Some SoCs put both stacks, BSS and data segments at the end of a comparably * large SRAM, so we don't need to move anything around. @@ -608,11 +612,11 @@ soc_info_t soc_info_table[] = { },{ .soc_id = 0x1890, /* Allwinner A523 */ .name = "A523", - .spl_addr = 0x20000, - .scratch_addr = 0x21000, - .thunk_addr = 0x43e00, .thunk_size = 0x200, - .swap_buffers = no_sram_swap_buffers, - .sram_size = 144 * 1024, + .spl_addr = 0x44000, + .scratch_addr = 0x45000, + .thunk_addr = 0x40000, .thunk_size = 0x200, + .swap_buffers = a523_sram_swap_buffers, + .sram_size = 96 * 1024, .sid_base = 0x03006000, .sid_offset = 0x200, .sid_sections = generic_2k_sid_maps,