summaryrefslogtreecommitdiffstats
path: root/arch/sh
diff options
context:
space:
mode:
authorPaul Mundt <lethal@linux-sh.org>2009-10-16 15:14:50 +0900
committerPaul Mundt <lethal@linux-sh.org>2009-10-16 15:14:50 +0900
commitabeaf33a4101764291ec79cf286e08c0966eb26e (patch)
treebb3f8ae60d1ff0d99a907bcc223886f9d71fafea /arch/sh
parent731ba3301de41d2ffae9dd3e0f85f7361d8ad8f4 (diff)
parent52a94909f00e0ffceeac202e517a126d57c1c523 (diff)
downloadlinux-abeaf33a4101764291ec79cf286e08c0966eb26e.tar.gz
linux-abeaf33a4101764291ec79cf286e08c0966eb26e.tar.bz2
linux-abeaf33a4101764291ec79cf286e08c0966eb26e.zip
Merge branch 'sh/stable-updates'
Conflicts: arch/sh/mm/cache-sh4.c
Diffstat (limited to 'arch/sh')
-rw-r--r--arch/sh/boards/mach-landisk/gio.c10
-rw-r--r--arch/sh/mm/cache-sh4.c26
-rw-r--r--arch/sh/mm/cache.c10
3 files changed, 26 insertions, 20 deletions
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 @@
*/
#include <linux/module.h>
#include <linux/init.h>
-#include <linux/smp_lock.h>
#include <linux/kdev_t.h>
#include <linux/cdev.h>
#include <linux/fs.h>
@@ -35,7 +34,7 @@ static int gio_open(struct inode *inode, struct file *filp)
int minor;
int ret = -ENOENT;
- lock_kernel();
+ preempt_disable();
minor = MINOR(inode->i_rdev);
if (minor < DEVCOUNT) {
if (openCnt > 0) {
@@ -45,7 +44,7 @@ static int gio_open(struct inode *inode, struct file *filp)
ret = 0;
}
}
- unlock_kernel();
+ preempt_enable();
return ret;
}
@@ -60,8 +59,7 @@ static int gio_close(struct inode *inode, struct file *filp)
return 0;
}
-static int gio_ioctl(struct inode *inode, struct file *filp,
- unsigned int cmd, unsigned long arg)
+static long gio_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
{
unsigned int data;
static unsigned int addr = 0;
@@ -129,7 +127,7 @@ static const struct file_operations gio_fops = {
.owner = THIS_MODULE,
.open = gio_open, /* open */
.release = gio_close, /* release */
- .ioctl = gio_ioctl, /* ioctl */
+ .unlocked_ioctl = gio_ioctl,
};
static int __init gio_init(void)
diff --git a/arch/sh/mm/cache-sh4.c b/arch/sh/mm/cache-sh4.c
index 56dd55a1b13e..4a2fbf2864de 100644
--- a/arch/sh/mm/cache-sh4.c
+++ b/arch/sh/mm/cache-sh4.c
@@ -27,7 +27,7 @@
*/
#define MAX_ICACHE_PAGES 32
-static void __flush_cache_4096(unsigned long addr, unsigned long phys,
+static void __flush_cache_one(unsigned long addr, unsigned long phys,
unsigned long exec_offset);
/*
@@ -82,8 +82,7 @@ static void __uses_jump_to_uncached sh4_flush_icache_range(void *args)
local_irq_restore(flags);
}
-static inline void flush_cache_4096(unsigned long start,
- unsigned long phys)
+static inline void flush_cache_one(unsigned long start, unsigned long phys)
{
unsigned long flags, exec_offset = 0;
@@ -96,8 +95,8 @@ static inline void flush_cache_4096(unsigned long start,
exec_offset = cached_to_uncached;
local_irq_save(flags);
- __flush_cache_4096(start | SH_CACHE_ASSOC,
- virt_to_phys(phys), exec_offset);
+ __flush_cache_one(start | SH_CACHE_ASSOC,
+ virt_to_phys(phys), exec_offset);
local_irq_restore(flags);
}
@@ -121,9 +120,9 @@ static void sh4_flush_dcache_page(void *arg)
int i, n;
/* Loop all the D-cache */
- n = boot_cpu_data.dcache.way_incr >> 12;
- for (i = 0; i < n; i++, addr += 4096)
- flush_cache_4096(addr, phys);
+ n = boot_cpu_data.dcache.n_aliases;
+ for (i = 0; i <= n; i++, addr += PAGE_SIZE)
+ flush_cache_one(addr, phys);
}
wmb();
@@ -220,7 +219,7 @@ static void sh4_flush_cache_page(void *args)
void *vaddr;
vma = data->vma;
- address = data->addr1;
+ address = data->addr1 & PAGE_MASK;
pfn = data->addr2;
phys = pfn << PAGE_SHIFT;
page = pfn_to_page(pfn);
@@ -228,7 +227,6 @@ static void sh4_flush_cache_page(void *args)
if (cpu_context(smp_processor_id(), vma->vm_mm) == NO_CONTEXT)
return;
- address &= PAGE_MASK;
pgd = pgd_offset(vma->vm_mm, address);
pud = pud_offset(pgd, address);
pmd = pmd_offset(pud, address);
@@ -257,7 +255,7 @@ static void sh4_flush_cache_page(void *args)
}
if (pages_do_alias(address, phys))
- flush_cache_4096(CACHE_OC_ADDRESS_ARRAY |
+ flush_cache_one(CACHE_OC_ADDRESS_ARRAY |
(address & shm_align_mask), phys);
if (vma->vm_flags & VM_EXEC)
@@ -307,7 +305,7 @@ static void sh4_flush_cache_range(void *args)
}
/**
- * __flush_cache_4096
+ * __flush_cache_one
*
* @addr: address in memory mapped cache array
* @phys: P1 address to flush (has to match tags if addr has 'A' bit
@@ -320,7 +318,7 @@ static void sh4_flush_cache_range(void *args)
* operation (purge/write-back) is selected by the lower 2 bits of
* 'phys'.
*/
-static void __flush_cache_4096(unsigned long addr, unsigned long phys,
+static void __flush_cache_one(unsigned long addr, unsigned long phys,
unsigned long exec_offset)
{
int way_count;
@@ -357,7 +355,7 @@ static void __flush_cache_4096(unsigned long addr, unsigned long phys,
* pointless nead-of-loop check for 0 iterations.
*/
do {
- ea = base_addr + 4096;
+ ea = base_addr + PAGE_SIZE;
a = base_addr;
p = phys;
diff --git a/arch/sh/mm/cache.c b/arch/sh/mm/cache.c
index e8810f7fc7ea..fc372a1d3132 100644
--- a/arch/sh/mm/cache.c
+++ b/arch/sh/mm/cache.c
@@ -271,6 +271,8 @@ static void __init emit_cache_params(void)
void __init cpu_cache_init(void)
{
+ unsigned int cache_disabled = !(__raw_readl(CCR) & CCR_CACHE_ENABLE);
+
compute_alias(&boot_cpu_data.icache);
compute_alias(&boot_cpu_data.dcache);
compute_alias(&boot_cpu_data.scache);
@@ -279,6 +281,13 @@ void __init cpu_cache_init(void)
__flush_purge_region = noop__flush_region;
__flush_invalidate_region = noop__flush_region;
+ /*
+ * No flushing is necessary in the disabled cache case so we can
+ * just keep the noop functions in local_flush_..() and __flush_..()
+ */
+ if (unlikely(cache_disabled))
+ goto skip;
+
if (boot_cpu_data.family == CPU_FAMILY_SH2) {
extern void __weak sh2_cache_init(void);
@@ -318,5 +327,6 @@ void __init cpu_cache_init(void)
sh5_cache_init();
}
+skip:
emit_cache_params();
}