]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
rockchip: spl: Enable caches to speed up checksum validation
authorJonas Karlman <jonas@kwiboo.se>
Sat, 17 Feb 2024 12:34:04 +0000 (12:34 +0000)
committerKever Yang <kever.yang@rock-chips.com>
Thu, 14 Mar 2024 03:48:40 +0000 (11:48 +0800)
FIT checksum validation is very slow in SPL due to D-cache not being
enabled.

Enable caches in SPL on ARM64 SoCs to speed up FIT checksum validation,
from seconds to milliseconds.

This change enables caches in SPL on all Rockchip ARM64 boards, the
Kconfig options SPL_SYS_ICACHE_OFF and SPL_SYS_DCACHE_OFF can be used to
disable caches for a specific board or SoC if needed.

Signed-off-by: Jonas Karlman <jonas@kwiboo.se>
Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
arch/arm/mach-rockchip/spl.c

index 87280e2ba7cc47505ab15b9364017a1a3a254fa8..1586a093fc37c2fea2e5b25dd76487eaee084295 100644 (file)
@@ -3,7 +3,7 @@
  * (C) Copyright 2019 Rockchip Electronics Co., Ltd
  */
 
-#include <common.h>
+#include <cpu_func.h>
 #include <debug_uart.h>
 #include <dm.h>
 #include <hang.h>
@@ -136,6 +136,20 @@ void board_init_f(ulong dummy)
        }
        gd->ram_top = gd->ram_base + get_effective_memsize();
        gd->ram_top = board_get_usable_ram_top(gd->ram_size);
+
+       if (IS_ENABLED(CONFIG_ARM64) && !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) {
+               gd->relocaddr = gd->ram_top;
+               arch_reserve_mmu();
+               enable_caches();
+       }
 #endif
        preloader_console_init();
 }
+
+void spl_board_prepare_for_boot(void)
+{
+       if (!IS_ENABLED(CONFIG_ARM64) || CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
+               return;
+
+       cleanup_before_linux();
+}