Genio SPL runs fastboot with the MMU and CPU caches disabled, making image downloads about twice as slow as with the U-Boot-proper agent. Enable caching to remove this provisioning bottleneck.
Keep the page tables clear of images loaded after fastboot continue, and disable D-cache and the MMU before handing off to the next stage. Signed-off-by: Carlo Caione <[email protected]> --- arch/arm/mach-mediatek/download_agent.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/arch/arm/mach-mediatek/download_agent.c b/arch/arm/mach-mediatek/download_agent.c index 193817cce98..4da2b1a283a 100644 --- a/arch/arm/mach-mediatek/download_agent.c +++ b/arch/arm/mach-mediatek/download_agent.c @@ -4,13 +4,20 @@ * Author: Julien Masson <[email protected]> */ +#include <cpu_func.h> #include <dm/uclass.h> #include <fastboot.h> #include <init.h> +#include <malloc.h> #include <mmc.h> #include <spl.h> #include <stdio.h> +#include <asm/global_data.h> +#include <asm/system.h> #include <linux/errno.h> +#include <linux/sizes.h> + +DECLARE_GLOBAL_DATA_PTR; static int mtk_mmc_boot_prepare(void) { @@ -61,6 +68,19 @@ void spl_board_init(void) { int ret; + if (!CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) { + /* The heap stays clear of the images loaded after fastboot. */ + gd->arch.tlb_size = PGTABLE_SIZE; + gd->arch.tlb_addr = (ulong)memalign(SZ_64K, gd->arch.tlb_size); + if (gd->arch.tlb_addr) { + /* SPL skips arch_cpu_init(), which enables the I-cache. */ + icache_enable(); + dcache_enable(); + } else { + puts("Cannot allocate page tables; running uncached\n"); + } + } + ret = mtk_mmc_boot_prepare(); if (ret) printf("MMC boot preparation failed: %d\n", ret); @@ -70,6 +90,12 @@ void spl_board_init(void) if (ret) printf("Fastboot failed: %d\n", ret); } + +void spl_board_prepare_for_boot(void) +{ + if (!CONFIG_IS_ENABLED(SYS_DCACHE_OFF)) + dcache_disable(); +} #else int board_late_init(void) { -- 2.56.0
