summaryrefslogtreecommitdiff
path: root/firmware/target/arm
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/imx31/gigabeat-s/system-target.h32
-rw-r--r--firmware/target/arm/mmu-arm.c30
-rw-r--r--firmware/target/arm/s3c2440/gigabeat-fx/system-target.h14
-rw-r--r--firmware/target/arm/system-pp5002.c6
-rw-r--r--firmware/target/arm/system-pp502x.c6
-rw-r--r--firmware/target/arm/system-target.h9
6 files changed, 45 insertions, 52 deletions
diff --git a/firmware/target/arm/imx31/gigabeat-s/system-target.h b/firmware/target/arm/imx31/gigabeat-s/system-target.h
index ae50ec4c78..921af0ec8b 100644
--- a/firmware/target/arm/imx31/gigabeat-s/system-target.h
+++ b/firmware/target/arm/imx31/gigabeat-s/system-target.h
@@ -57,34 +57,12 @@ void imx31_regclr32(volatile uint32_t *reg_p, uint32_t mask);
57 57
58#define KDEV_INIT 58#define KDEV_INIT
59 59
60#define HAVE_INVALIDATE_ICACHE 60#define HAVE_CPUCACHE_INVALIDATE
61static inline void invalidate_icache(void) 61#define HAVE_CPUCACHE_FLUSH
62{
63 asm volatile(
64 /* Clean and invalidate entire data cache */
65 "mcr p15, 0, %0, c7, c14, 0 \n"
66 /* Invalidate entire instruction cache
67 * Also flushes the branch target cache */
68 "mcr p15, 0, %0, c7, c5, 0 \n"
69 /* Data synchronization barrier */
70 "mcr p15, 0, %0, c7, c10, 4 \n"
71 /* Flush prefetch buffer */
72 "mcr p15, 0, %0, c7, c5, 4 \n"
73 : : "r"(0)
74 );
75}
76 62
77#define HAVE_FLUSH_ICACHE 63/* Different internal names */
78static inline void flush_icache(void) 64#define cpucache_flush clean_dcache
79{ 65#define cpucache_invalidate invalidate_idcache
80 asm volatile (
81 /* Clean entire data cache */
82 "mcr p15, 0, %0, c7, c10, 0 \n"
83 /* Data synchronization barrier */
84 "mcr p15, 0, %0, c7, c10, 4 \n"
85 : : "r"(0)
86 );
87}
88 66
89struct ARM_REGS { 67struct ARM_REGS {
90 int r0; 68 int r0;
diff --git a/firmware/target/arm/mmu-arm.c b/firmware/target/arm/mmu-arm.c
index d86cd430b5..fae7fd0b8f 100644
--- a/firmware/target/arm/mmu-arm.c
+++ b/firmware/target/arm/mmu-arm.c
@@ -265,6 +265,8 @@ void __attribute__((naked)) clean_dcache(void)
265 /* Clean entire data cache */ 265 /* Clean entire data cache */
266 "mov r0, #0 \n" 266 "mov r0, #0 \n"
267 "mcr p15, 0, r0, c7, c10, 0 \n" 267 "mcr p15, 0, r0, c7, c10, 0 \n"
268 /* Data synchronization barrier */
269 "mcr p15, 0, r0, c7, c10, 4 \n"
268 "bx lr \n" 270 "bx lr \n"
269 ); 271 );
270} 272}
@@ -290,3 +292,31 @@ void clean_dcache(void)
290} 292}
291#endif 293#endif
292 294
295#if CONFIG_CPU == IMX31L
296void invalidate_idcache(void)
297{
298 asm volatile(
299 /* Clean and invalidate entire data cache */
300 "mcr p15, 0, %0, c7, c14, 0 \n"
301 /* Invalidate entire instruction cache
302 * Also flushes the branch target cache */
303 "mcr p15, 0, %0, c7, c5, 0 \n"
304 /* Data synchronization barrier */
305 "mcr p15, 0, %0, c7, c10, 4 \n"
306 /* Flush prefetch buffer */
307 "mcr p15, 0, %0, c7, c5, 4 \n"
308 : : "r"(0)
309 );
310}
311#else
312void invalidate_idcache(void)
313{
314 clean_dcache();
315 asm volatile(
316 "mov r0, #0 \n"
317 "mcr p15, 0, r0, c7, c5, 0 \n"
318 : : : "r0"
319 );
320}
321#endif
322
diff --git a/firmware/target/arm/s3c2440/gigabeat-fx/system-target.h b/firmware/target/arm/s3c2440/gigabeat-fx/system-target.h
index 320c595b99..aa7c0aa50c 100644
--- a/firmware/target/arm/s3c2440/gigabeat-fx/system-target.h
+++ b/firmware/target/arm/s3c2440/gigabeat-fx/system-target.h
@@ -41,15 +41,9 @@ void s3c_regset32(volatile unsigned long *reg, unsigned long bits);
41/* Clear register bits */ 41/* Clear register bits */
42void s3c_regclr32(volatile unsigned long *reg, unsigned long bits); 42void s3c_regclr32(volatile unsigned long *reg, unsigned long bits);
43 43
44#define HAVE_INVALIDATE_ICACHE 44#define HAVE_CPUCACHE_FLUSH
45static inline void invalidate_icache(void) 45#define HAVE_CPUCACHE_INVALIDATE
46{ 46#define cpucache_flush clean_dcache
47 clean_dcache(); 47#define cpucache_invalidate invalidate_idcache
48 asm volatile(
49 "mov r0, #0 \n"
50 "mcr p15, 0, r0, c7, c5, 0 \n"
51 : : : "r0"
52 );
53}
54 48
55#endif /* SYSTEM_TARGET_H */ 49#endif /* SYSTEM_TARGET_H */
diff --git a/firmware/target/arm/system-pp5002.c b/firmware/target/arm/system-pp5002.c
index a995a5464b..98bf5f21f1 100644
--- a/firmware/target/arm/system-pp5002.c
+++ b/firmware/target/arm/system-pp5002.c
@@ -62,8 +62,7 @@ void __attribute__((interrupt("IRQ"))) irq_handler(void)
62 some other CPU frequency scaling. */ 62 some other CPU frequency scaling. */
63 63
64#ifndef BOOTLOADER 64#ifndef BOOTLOADER
65void flush_icache(void) ICODE_ATTR; 65void ICODE_ATTR cpucache_flush(void)
66void flush_icache(void)
67{ 66{
68 intptr_t b, e; 67 intptr_t b, e;
69 68
@@ -73,8 +72,7 @@ void flush_icache(void)
73 } 72 }
74} 73}
75 74
76void invalidate_icache(void) ICODE_ATTR; 75void ICODE_ATTR cpucache_invalidate(void)
77void invalidate_icache(void)
78{ 76{
79 intptr_t b, e; 77 intptr_t b, e;
80 78
diff --git a/firmware/target/arm/system-pp502x.c b/firmware/target/arm/system-pp502x.c
index b1cef7152a..10a7651f7b 100644
--- a/firmware/target/arm/system-pp502x.c
+++ b/firmware/target/arm/system-pp502x.c
@@ -163,8 +163,7 @@ void __attribute__((interrupt("IRQ"))) irq_handler(void)
163 to extend the funtions to do alternate cache configurations. */ 163 to extend the funtions to do alternate cache configurations. */
164 164
165#ifndef BOOTLOADER 165#ifndef BOOTLOADER
166void flush_icache(void) ICODE_ATTR; 166void ICODE_ATTR cpucache_flush(void)
167void flush_icache(void)
168{ 167{
169 if (CACHE_CTL & CACHE_CTL_ENABLE) 168 if (CACHE_CTL & CACHE_CTL_ENABLE)
170 { 169 {
@@ -173,8 +172,7 @@ void flush_icache(void)
173 } 172 }
174} 173}
175 174
176void invalidate_icache(void) ICODE_ATTR; 175void ICODE_ATTR cpucache_invalidate(void)
177void invalidate_icache(void)
178{ 176{
179 if (CACHE_CTL & CACHE_CTL_ENABLE) 177 if (CACHE_CTL & CACHE_CTL_ENABLE)
180 { 178 {
diff --git a/firmware/target/arm/system-target.h b/firmware/target/arm/system-target.h
index 4719b8c971..60844e0b5f 100644
--- a/firmware/target/arm/system-target.h
+++ b/firmware/target/arm/system-target.h
@@ -168,13 +168,8 @@ static inline void wake_core(int core)
168 168
169/** cache functions **/ 169/** cache functions **/
170#ifndef BOOTLOADER 170#ifndef BOOTLOADER
171#define CACHE_FUNCTIONS_AS_CALL 171#define HAVE_CPUCACHE_INVALIDATE
172 172#define HAVE_CPUCACHE_FLUSH
173#define HAVE_INVALIDATE_ICACHE
174void invalidate_icache(void);
175
176#define HAVE_FLUSH_ICACHE
177void flush_icache(void);
178#endif 173#endif
179 174
180#endif /* CPU_PP */ 175#endif /* CPU_PP */