diff options
author | Paul Mundt <lethal@linux-sh.org> | 2009-08-14 23:53:39 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-08-14 23:53:39 -0400 |
commit | 0d051d90bb08b516b9d6c30d25f83d3c6b5b1c1d (patch) | |
tree | eb4a84153cf9b7f3b6d7814e7ad61644fff75097 | |
parent | 79f1c9da5e5fc5f4705836d8c1cee2213fc80640 (diff) |
sh: Convert SH7705 extended mode to new cacheflush interface.
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
-rw-r--r-- | arch/sh/include/cpu-sh3/cpu/cacheflush.h | 35 | ||||
-rw-r--r-- | arch/sh/mm/cache-sh7705.c | 33 | ||||
-rw-r--r-- | arch/sh/mm/cache.c | 7 |
3 files changed, 30 insertions, 45 deletions
diff --git a/arch/sh/include/cpu-sh3/cpu/cacheflush.h b/arch/sh/include/cpu-sh3/cpu/cacheflush.h deleted file mode 100644 index 0f5cf5460d05..000000000000 --- a/arch/sh/include/cpu-sh3/cpu/cacheflush.h +++ /dev/null | |||
@@ -1,35 +0,0 @@ | |||
1 | /* | ||
2 | * include/asm-sh/cpu-sh3/cacheflush.h | ||
3 | * | ||
4 | * Copyright (C) 1999 Niibe Yutaka | ||
5 | * | ||
6 | * This file is subject to the terms and conditions of the GNU General Public | ||
7 | * License. See the file "COPYING" in the main directory of this archive | ||
8 | * for more details. | ||
9 | */ | ||
10 | #ifndef __ASM_CPU_SH3_CACHEFLUSH_H | ||
11 | #define __ASM_CPU_SH3_CACHEFLUSH_H | ||
12 | |||
13 | #if defined(CONFIG_SH7705_CACHE_32KB) | ||
14 | /* SH7705 is an SH3 processor with 32KB cache. This has alias issues like the | ||
15 | * SH4. Unlike the SH4 this is a unified cache so we need to do some work | ||
16 | * in mmap when 'exec'ing a new binary | ||
17 | */ | ||
18 | void flush_cache_all(void); | ||
19 | void flush_cache_mm(struct mm_struct *mm); | ||
20 | #define flush_cache_dup_mm(mm) flush_cache_mm(mm) | ||
21 | void flush_cache_range(struct vm_area_struct *vma, unsigned long start, | ||
22 | unsigned long end); | ||
23 | void flush_cache_page(struct vm_area_struct *vma, unsigned long addr, unsigned long pfn); | ||
24 | void flush_dcache_page(struct page *pg); | ||
25 | void flush_icache_range(unsigned long start, unsigned long end); | ||
26 | void flush_icache_page(struct vm_area_struct *vma, struct page *page); | ||
27 | |||
28 | /* SH3 has unified cache so no special action needed here */ | ||
29 | #define flush_cache_sigtramp(vaddr) do { } while (0) | ||
30 | |||
31 | #else | ||
32 | #include <cpu-common/cpu/cacheflush.h> | ||
33 | #endif | ||
34 | |||
35 | #endif /* __ASM_CPU_SH3_CACHEFLUSH_H */ | ||
diff --git a/arch/sh/mm/cache-sh7705.c b/arch/sh/mm/cache-sh7705.c index fa37bff306b9..f1d5c803c04b 100644 --- a/arch/sh/mm/cache-sh7705.c +++ b/arch/sh/mm/cache-sh7705.c | |||
@@ -64,7 +64,7 @@ static inline void cache_wback_all(void) | |||
64 | * | 64 | * |
65 | * Called from kernel/module.c:sys_init_module and routine for a.out format. | 65 | * Called from kernel/module.c:sys_init_module and routine for a.out format. |
66 | */ | 66 | */ |
67 | void flush_icache_range(unsigned long start, unsigned long end) | 67 | static void sh7705_flush_icache_range(unsigned long start, unsigned long end) |
68 | { | 68 | { |
69 | __flush_wback_region((void *)start, end - start); | 69 | __flush_wback_region((void *)start, end - start); |
70 | } | 70 | } |
@@ -72,7 +72,7 @@ void flush_icache_range(unsigned long start, unsigned long end) | |||
72 | /* | 72 | /* |
73 | * Writeback&Invalidate the D-cache of the page | 73 | * Writeback&Invalidate the D-cache of the page |
74 | */ | 74 | */ |
75 | static void __uses_jump_to_uncached __flush_dcache_page(unsigned long phys) | 75 | static void __flush_dcache_page(unsigned long phys) |
76 | { | 76 | { |
77 | unsigned long ways, waysize, addrstart; | 77 | unsigned long ways, waysize, addrstart; |
78 | unsigned long flags; | 78 | unsigned long flags; |
@@ -127,7 +127,7 @@ static void __uses_jump_to_uncached __flush_dcache_page(unsigned long phys) | |||
127 | * Write back & invalidate the D-cache of the page. | 127 | * Write back & invalidate the D-cache of the page. |
128 | * (To avoid "alias" issues) | 128 | * (To avoid "alias" issues) |
129 | */ | 129 | */ |
130 | void flush_dcache_page(struct page *page) | 130 | static void sh7705_flush_dcache_page(struct page *page) |
131 | { | 131 | { |
132 | struct address_space *mapping = page_mapping(page); | 132 | struct address_space *mapping = page_mapping(page); |
133 | 133 | ||
@@ -137,7 +137,7 @@ void flush_dcache_page(struct page *page) | |||
137 | __flush_dcache_page(PHYSADDR(page_address(page))); | 137 | __flush_dcache_page(PHYSADDR(page_address(page))); |
138 | } | 138 | } |
139 | 139 | ||
140 | void __uses_jump_to_uncached flush_cache_all(void) | 140 | static void sh7705_flush_cache_all(void) |
141 | { | 141 | { |
142 | unsigned long flags; | 142 | unsigned long flags; |
143 | 143 | ||
@@ -149,7 +149,7 @@ void __uses_jump_to_uncached flush_cache_all(void) | |||
149 | local_irq_restore(flags); | 149 | local_irq_restore(flags); |
150 | } | 150 | } |
151 | 151 | ||
152 | void flush_cache_mm(struct mm_struct *mm) | 152 | static void sh7705_flush_cache_mm(struct mm_struct *mm) |
153 | { | 153 | { |
154 | /* Is there any good way? */ | 154 | /* Is there any good way? */ |
155 | /* XXX: possibly call flush_cache_range for each vm area */ | 155 | /* XXX: possibly call flush_cache_range for each vm area */ |
@@ -165,8 +165,8 @@ void flush_cache_mm(struct mm_struct *mm) | |||
165 | * Flushing the cache lines for U0 only isn't enough. | 165 | * Flushing the cache lines for U0 only isn't enough. |
166 | * We need to flush for P1 too, which may contain aliases. | 166 | * We need to flush for P1 too, which may contain aliases. |
167 | */ | 167 | */ |
168 | void flush_cache_range(struct vm_area_struct *vma, unsigned long start, | 168 | static void sh7705_flush_cache_range(struct vm_area_struct *vma, |
169 | unsigned long end) | 169 | unsigned long start, unsigned long end) |
170 | { | 170 | { |
171 | 171 | ||
172 | /* | 172 | /* |
@@ -184,8 +184,8 @@ void flush_cache_range(struct vm_area_struct *vma, unsigned long start, | |||
184 | * | 184 | * |
185 | * ADDRESS: Virtual Address (U0 address) | 185 | * ADDRESS: Virtual Address (U0 address) |
186 | */ | 186 | */ |
187 | void flush_cache_page(struct vm_area_struct *vma, unsigned long address, | 187 | static void sh7705_flush_cache_page(struct vm_area_struct *vma, |
188 | unsigned long pfn) | 188 | unsigned long address, unsigned long pfn) |
189 | { | 189 | { |
190 | __flush_dcache_page(pfn << PAGE_SHIFT); | 190 | __flush_dcache_page(pfn << PAGE_SHIFT); |
191 | } | 191 | } |
@@ -198,7 +198,20 @@ void flush_cache_page(struct vm_area_struct *vma, unsigned long address, | |||
198 | * Not entirely sure why this is necessary on SH3 with 32K cache but | 198 | * Not entirely sure why this is necessary on SH3 with 32K cache but |
199 | * without it we get occasional "Memory fault" when loading a program. | 199 | * without it we get occasional "Memory fault" when loading a program. |
200 | */ | 200 | */ |
201 | void flush_icache_page(struct vm_area_struct *vma, struct page *page) | 201 | static void sh7705_flush_icache_page(struct vm_area_struct *vma, |
202 | struct page *page) | ||
202 | { | 203 | { |
203 | __flush_purge_region(page_address(page), PAGE_SIZE); | 204 | __flush_purge_region(page_address(page), PAGE_SIZE); |
204 | } | 205 | } |
206 | |||
207 | void __init sh7705_cache_init(void) | ||
208 | { | ||
209 | flush_icache_range = sh7705_flush_icache_range; | ||
210 | flush_dcache_page = sh7705_flush_dcache_page; | ||
211 | flush_cache_all = sh7705_flush_cache_all; | ||
212 | flush_cache_mm = sh7705_flush_cache_mm; | ||
213 | flush_cache_dup_mm = sh7705_flush_cache_mm; | ||
214 | flush_cache_range = sh7705_flush_cache_range; | ||
215 | flush_cache_page = sh7705_flush_cache_page; | ||
216 | flush_icache_page = sh7705_flush_icache_page; | ||
217 | } | ||
diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c index c9480b48c746..8618ccdc1ca5 100644 --- a/arch/sh/mm/cache.c +++ b/arch/sh/mm/cache.c | |||
@@ -260,6 +260,13 @@ void __init cpu_cache_init(void) | |||
260 | extern void __weak sh3_cache_init(void); | 260 | extern void __weak sh3_cache_init(void); |
261 | 261 | ||
262 | sh3_cache_init(); | 262 | sh3_cache_init(); |
263 | |||
264 | if ((boot_cpu_data.type == CPU_SH7705) && | ||
265 | (boot_cpu_data.dcache.sets == 512)) { | ||
266 | extern void __weak sh7705_cache_init(void); | ||
267 | |||
268 | sh7705_cache_init(); | ||
269 | } | ||
263 | } | 270 | } |
264 | 271 | ||
265 | if ((boot_cpu_data.family == CPU_FAMILY_SH4) || | 272 | if ((boot_cpu_data.family == CPU_FAMILY_SH4) || |