Skip to content

Commit

Permalink
CONFIG_SPL_SYS_[DI]CACHE_OFF: add
Browse files Browse the repository at this point in the history
While converting CONFIG_SYS_[DI]CACHE_OFF to Kconfig, there are instances
where these configuration items are conditional on SPL. This commit adds SPL
variants of these configuration items, uses CONFIG_IS_ENABLED(), and updates
the configurations as required.

Acked-by: Alexey Brodkin <[email protected]>
Signed-off-by: Trevor Woerner <[email protected]>
[trini: Make the default depend on the setting for full U-Boot, update
more zynq hardware]
Signed-off-by: Tom Rini <[email protected]>
  • Loading branch information
Trevor Woerner authored and trini committed May 18, 2019
1 parent a0aba8a commit 1001502
Show file tree
Hide file tree
Showing 92 changed files with 206 additions and 114 deletions.
14 changes: 14 additions & 0 deletions arch/arc/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,26 @@ config SYS_ICACHE_OFF
help
Do not enable instruction cache in U-Boot.

config SPL_SYS_ICACHE_OFF
bool "Do not enable icache in SPL"
depends on SPL
default SYS_ICACHE_OFF
help
Do not enable instruction cache in SPL.

config SYS_DCACHE_OFF
bool "Do not enable dcache"
default n
help
Do not enable data cache in U-Boot.

config SPL_SYS_DCACHE_OFF
bool "Do not enable dcache in SPL"
depends on SPL
default SYS_DCACHE_OFF
help
Do not enable data cache in SPL.

menuconfig ARC_DBG
bool "ARC debugging"
default n
Expand Down
4 changes: 2 additions & 2 deletions arch/arc/lib/start.S
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ ENTRY(_start)
lr r5, [ARC_BCR_IC_BUILD]
breq r5, 0, 1f ; I$ doesn't exist
lr r5, [ARC_AUX_IC_CTRL]
#ifndef CONFIG_SYS_ICACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF)
bclr r5, r5, 0 ; 0 - Enable, 1 is Disable
#else
bset r5, r5, 0 ; I$ exists, but is not used
Expand All @@ -37,7 +37,7 @@ ENTRY(_start)
breq r5, 0, 1f ; D$ doesn't exist
lr r5, [ARC_AUX_DC_CTRL]
bclr r5, r5, 6 ; Invalidate (discard w/o wback)
#ifndef CONFIG_SYS_DCACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
bclr r5, r5, 0 ; Enable (+Inv)
#else
bset r5, r5, 0 ; Disable (+Inv)
Expand Down
14 changes: 14 additions & 0 deletions arch/arm/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,26 @@ config SYS_ICACHE_OFF
help
Do not enable instruction cache in U-Boot.

config SPL_SYS_ICACHE_OFF
bool "Do not enable icache in SPL"
depends on SPL
default SYS_ICACHE_OFF
help
Do not enable instruction cache in SPL.

config SYS_DCACHE_OFF
bool "Do not enable dcache"
default n
help
Do not enable data cache in U-Boot.

config SPL_SYS_DCACHE_OFF
bool "Do not enable dcache in SPL"
depends on SPL
default SYS_DCACHE_OFF
help
Do not enable data cache in SPL.

config SYS_ARM_CACHE_CP15
bool "CP15 based cache enabling support"
help
Expand Down
12 changes: 6 additions & 6 deletions arch/arm/cpu/arm11/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static void cache_flush(void)
asm volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (i));
}

#ifndef CONFIG_SYS_DCACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
void invalidate_dcache_all(void)
{
asm volatile("mcr p15, 0, %0, c7, c6, 0" : : "r" (0));
Expand Down Expand Up @@ -87,23 +87,23 @@ void flush_dcache_range(unsigned long start, unsigned long stop)
asm volatile("mcr p15, 0, %0, c7, c10, 4" : : "r" (0));
}

#else /* #ifndef CONFIG_SYS_DCACHE_OFF */
#else /* #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) */
void invalidate_dcache_all(void)
{
}

void flush_dcache_all(void)
{
}
#endif /* #ifndef CONFIG_SYS_DCACHE_OFF */
#endif /* #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) */

#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
void enable_caches(void)
{
#ifndef CONFIG_SYS_ICACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF)
icache_enable();
#endif
#ifndef CONFIG_SYS_DCACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
dcache_enable();
#endif
}
Expand Down
12 changes: 6 additions & 6 deletions arch/arm/cpu/arm926ejs/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <linux/types.h>
#include <common.h>

#ifndef CONFIG_SYS_DCACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
void invalidate_dcache_all(void)
{
asm volatile("mcr p15, 0, %0, c7, c6, 0\n" : : "r"(0));
Expand Down Expand Up @@ -46,15 +46,15 @@ void flush_dcache_range(unsigned long start, unsigned long stop)

asm volatile("mcr p15, 0, %0, c7, c10, 4\n" : : "r"(0));
}
#else /* #ifndef CONFIG_SYS_DCACHE_OFF */
#else /* #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) */
void invalidate_dcache_all(void)
{
}

