diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2012-08-12 14:31:16 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2012-08-13 20:27:43 +0200 |
commit | d5b6012ac1e674e7ce285d6b47cd346d765267d0 (patch) | |
tree | 16e5b6aac37b29b1724c677ea98372c217fbc5b3 /arch | |
parent | bdb4093d3d36986cced0a953ed861ed2d7e55216 (diff) | |
download | barebox-d5b6012ac1e674e7ce285d6b47cd346d765267d0.tar.gz barebox-d5b6012ac1e674e7ce285d6b47cd346d765267d0.tar.xz |
create a common ARM flush_icache function
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/cpu/start-pbl.c | 7 | ||||
-rw-r--r-- | arch/arm/cpu/start.c | 4 | ||||
-rw-r--r-- | arch/arm/include/asm/cache.h | 9 |
3 files changed, 14 insertions, 6 deletions
diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c index 8eb465cc9a..932a3da9e2 100644 --- a/arch/arm/cpu/start-pbl.c +++ b/arch/arm/cpu/start-pbl.c @@ -29,6 +29,7 @@ #include <asm-generic/memory_layout.h> #include <asm/sections.h> #include <asm/pgtable.h> +#include <asm/cache.h> #include "mmu.h" @@ -139,8 +140,7 @@ static void barebox_uncompress(void *compressed_start, unsigned int len) if (use_mmu) mmu_disable(); - /* flush I-cache before jumping to the uncompressed binary */ - __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 0" : : "r" (0)); + flush_icache(); barebox(); } @@ -199,8 +199,7 @@ copy_link: /* clear bss */ memset(__bss_start, 0, __bss_stop - __bss_start); - /* flush I-cache before jumping to the copied binary */ - __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 0" : : "r" (0)); + flush_icache(); r = (unsigned int)&barebox_uncompress; /* call barebox_uncompress with its absolute address */ diff --git a/arch/arm/cpu/start.c b/arch/arm/cpu/start.c index 8365a7516f..07e7dfe822 100644 --- a/arch/arm/cpu/start.c +++ b/arch/arm/cpu/start.c @@ -26,6 +26,7 @@ #include <asm/barebox-arm-head.h> #include <asm-generic/memory_layout.h> #include <asm/sections.h> +#include <asm/cache.h> #ifdef CONFIG_PBL_IMAGE /* @@ -80,8 +81,7 @@ void __naked __section(.text_ll_return) board_init_lowlevel_return(void) /* clear bss */ memset(__bss_start, 0, __bss_stop - __bss_start); - /* flush I-cache before jumping to the copied binary */ - __asm__ __volatile__("mcr p15, 0, %0, c7, c5, 0" : : "r" (0)); + flush_icache(); /* call start_barebox with its absolute address */ r = (unsigned int)&start_barebox; diff --git a/arch/arm/include/asm/cache.h b/arch/arm/include/asm/cache.h new file mode 100644 index 0000000000..ff797493f7 --- /dev/null +++ b/arch/arm/include/asm/cache.h @@ -0,0 +1,9 @@ +#ifndef __ASM_CACHE_H +#define __ASM_CACHE_H + +static inline void flush_icache(void) +{ + asm volatile("mcr p15, 0, %0, c7, c5, 0" : : "r" (0)); +} + +#endif |