diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/sh/Kconfig | 1 | ||||
-rw-r--r-- | arch/sh/boards/mach-landisk/gio.c | 10 | ||||
-rw-r--r-- | arch/sh/mm/cache-sh4.c | 22 | ||||
-rw-r--r-- | arch/sh/mm/cache.c | 10 |
4 files changed, 24 insertions, 19 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig index b940424f8ccc..0dc7e3cbeffa 100644 --- a/arch/sh/Kconfig +++ b/arch/sh/Kconfig | |||
@@ -37,7 +37,6 @@ config SUPERH32 | |||
37 | select HAVE_FTRACE_MCOUNT_RECORD | 37 | select HAVE_FTRACE_MCOUNT_RECORD |
38 | select HAVE_DYNAMIC_FTRACE | 38 | select HAVE_DYNAMIC_FTRACE |
39 | select HAVE_FUNCTION_TRACE_MCOUNT_TEST | 39 | select HAVE_FUNCTION_TRACE_MCOUNT_TEST |
40 | select HAVE_FTRACE_SYSCALLS | ||
41 | select HAVE_FUNCTION_GRAPH_TRACER | 40 | select HAVE_FUNCTION_GRAPH_TRACER |
42 | select HAVE_ARCH_KGDB | 41 | select HAVE_ARCH_KGDB |
43 | select ARCH_HIBERNATION_POSSIBLE if MMU | 42 | select ARCH_HIBERNATION_POSSIBLE if MMU |
diff --git a/arch/sh/boards/mach-landisk/gio.c b/arch/sh/boards/mach-landisk/gio.c index 25cdf7358000..528013188196 100644 --- a/arch/sh/boards/mach-landisk/gio.c +++ b/arch/sh/boards/mach-landisk/gio.c | |||
@@ -14,7 +14,6 @@ | |||
14 | */ | 14 | */ |
15 | #include <linux/module.h> | 15 | #include <linux/module.h> |
16 | #include <linux/init.h> | 16 | #include <linux/init.h> |
17 | #include <linux/smp_lock.h> | ||
18 | #include <linux/kdev_t.h> | 17 | #include <linux/kdev_t.h> |
19 | #include <linux/cdev.h> | 18 | #include <linux/cdev.h> |
20 | #include <linux/fs.h> | 19 | #include <linux/fs.h> |
@@ -35,7 +34,7 @@ static int gio_open(struct inode *inode, struct file *filp) | |||
35 | int minor; | 34 | int minor; |
36 | int ret = -ENOENT; | 35 | int ret = -ENOENT; |
37 | 36 | ||
38 | lock_kernel(); | 37 | preempt_disable(); |
39 | minor = MINOR(inode->i_rdev); | 38 | minor = MINOR(inode->i_rdev); |
40 | if (minor < DEVCOUNT) { | 39 | if (minor < DEVCOUNT) { |
41 | if (openCnt > 0) { | 40 | if (openCnt > 0) { |
@@ -45,7 +44,7 @@ static int gio_open(struct inode *inode, struct file *filp) | |||
45 | ret = 0; | 44 | ret = 0; |
46 | } | 45 | } |
47 | } | 46 | } |
48 | unlock_kernel(); | 47 | preempt_enable(); |
49 | return ret; | 48 | return ret; |
50 | } | 49 | } |
51 | 50 | ||
@@ -60,8 +59,7 @@ static int gio_close(struct inode *inode, struct file *filp) | |||
60 | return 0; | 59 | return 0; |
61 | } | 60 | } |
62 | 61 | ||
63 | static int gio_ioctl(struct inode *inode, struct file *filp, | 62 | static long gio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) |
64 | unsigned int cmd, unsigned long arg) | ||
65 | { | 63 | { |
66 | unsigned int data; | 64 | unsigned int data; |
67 | static unsigned int addr = 0; | 65 | static unsigned int addr = 0; |
@@ -129,7 +127,7 @@ static const struct file_operations gio_fops = { | |||
129 | .owner = THIS_MODULE, | 127 | .owner = THIS_MODULE, |
130 | .open = gio_open, /* open */ | 128 | .open = gio_open, /* open */ |
131 | .release = gio_close, /* release */ | 129 | .release = gio_close, /* release */ |
132 | .ioctl = gio_ioctl, /* ioctl */ | 130 | .unlocked_ioctl = gio_ioctl, |
133 | }; | 131 | }; |
134 | 132 | ||
135 | static int __init gio_init(void) | 133 | static int __init gio_init(void) |
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c index a98c7d8984fa..519e2d16cd06 100644 --- a/arch/sh/mm/cache-sh4.c +++ b/arch/sh/mm/cache-sh4.c | |||
@@ -26,7 +26,7 @@ | |||
26 | #define MAX_DCACHE_PAGES 64 /* XXX: Tune for ways */ | 26 | #define MAX_DCACHE_PAGES 64 /* XXX: Tune for ways */ |
27 | #define MAX_ICACHE_PAGES 32 | 27 | #define MAX_ICACHE_PAGES 32 |
28 | 28 | ||
29 | static void __flush_cache_4096(unsigned long addr, unsigned long phys, | 29 | static void __flush_cache_one(unsigned long addr, unsigned long phys, |
30 | unsigned long exec_offset); | 30 | unsigned long exec_offset); |
31 | 31 | ||
32 | /* | 32 | /* |
@@ -89,8 +89,7 @@ static void __uses_jump_to_uncached sh4_flush_icache_range(void *args) | |||
89 | local_irq_restore(flags); | 89 | local_irq_restore(flags); |
90 | } | 90 | } |
91 | 91 | ||
92 | static inline void flush_cache_4096(unsigned long start, | 92 | static inline void flush_cache_one(unsigned long start, unsigned long phys) |
93 | unsigned long phys) | ||
94 | { | 93 | { |
95 | unsigned long flags, exec_offset = 0; | 94 | unsigned long flags, exec_offset = 0; |
96 | 95 | ||
@@ -103,8 +102,7 @@ static inline void flush_cache_4096(unsigned long start, | |||
103 | exec_offset = 0x20000000; | 102 | exec_offset = 0x20000000; |
104 | 103 | ||
105 | local_irq_save(flags); | 104 | local_irq_save(flags); |
106 | __flush_cache_4096(start | SH_CACHE_ASSOC, | 105 | __flush_cache_one(start | SH_CACHE_ASSOC, P1SEGADDR(phys), exec_offset); |
107 | P1SEGADDR(phys), exec_offset); | ||
108 | local_irq_restore(flags); | 106 | local_irq_restore(flags); |
109 | } | 107 | } |
110 | 108 | ||
@@ -129,8 +127,8 @@ static void sh4_flush_dcache_page(void *arg) | |||
129 | 127 | ||
130 | /* Loop all the D-cache */ | 128 | /* Loop all the D-cache */ |
131 | n = boot_cpu_data.dcache.n_aliases; | 129 | n = boot_cpu_data.dcache.n_aliases; |
132 | for (i = 0; i < n; i++, addr += 4096) | 130 | for (i = 0; i < n; i++, addr += PAGE_SIZE) |
133 | flush_cache_4096(addr, phys); | 131 | flush_cache_one(addr, phys); |
134 | } | 132 | } |
135 | 133 | ||
136 | wmb(); | 134 | wmb(); |
@@ -318,11 +316,11 @@ static void sh4_flush_cache_page(void *args) | |||
318 | /* We only need to flush D-cache when we have alias */ | 316 | /* We only need to flush D-cache when we have alias */ |
319 | if ((address^phys) & alias_mask) { | 317 | if ((address^phys) & alias_mask) { |
320 | /* Loop 4K of the D-cache */ | 318 | /* Loop 4K of the D-cache */ |
321 | flush_cache_4096( | 319 | flush_cache_one( |
322 | CACHE_OC_ADDRESS_ARRAY | (address & alias_mask), | 320 | CACHE_OC_ADDRESS_ARRAY | (address & alias_mask), |
323 | phys); | 321 | phys); |
324 | /* Loop another 4K of the D-cache */ | 322 | /* Loop another 4K of the D-cache */ |
325 | flush_cache_4096( | 323 | flush_cache_one( |
326 | CACHE_OC_ADDRESS_ARRAY | (phys & alias_mask), | 324 | CACHE_OC_ADDRESS_ARRAY | (phys & alias_mask), |
327 | phys); | 325 | phys); |
328 | } | 326 | } |
@@ -337,7 +335,7 @@ static void sh4_flush_cache_page(void *args) | |||
337 | * kernel has never executed the code through its identity | 335 | * kernel has never executed the code through its identity |
338 | * translation. | 336 | * translation. |
339 | */ | 337 | */ |
340 | flush_cache_4096( | 338 | flush_cache_one( |
341 | CACHE_IC_ADDRESS_ARRAY | (address & alias_mask), | 339 | CACHE_IC_ADDRESS_ARRAY | (address & alias_mask), |
342 | phys); | 340 | phys); |
343 | } | 341 | } |
@@ -393,7 +391,7 @@ static void sh4_flush_cache_range(void *args) | |||
393 | } | 391 | } |
394 | 392 | ||
395 | /** | 393 | /** |
396 | * __flush_cache_4096 | 394 | * __flush_cache_one |
397 | * | 395 | * |
398 | * @addr: address in memory mapped cache array | 396 | * @addr: address in memory mapped cache array |
399 | * @phys: P1 address to flush (has to match tags if addr has 'A' bit | 397 | * @phys: P1 address to flush (has to match tags if addr has 'A' bit |
@@ -406,7 +404,7 @@ static void sh4_flush_cache_range(void *args) | |||
406 | * operation (purge/write-back) is selected by the lower 2 bits of | 404 | * operation (purge/write-back) is selected by the lower 2 bits of |
407 | * 'phys'. | 405 | * 'phys'. |
408 | */ | 406 | */ |
409 | static void __flush_cache_4096(unsigned long addr, unsigned long phys, | 407 | static void __flush_cache_one(unsigned long addr, unsigned long phys, |
410 | unsigned long exec_offset) | 408 | unsigned long exec_offset) |
411 | { | 409 | { |
412 | int way_count; | 410 | int way_count; |
diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c index 5e1091be9dc4..a2dc7f9ecc51 100644 --- a/arch/sh/mm/cache.c +++ b/arch/sh/mm/cache.c | |||
@@ -265,6 +265,8 @@ static void __init emit_cache_params(void) | |||
265 | 265 | ||
266 | void __init cpu_cache_init(void) | 266 | void __init cpu_cache_init(void) |
267 | { | 267 | { |
268 | unsigned int cache_disabled = !(__raw_readl(CCR) & CCR_CACHE_ENABLE); | ||
269 | |||
268 | compute_alias(&boot_cpu_data.icache); | 270 | compute_alias(&boot_cpu_data.icache); |
269 | compute_alias(&boot_cpu_data.dcache); | 271 | compute_alias(&boot_cpu_data.dcache); |
270 | compute_alias(&boot_cpu_data.scache); | 272 | compute_alias(&boot_cpu_data.scache); |
@@ -273,6 +275,13 @@ void __init cpu_cache_init(void) | |||
273 | __flush_purge_region = noop__flush_region; | 275 | __flush_purge_region = noop__flush_region; |
274 | __flush_invalidate_region = noop__flush_region; | 276 | __flush_invalidate_region = noop__flush_region; |
275 | 277 | ||
278 | /* | ||
279 | * No flushing is necessary in the disabled cache case so we can | ||
280 | * just keep the noop functions in local_flush_..() and __flush_..() | ||
281 | */ | ||
282 | if (unlikely(cache_disabled)) | ||
283 | goto skip; | ||
284 | |||
276 | if (boot_cpu_data.family == CPU_FAMILY_SH2) { | 285 | if (boot_cpu_data.family == CPU_FAMILY_SH2) { |
277 | extern void __weak sh2_cache_init(void); | 286 | extern void __weak sh2_cache_init(void); |
278 | 287 | ||
@@ -312,5 +321,6 @@ void __init cpu_cache_init(void) | |||
312 | sh5_cache_init(); | 321 | sh5_cache_init(); |
313 | } | 322 | } |
314 | 323 | ||
324 | skip: | ||
315 | emit_cache_params(); | 325 | emit_cache_params(); |
316 | } | 326 | } |