void flush_dcache_all(void)
{
}
#endif /* #ifndef CONFIG_SYS_DCACHE_OFF */
#endif /* #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) */

/*
* Stub implementations for l2 cache operations
Expand All @@ -66,7 +66,7 @@ __weak void l2_cache_disable(void) {}
__weak void invalidate_l2_cache(void) {}
#endif

#ifndef CONFIG_SYS_ICACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF)
/* Invalidate entire I-cache and branch predictor array */
void invalidate_icache_all(void)
{
Expand All @@ -80,10 +80,10 @@ void invalidate_icache_all(void) {}

void enable_caches(void)
{
#ifndef CONFIG_SYS_ICACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF)
icache_enable();
#endif
#ifndef CONFIG_SYS_DCACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
dcache_enable();
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/cpu/arm926ejs/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ int cleanup_before_linux (void)
/* flush I/D-cache */
static void cache_flush (void)
{
#if !(defined(CONFIG_SYS_ICACHE_OFF) && defined(CONFIG_SYS_DCACHE_OFF))
#if !(CONFIG_IS_ENABLED(SYS_ICACHE_OFF) && CONFIG_IS_ENABLED(SYS_DCACHE_OFF))
unsigned long i = 0;

asm ("mcr p15, 0, %0, c7, c7, 0": :"r" (i));
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/cpu/arm926ejs/start.S
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ flush_dcache:

/*
* disable MMU and D cache
* enable I cache if CONFIG_SYS_ICACHE_OFF is not defined
* enable I cache if SYS_ICACHE_OFF is not defined
*/
mrc p15, 0, r0, c1, c0, 0
bic r0, r0, #0x00000300 /* clear bits 9:8 (---- --RS) */
Expand All @@ -95,7 +95,7 @@ flush_dcache:
bic r0, r0, #0x00002000 /* clear bit 13 (--V- ----) */
#endif
orr r0, r0, #0x00000002 /* set bit 1 (A) Align */
#ifndef CONFIG_SYS_ICACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF)
orr r0, r0, #0x00001000 /* set bit 12 (I) I-Cache */
#endif
mcr p15, 0, r0, c1, c0, 0
Expand Down
8 changes: 4 additions & 4 deletions arch/arm/cpu/armv7/cache_v7.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#define ARMV7_DCACHE_INVAL_RANGE 1
#define ARMV7_DCACHE_CLEAN_INVAL_RANGE 2

#ifndef CONFIG_SYS_DCACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)

/* Asm functions from cache_v7_asm.S */
void v7_flush_dcache_all(void);
Expand Down Expand Up @@ -149,7 +149,7 @@ void mmu_page_table_flush(unsigned long start, unsigned long stop)
flush_dcache_range(start, stop);
v7_inval_tlb();
}
#else /* #ifndef CONFIG_SYS_DCACHE_OFF */
#else /* #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) */
void invalidate_dcache_all(void)
{
}
Expand Down Expand Up @@ -177,9 +177,9 @@ void mmu_page_table_flush(unsigned long start, unsigned long stop)
void arm_init_domains(void)
{
}
#endif /* #ifndef CONFIG_SYS_DCACHE_OFF */
#endif /* #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) */

#ifndef CONFIG_SYS_ICACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF)
/* Invalidate entire I-cache and branch predictor array */
void invalidate_icache_all(void)
{
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/cpu/armv7/iproc-common/hwinit-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include <common.h>

#ifndef CONFIG_SYS_DCACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
void enable_caches(void)
{
/* Enable D-cache. I-cache is already enabled in start.S */
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/cpu/armv7/kona-common/hwinit-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <common.h>
#include <linux/sizes.h>

#ifndef CONFIG_SYS_DCACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
void enable_caches(void)
{
/* Enable D-cache. I-cache is already enabled in start.S */
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/cpu/armv7/ls102xa/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

DECLARE_GLOBAL_DATA_PTR;

#ifndef CONFIG_SYS_DCACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)

/*
* Bit[1] of the descriptor indicates the descriptor type,
Expand Down Expand Up @@ -215,7 +215,7 @@ void enable_caches(void)
invalidate_dcache_all();
set_cr(get_cr() | CR_C);
}
#endif /* #ifndef CONFIG_SYS_DCACHE_OFF */
#endif /* #if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) */


uint get_svr(void)
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/cpu/armv7/start.S
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ ENTRY(c_runtime_cpu_setup)
/*
* If I-cache is enabled invalidate it
*/
#ifndef CONFIG_SYS_ICACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF)
mcr p15, 0, r0, c7, c5, 0 @ invalidate icache
mcr p15, 0, r0, c7, c10, 4 @ DSB
mcr p15, 0, r0, c7, c5, 4 @ ISB
Expand Down Expand Up @@ -155,7 +155,7 @@ ENTRY(cpu_init_cp15)
bic r0, r0, #0x00000007 @ clear bits 2:0 (-CAM)
orr r0, r0, #0x00000002 @ set bit 1 (--A-) Align
orr r0, r0, #0x00000800 @ set bit 11 (Z---) BTB
#ifdef CONFIG_SYS_ICACHE_OFF
#if CONFIG_IS_ENABLED(SYS_ICACHE_OFF)
bic r0, r0, #0x00001000 @ clear bit 12 (I) I-cache
#else
orr r0, r0, #0x00001000 @ set bit 12 (I) I-cache
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/cpu/armv7/vf610/generic.c
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ int get_clocks(void)
return 0;
}

#ifndef CONFIG_SYS_DCACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
void enable_caches(void)
{
#if defined(CONFIG_SYS_ARM_CACHE_WRITETHROUGH)
Expand Down
8 changes: 4 additions & 4 deletions arch/arm/cpu/armv7m/cache.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ enum cache_action {
FLUSH_INVAL_SET_WAY, /* d-cache clean & invalidate by set/ways */
};

#ifndef CONFIG_SYS_DCACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
struct dcache_config {
u32 ways;
u32 sets;
Expand Down Expand Up @@ -292,7 +292,7 @@ void invalidate_dcache_all(void)
}
#endif

#ifndef CONFIG_SYS_ICACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF)

void invalidate_icache_all(void)
{
Expand Down Expand Up @@ -349,10 +349,10 @@ int icache_status(void)

void enable_caches(void)
{
#ifndef CONFIG_SYS_ICACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF)
icache_enable();
#endif
#ifndef CONFIG_SYS_DCACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
dcache_enable();
#endif
}
12 changes: 6 additions & 6 deletions arch/arm/cpu/armv8/cache_v8.c
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

DECLARE_GLOBAL_DATA_PTR;

#ifndef CONFIG_SYS_DCACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)

/*
* With 4k page granule, a virtual address is split into 4 lookup parts
Expand Down Expand Up @@ -657,7 +657,7 @@ void mmu_change_region_attr(phys_addr_t addr, size_t siz, u64 attrs)
__asm_invalidate_tlb_all();
}

#else /* CONFIG_SYS_DCACHE_OFF */
#else /* !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) */

/*
* For SPL builds, we may want to not have dcache enabled. Any real U-Boot
Expand Down Expand Up @@ -694,9 +694,9 @@ void mmu_set_region_dcache_behaviour(phys_addr_t start, size_t size,
{
}

#endif /* CONFIG_SYS_DCACHE_OFF */
#endif /* !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) */

#ifndef CONFIG_SYS_ICACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_ICACHE_OFF)

void icache_enable(void)
{
Expand All @@ -720,7 +720,7 @@ void invalidate_icache_all(void)
__asm_invalidate_l3_icache();
}

#else /* CONFIG_SYS_ICACHE_OFF */
#else /* !CONFIG_IS_ENABLED(SYS_ICACHE_OFF) */

void icache_enable(void)
{
Expand All @@ -739,7 +739,7 @@ void invalidate_icache_all(void)
{
}

#endif /* CONFIG_SYS_ICACHE_OFF */
#endif /* !CONFIG_IS_ENABLED(SYS_ICACHE_OFF) */

/*
* Enable dCache & iCache, whether cache is actually enabled
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/cpu/armv8/fsl-layerscape/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ void cpu_name(char *name)
strcpy(name, "unknown");
}

#ifndef CONFIG_SYS_DCACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)
/*
* To start MMU before DDR is available, we create MMU table in SRAM.
* The base address of SRAM is CONFIG_SYS_FSL_OCRAM_BASE. We use three
Expand Down Expand Up @@ -611,7 +611,7 @@ void enable_caches(void)
icache_enable();
dcache_enable();
}
#endif /* CONFIG_SYS_DCACHE_OFF */
#endif /* !CONFIG_IS_ENABLED(SYS_DCACHE_OFF) */

#ifdef CONFIG_TFABOOT
enum boot_src __get_boot_src(u32 porsr1)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/cpu/armv8/s32v234/cpu.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ u32 cpu_mask(void)
return readl(MC_ME_CS);
}

#ifndef CONFIG_SYS_DCACHE_OFF
#if !CONFIG_IS_ENABLED(SYS_DCACHE_OFF)

#define S32V234_IRAM_BASE 0x3e800000UL
#define S32V234_IRAM_SIZE 0x800000UL
Expand Down
Loading

0 comments on commit 1001502

Please sign in to comment.