diff --git a/arch/arm/cpu/start-pbl.c b/arch/arm/cpu/start-pbl.c index 8eb465c..932a3da 100644 --- a/arch/arm/cpu/start-pbl.c +++ b/arch/arm/cpu/start-pbl.c @@ -29,6 +29,7 @@ #include #include #include +#include #include "mmu.h" @@ -139,8 +140,7 @@ 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 @@ /* 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 8365a75..07e7dfe 100644 --- a/arch/arm/cpu/start.c +++ b/arch/arm/cpu/start.c @@ -26,6 +26,7 @@ #include #include #include +#include #ifdef CONFIG_PBL_IMAGE /* @@ -80,8 +81,7 @@ /* 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 0000000..ff79749 --- /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