diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2013-03-04 10:00:24 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-03-04 12:02:10 +0100 |
commit | ae59bd9fcaa8d117217d4641d3af0ad83a7c7dcd (patch) | |
tree | 51f1589567b7f0c68c5d5bd4e3dfe6d8262366ba /arch/arm/cpu/cache.c | |
parent | 82eb0b547aa48f1ed6ed1e2e42e2e0136de66fac (diff) | |
download | barebox-ae59bd9fcaa8d117217d4641d3af0ad83a7c7dcd.tar.gz barebox-ae59bd9fcaa8d117217d4641d3af0ad83a7c7dcd.tar.xz |
ARM: add early mmu cache flush function and use it in setup_c
Since recently with MMU_EARLY support it may happen that setup_c
runs with data caches enabled, so we have to make sure the caches
are flushed before we jump to the new binary.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch/arm/cpu/cache.c')
-rw-r--r-- | arch/arm/cpu/cache.c | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/arch/arm/cpu/cache.c b/arch/arm/cpu/cache.c index 1254609bb6..95c8338250 100644 --- a/arch/arm/cpu/cache.c +++ b/arch/arm/cpu/cache.c @@ -101,3 +101,36 @@ int arm_set_cache_functions(void) return 0; } + +/* + * Early function to flush the caches. This is for use when the + * C environment is not yet fully initialized. + */ +void arm_early_mmu_cache_flush(void) +{ + switch (arm_early_get_cpu_architecture()) { +#ifdef CONFIG_CPU_32v4T + case CPU_ARCH_ARMv4T: + v4_mmu_cache_flush(); + return; +#endif +#ifdef CONFIG_CPU_32v5 + case CPU_ARCH_ARMv5: + case CPU_ARCH_ARMv5T: + case CPU_ARCH_ARMv5TE: + case CPU_ARCH_ARMv5TEJ: + v5_mmu_cache_flush(); + return; +#endif +#ifdef CONFIG_CPU_32v6 + case CPU_ARCH_ARMv6: + v6_mmu_cache_flush(); + return; +#endif +#ifdef CONFIG_CPU_32v7 + case CPU_ARCH_ARMv7: + v7_mmu_cache_flush(); + return; +#endif + } +} |