arm: cp15: only map periph device region as dcache off for thunder-boot SPL

Don't waste time to map all 4GB region.

Signed-off-by: Joseph Chen <chenjh@rock-chips.com>
Change-Id: I24ba4e4e42545dcf3ac6622c36995485956eae1b
This commit is contained in:
Joseph Chen 2020-09-17 20:39:26 +08:00
parent d93c779cf8
commit 2a3fb7bb04
1 changed files with 15 additions and 2 deletions

View File

@ -107,7 +107,7 @@ __weak void dram_bank_mmu_setup(int bank)
/* to activate the MMU we need to set up virtual memory: use 1M areas */
static inline void mmu_setup(void)
{
int i;
int i, end;
u32 reg;
#ifndef CONFIG_SPL_BUILD
@ -116,8 +116,21 @@ static inline void mmu_setup(void)
*/
arm_init_before_mmu();
#endif
/*
* SPL thunder-boot:
* only map periph device region to save boot time.
*/
#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_KERNEL_BOOT) && \
defined(PERIPH_DEVICE_START_ADDR)
i = PERIPH_DEVICE_START_ADDR >> MMU_SECTION_SHIFT;
end = PERIPH_DEVICE_END_ADDR >> MMU_SECTION_SHIFT;
#else
i = 0;
end = (4096ULL * 1024 * 1024) >> MMU_SECTION_SHIFT;
#endif
/* Set up an identity-mapping for all 4GB, rw for everyone */
for (i = 0; i < ((4096ULL * 1024 * 1024) >> MMU_SECTION_SHIFT); i++)
for (; i < end; i++)
set_section_dcache(i, DCACHE_OFF);
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {