aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-11-04 05:54:15 -0500
committerIngo Molnar <mingo@elte.hu>2009-11-04 05:59:45 -0500
commita2e71271535fde493c32803b1f34789f97efcb5e (patch)
tree90d7139bea2f49e947f27af92614fa6eca50b64d /arch/sh
parent6d7aa9d721c8c640066142fd9534afcdf68d7f9d (diff)
parentb419148e567728f6af0c3b01965c1cc141e3e13a (diff)
Merge commit 'v2.6.32-rc6' into perf/core
Conflicts: tools/perf/Makefile Merge reason: Resolve the conflict, merge to upstream and merge in perf fixes so we can add a dependent patch. Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/Kconfig6
-rw-r--r--arch/sh/Makefile3
-rw-r--r--arch/sh/boards/mach-landisk/gio.c10
-rw-r--r--arch/sh/boards/mach-rsk/devices-rsk7203.c4
-rw-r--r--arch/sh/boards/mach-rsk/setup.c23
-rw-r--r--arch/sh/boot/Makefile6
-rw-r--r--arch/sh/kernel/dwarf.c22
-rw-r--r--arch/sh/kernel/irq.c3
-rw-r--r--arch/sh/kernel/sh_ksyms_32.c14
-rw-r--r--arch/sh/mm/Kconfig2
-rw-r--r--arch/sh/mm/cache-sh4.c22
-rw-r--r--arch/sh/mm/cache.c10
12 files changed, 89 insertions, 36 deletions
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index b940424f8ccc..88cdeb9f72d9 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
@@ -122,6 +121,9 @@ config SYS_SUPPORTS_APM_EMULATION
122 bool 121 bool
123 select ARCH_SUSPEND_POSSIBLE 122 select ARCH_SUSPEND_POSSIBLE
124 123
124config SYS_SUPPORTS_HUGETLBFS
125 bool
126
125config SYS_SUPPORTS_SMP 127config SYS_SUPPORTS_SMP
126 bool 128 bool
127 129
@@ -196,6 +198,7 @@ config CPU_SH4
196 select CPU_HAS_SR_RB 198 select CPU_HAS_SR_RB
197 select CPU_HAS_FPU if !CPU_SH4AL_DSP 199 select CPU_HAS_FPU if !CPU_SH4AL_DSP
198 select SYS_SUPPORTS_TMU 200 select SYS_SUPPORTS_TMU
201 select SYS_SUPPORTS_HUGETLBFS if MMU
199 202
200config CPU_SH4A 203config CPU_SH4A
201 bool 204 bool
@@ -210,6 +213,7 @@ config CPU_SH5
210 bool 213 bool
211 select CPU_HAS_FPU 214 select CPU_HAS_FPU
212 select SYS_SUPPORTS_TMU 215 select SYS_SUPPORTS_TMU
216 select SYS_SUPPORTS_HUGETLBFS if MMU
213 217
214config CPU_SHX2 218config CPU_SHX2
215 bool 219 bool
diff --git a/arch/sh/Makefile b/arch/sh/Makefile
index fc51a918b31a..66e40aabc600 100644
--- a/arch/sh/Makefile
+++ b/arch/sh/Makefile
@@ -199,7 +199,7 @@ endif
199libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y) 199libs-$(CONFIG_SUPERH32) := arch/sh/lib/ $(libs-y)
200libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y) 200libs-$(CONFIG_SUPERH64) := arch/sh/lib64/ $(libs-y)
201 201
202BOOT_TARGETS = uImage uImage.bz2 uImage.gz uImage.lzma uImage.srec \ 202BOOT_TARGETS = uImage uImage.bz2 uImage.gz uImage.lzma uImage.srec uImage.bin \
203 zImage vmlinux.srec romImage 203 zImage vmlinux.srec romImage
204PHONY += maketools $(BOOT_TARGETS) FORCE 204PHONY += maketools $(BOOT_TARGETS) FORCE
205 205
@@ -225,6 +225,7 @@ define archhelp
225 @echo ' vmlinux.srec - Create an ELF S-record' 225 @echo ' vmlinux.srec - Create an ELF S-record'
226 @echo '* uImage - Alias to bootable U-Boot image' 226 @echo '* uImage - Alias to bootable U-Boot image'
227 @echo ' uImage.srec - Create an S-record for U-Boot' 227 @echo ' uImage.srec - Create an S-record for U-Boot'
228 @echo ' uImage.bin - Kernel-only image for U-Boot (bin)'
228 @echo '* uImage.gz - Kernel-only image for U-Boot (gzip)' 229 @echo '* uImage.gz - Kernel-only image for U-Boot (gzip)'
229 @echo ' uImage.bz2 - Kernel-only image for U-Boot (bzip2)' 230 @echo ' uImage.bz2 - Kernel-only image for U-Boot (bzip2)'
230 @echo ' uImage.lzma - Kernel-only image for U-Boot (lzma)' 231 @echo ' uImage.lzma - Kernel-only image for U-Boot (lzma)'
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
63static int gio_ioctl(struct inode *inode, struct file *filp, 62static 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
135static int __init gio_init(void) 133static int __init gio_init(void)
diff --git a/arch/sh/boards/mach-rsk/devices-rsk7203.c b/arch/sh/boards/mach-rsk/devices-rsk7203.c
index 4af3a771c058..c37617e63220 100644
--- a/arch/sh/boards/mach-rsk/devices-rsk7203.c
+++ b/arch/sh/boards/mach-rsk/devices-rsk7203.c
@@ -11,10 +11,6 @@
11#include <linux/types.h> 11#include <linux/types.h>
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/mtd/mtd.h>
15#include <linux/mtd/partitions.h>
16#include <linux/mtd/physmap.h>
17#include <linux/mtd/map.h>
18#include <linux/smsc911x.h> 14#include <linux/smsc911x.h>
19#include <linux/gpio.h> 15#include <linux/gpio.h>
20#include <linux/leds.h> 16#include <linux/leds.h>
diff --git a/arch/sh/boards/mach-rsk/setup.c b/arch/sh/boards/mach-rsk/setup.c
index af64d030a5c7..a5c0df785bfe 100644
--- a/arch/sh/boards/mach-rsk/setup.c
+++ b/arch/sh/boards/mach-rsk/setup.c
@@ -15,14 +15,12 @@
15#include <linux/mtd/mtd.h> 15#include <linux/mtd/mtd.h>
16#include <linux/mtd/partitions.h> 16#include <linux/mtd/partitions.h>
17#include <linux/mtd/physmap.h> 17#include <linux/mtd/physmap.h>
18#ifdef CONFIG_MTD
18#include <linux/mtd/map.h> 19#include <linux/mtd/map.h>
20#endif
19#include <asm/machvec.h> 21#include <asm/machvec.h>
20#include <asm/io.h> 22#include <asm/io.h>
21 23
22static const char *probes[] = { "cmdlinepart", NULL };
23
24static struct mtd_partition *parsed_partitions;
25
26static struct mtd_partition rsk_partitions[] = { 24static struct mtd_partition rsk_partitions[] = {
27 { 25 {
28 .name = "Bootloader", 26 .name = "Bootloader",
@@ -41,6 +39,8 @@ static struct mtd_partition rsk_partitions[] = {
41}; 39};
42 40
43static struct physmap_flash_data flash_data = { 41static struct physmap_flash_data flash_data = {
42 .parts = rsk_partitions,
43 .nr_parts = ARRAY_SIZE(rsk_partitions),
44 .width = 2, 44 .width = 2,
45}; 45};
46 46
@@ -60,7 +60,8 @@ static struct platform_device flash_device = {
60 }, 60 },
61}; 61};
62 62
63static struct mtd_info *flash_mtd; 63#ifdef CONFIG_MTD
64static const char *probes[] = { "cmdlinepart", NULL };
64 65
65static struct map_info rsk_flash_map = { 66static struct map_info rsk_flash_map = {
66 .name = "RSK+ Flash", 67 .name = "RSK+ Flash",
@@ -68,6 +69,10 @@ static struct map_info rsk_flash_map = {
68 .bankwidth = 2, 69 .bankwidth = 2,
69}; 70};
70 71
72static struct mtd_info *flash_mtd;
73
74static struct mtd_partition *parsed_partitions;
75
71static void __init set_mtd_partitions(void) 76static void __init set_mtd_partitions(void)
72{ 77{
73 int nr_parts = 0; 78 int nr_parts = 0;
@@ -77,14 +82,14 @@ static void __init set_mtd_partitions(void)
77 nr_parts = parse_mtd_partitions(flash_mtd, probes, 82 nr_parts = parse_mtd_partitions(flash_mtd, probes,
78 &parsed_partitions, 0); 83 &parsed_partitions, 0);
79 /* If there is no partition table, used the hard coded table */ 84 /* If there is no partition table, used the hard coded table */
80 if (nr_parts <= 0) { 85 if (nr_parts > 0) {
81 flash_data.parts = rsk_partitions;
82 flash_data.nr_parts = ARRAY_SIZE(rsk_partitions);
83 } else {
84 flash_data.nr_parts = nr_parts; 86 flash_data.nr_parts = nr_parts;
85 flash_data.parts = parsed_partitions; 87 flash_data.parts = parsed_partitions;
86 } 88 }
87} 89}
90#else
91static inline void set_mtd_partitions(void) {}
92#endif
88 93
89static struct platform_device *rsk_devices[] __initdata = { 94static struct platform_device *rsk_devices[] __initdata = {
90 &flash_device, 95 &flash_device,
diff --git a/arch/sh/boot/Makefile b/arch/sh/boot/Makefile
index a1316872be6f..cb8cf5572e79 100644
--- a/arch/sh/boot/Makefile
+++ b/arch/sh/boot/Makefile
@@ -20,11 +20,12 @@ CONFIG_BOOT_LINK_OFFSET ?= 0x00800000
20CONFIG_ZERO_PAGE_OFFSET ?= 0x00001000 20CONFIG_ZERO_PAGE_OFFSET ?= 0x00001000
21CONFIG_ENTRY_OFFSET ?= 0x00001000 21CONFIG_ENTRY_OFFSET ?= 0x00001000
22 22
23suffix-y := bin
23suffix-$(CONFIG_KERNEL_GZIP) := gz 24suffix-$(CONFIG_KERNEL_GZIP) := gz
24suffix-$(CONFIG_KERNEL_BZIP2) := bz2 25suffix-$(CONFIG_KERNEL_BZIP2) := bz2
25suffix-$(CONFIG_KERNEL_LZMA) := lzma 26suffix-$(CONFIG_KERNEL_LZMA) := lzma
26 27
27targets := zImage vmlinux.srec romImage uImage uImage.srec uImage.gz uImage.bz2 uImage.lzma 28targets := zImage vmlinux.srec romImage uImage uImage.srec uImage.gz uImage.bz2 uImage.lzma uImage.bin
28extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma 29extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma
29subdir- := compressed romimage 30subdir- := compressed romimage
30 31
@@ -88,6 +89,9 @@ $(obj)/uImage.gz: $(obj)/vmlinux.bin.gz
88$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma 89$(obj)/uImage.lzma: $(obj)/vmlinux.bin.lzma
89 $(call if_changed,uimage,lzma) 90 $(call if_changed,uimage,lzma)
90 91
92$(obj)/uImage.bin: $(obj)/vmlinux.bin
93 $(call if_changed,uimage,none)
94
91OBJCOPYFLAGS_vmlinux.srec := -I binary -O srec 95OBJCOPYFLAGS_vmlinux.srec := -I binary -O srec
92$(obj)/vmlinux.srec: $(obj)/compressed/vmlinux 96$(obj)/vmlinux.srec: $(obj)/compressed/vmlinux
93 $(call if_changed,objcopy) 97 $(call if_changed,objcopy)
diff --git a/arch/sh/kernel/dwarf.c b/arch/sh/kernel/dwarf.c
index 03b3616c80a5..2d07084e4882 100644
--- a/arch/sh/kernel/dwarf.c
+++ b/arch/sh/kernel/dwarf.c
@@ -20,6 +20,7 @@
20#include <linux/list.h> 20#include <linux/list.h>
21#include <linux/mempool.h> 21#include <linux/mempool.h>
22#include <linux/mm.h> 22#include <linux/mm.h>
23#include <linux/ftrace.h>
23#include <asm/dwarf.h> 24#include <asm/dwarf.h>
24#include <asm/unwinder.h> 25#include <asm/unwinder.h>
25#include <asm/sections.h> 26#include <asm/sections.h>
@@ -557,6 +558,27 @@ struct dwarf_frame * dwarf_unwind_stack(unsigned long pc,
557 if (!pc && !prev) 558 if (!pc && !prev)
558 pc = (unsigned long)current_text_addr(); 559 pc = (unsigned long)current_text_addr();
559 560
561#ifdef CONFIG_FUNCTION_GRAPH_TRACER
562 /*
563 * If our stack has been patched by the function graph tracer
564 * then we might see the address of return_to_handler() where we
565 * expected to find the real return address.
566 */
567 if (pc == (unsigned long)&return_to_handler) {
568 int index = current->curr_ret_stack;
569
570 /*
571 * We currently have no way of tracking how many
572 * return_to_handler()'s we've seen. If there is more
573 * than one patched return address on our stack,
574 * complain loudly.
575 */
576 WARN_ON(index > 0);
577
578 pc = current->ret_stack[index].ret;
579 }
580#endif
581
560 frame = mempool_alloc(dwarf_frame_pool, GFP_ATOMIC); 582 frame = mempool_alloc(dwarf_frame_pool, GFP_ATOMIC);
561 if (!frame) { 583 if (!frame) {
562 printk(KERN_ERR "Unable to allocate a dwarf frame\n"); 584 printk(KERN_ERR "Unable to allocate a dwarf frame\n");
diff --git a/arch/sh/kernel/irq.c b/arch/sh/kernel/irq.c
index 7cb933ba4957..eac7da772fc2 100644
--- a/arch/sh/kernel/irq.c
+++ b/arch/sh/kernel/irq.c
@@ -11,6 +11,7 @@
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/kernel_stat.h> 12#include <linux/kernel_stat.h>
13#include <linux/seq_file.h> 13#include <linux/seq_file.h>
14#include <linux/ftrace.h>
14#include <asm/processor.h> 15#include <asm/processor.h>
15#include <asm/machvec.h> 16#include <asm/machvec.h>
16#include <asm/uaccess.h> 17#include <asm/uaccess.h>
@@ -106,7 +107,7 @@ static union irq_ctx *hardirq_ctx[NR_CPUS] __read_mostly;
106static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly; 107static union irq_ctx *softirq_ctx[NR_CPUS] __read_mostly;
107#endif 108#endif
108 109
109asmlinkage int do_IRQ(unsigned int irq, struct pt_regs *regs) 110asmlinkage __irq_entry int do_IRQ(unsigned int irq, struct pt_regs *regs)
110{ 111{
111 struct pt_regs *old_regs = set_irq_regs(regs); 112 struct pt_regs *old_regs = set_irq_regs(regs);
112#ifdef CONFIG_IRQSTACKS 113#ifdef CONFIG_IRQSTACKS
diff --git a/arch/sh/kernel/sh_ksyms_32.c b/arch/sh/kernel/sh_ksyms_32.c
index 86c270428357..444cce3ae921 100644
--- a/arch/sh/kernel/sh_ksyms_32.c
+++ b/arch/sh/kernel/sh_ksyms_32.c
@@ -85,6 +85,20 @@ DECLARE_EXPORT(__movstr_i4_even);
85DECLARE_EXPORT(__movstr_i4_odd); 85DECLARE_EXPORT(__movstr_i4_odd);
86DECLARE_EXPORT(__movstrSI12_i4); 86DECLARE_EXPORT(__movstrSI12_i4);
87DECLARE_EXPORT(__movmem); 87DECLARE_EXPORT(__movmem);
88DECLARE_EXPORT(__movmemSI8);
89DECLARE_EXPORT(__movmemSI12);
90DECLARE_EXPORT(__movmemSI16);
91DECLARE_EXPORT(__movmemSI20);
92DECLARE_EXPORT(__movmemSI24);
93DECLARE_EXPORT(__movmemSI28);
94DECLARE_EXPORT(__movmemSI32);
95DECLARE_EXPORT(__movmemSI36);
96DECLARE_EXPORT(__movmemSI40);
97DECLARE_EXPORT(__movmemSI44);
98DECLARE_EXPORT(__movmemSI48);
99DECLARE_EXPORT(__movmemSI52);
100DECLARE_EXPORT(__movmemSI56);
101DECLARE_EXPORT(__movmemSI60);
88DECLARE_EXPORT(__movmem_i4_even); 102DECLARE_EXPORT(__movmem_i4_even);
89DECLARE_EXPORT(__movmem_i4_odd); 103DECLARE_EXPORT(__movmem_i4_odd);
90DECLARE_EXPORT(__movmemSI12_i4); 104DECLARE_EXPORT(__movmemSI12_i4);
diff --git a/arch/sh/mm/Kconfig b/arch/sh/mm/Kconfig
index 64dc1ad59801..7f7b52f9beba 100644
--- a/arch/sh/mm/Kconfig
+++ b/arch/sh/mm/Kconfig
@@ -227,7 +227,7 @@ endchoice
227 227
228choice 228choice
229 prompt "HugeTLB page size" 229 prompt "HugeTLB page size"
230 depends on HUGETLB_PAGE && (CPU_SH4 || CPU_SH5) && MMU 230 depends on HUGETLB_PAGE
231 default HUGETLB_PAGE_SIZE_1MB if PAGE_SIZE_64KB 231 default HUGETLB_PAGE_SIZE_1MB if PAGE_SIZE_64KB
232 default HUGETLB_PAGE_SIZE_64K 232 default HUGETLB_PAGE_SIZE_64K
233 233
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
29static void __flush_cache_4096(unsigned long addr, unsigned long phys, 29static 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
92static inline void flush_cache_4096(unsigned long start, 92static 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 */
409static void __flush_cache_4096(unsigned long addr, unsigned long phys, 407static 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
266void __init cpu_cache_init(void) 266void __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
324skip:
315 emit_cache_params(); 325 emit_cache_params();
316} 326}