diff options
Diffstat (limited to 'arch/m68k/include/asm/m54xxacr.h')
-rw-r--r-- | arch/m68k/include/asm/m54xxacr.h | 58 |
1 files changed, 51 insertions, 7 deletions
diff --git a/arch/m68k/include/asm/m54xxacr.h b/arch/m68k/include/asm/m54xxacr.h index da713d22dd0f..7d28da4d622a 100644 --- a/arch/m68k/include/asm/m54xxacr.h +++ b/arch/m68k/include/asm/m54xxacr.h | |||
@@ -40,31 +40,75 @@ | |||
40 | #define ACR_CM 0x00000060 /* Cache mode mask */ | 40 | #define ACR_CM 0x00000060 /* Cache mode mask */ |
41 | #define ACR_WPROTECT 0x00000004 /* Write protect */ | 41 | #define ACR_WPROTECT 0x00000004 /* Write protect */ |
42 | 42 | ||
43 | #if defined(CONFIG_M5407) | ||
44 | |||
45 | #define ICACHE_SIZE 0x4000 /* instruction - 16k */ | ||
46 | #define DCACHE_SIZE 0x2000 /* data - 8k */ | ||
47 | |||
48 | #elif defined(CONFIG_M548x) | ||
49 | |||
50 | #define ICACHE_SIZE 0x8000 /* instruction - 32k */ | ||
51 | #define DCACHE_SIZE 0x8000 /* data - 32k */ | ||
52 | |||
53 | #endif | ||
54 | |||
55 | #define CACHE_LINE_SIZE 0x0010 /* 16 bytes */ | ||
56 | #define CACHE_WAYS 4 /* 4 ways */ | ||
57 | |||
58 | /* | ||
59 | * Version 4 cores have a true harvard style separate instruction | ||
60 | * and data cache. Enable data and instruction caches, also enable write | ||
61 | * buffers and branch accelerator. | ||
62 | */ | ||
63 | /* attention : enabling CACR_DESB requires a "nop" to flush the store buffer */ | ||
64 | /* use '+' instead of '|' for assembler's sake */ | ||
65 | |||
66 | /* Enable data cache */ | ||
67 | /* Enable data store buffer */ | ||
68 | /* outside ACRs : No cache, precise */ | ||
69 | /* Enable instruction+branch caches */ | ||
70 | #define CACHE_MODE (CACR_DEC+CACR_DESB+CACR_DDCM_P+CACR_BEC+CACR_IEC) | ||
71 | |||
72 | #define DATA_CACHE_MODE (ACR_ENABLE+ACR_ANY+ACR_CM_WT) | ||
73 | |||
74 | #define INSN_CACHE_MODE (ACR_ENABLE+ACR_ANY) | ||
75 | |||
43 | #ifndef __ASSEMBLY__ | 76 | #ifndef __ASSEMBLY__ |
44 | 77 | ||
78 | #if ((DATA_CACHE_MODE & ACR_CM) == ACR_CM_WT) | ||
79 | #define flush_dcache_range(a, l) do { asm("nop"); } while (0) | ||
80 | #endif | ||
81 | |||
45 | static inline void __m54xx_flush_cache_all(void) | 82 | static inline void __m54xx_flush_cache_all(void) |
46 | { | 83 | { |
84 | __asm__ __volatile__ ( | ||
85 | #if ((DATA_CACHE_MODE & ACR_CM) == ACR_CM_CP) | ||
47 | /* | 86 | /* |
48 | * Use cpushl to push and invalidate all cache lines. | 87 | * Use cpushl to push and invalidate all cache lines. |
49 | * Gas doesn't seem to know how to generate the ColdFire | 88 | * Gas doesn't seem to know how to generate the ColdFire |
50 | * cpushl instruction... Oh well, bit stuff it for now. | 89 | * cpushl instruction... Oh well, bit stuff it for now. |
51 | */ | 90 | */ |
52 | __asm__ __volatile__ ( | ||
53 | "nop\n\t" | ||
54 | "clrl %%d0\n\t" | 91 | "clrl %%d0\n\t" |
55 | "1:\n\t" | 92 | "1:\n\t" |
56 | "movel %%d0,%%a0\n\t" | 93 | "movel %%d0,%%a0\n\t" |
57 | "2:\n\t" | 94 | "2:\n\t" |
58 | ".word 0xf468\n\t" | 95 | ".word 0xf468\n\t" |
59 | "addl #0x10,%%a0\n\t" | 96 | "addl %0,%%a0\n\t" |
60 | "cmpl #0x00000800,%%a0\n\t" | 97 | "cmpl %1,%%a0\n\t" |
61 | "blt 2b\n\t" | 98 | "blt 2b\n\t" |
62 | "addql #1,%%d0\n\t" | 99 | "addql #1,%%d0\n\t" |
63 | "cmpil #4,%%d0\n\t" | 100 | "cmpil %2,%%d0\n\t" |
64 | "bne 1b\n\t" | 101 | "bne 1b\n\t" |
65 | "movel #0xb6088500,%%d0\n\t" | 102 | #endif |
103 | "movel %3,%%d0\n\t" | ||
66 | "movec %%d0,%%CACR\n\t" | 104 | "movec %%d0,%%CACR\n\t" |
67 | : : : "d0", "a0" ); | 105 | "nop\n\t" /* forces flush of Store Buffer */ |
106 | : /* No output */ | ||
107 | : "i" (CACHE_LINE_SIZE), | ||
108 | "i" (DCACHE_SIZE / CACHE_WAYS), | ||
109 | "i" (CACHE_WAYS), | ||
110 | "i" (CACHE_MODE|CACR_DCINVA|CACR_BCINVA|CACR_ICINVA) | ||
111 | : "d0", "a0" ); | ||
68 | } | 112 | } |
69 | 113 | ||
70 | #define __flush_cache_all() __m54xx_flush_cache_all() | 114 | #define __flush_cache_all() __m54xx_flush_cache_all() |