Merge branch 'upstream' of git://ftp.linux-mips.org/pub/scm/upstream-linus
[linux-2.6] / arch / sh / mm / cache-sh2.c
1 /*
2  * arch/sh/mm/cache-sh2.c
3  *
4  * Copyright (C) 2002 Paul Mundt
5  *
6  * Released under the terms of the GNU GPL v2.0.
7  */
8
9 #include <linux/init.h>
10 #include <linux/mm.h>
11
12 #include <asm/cache.h>
13 #include <asm/addrspace.h>
14 #include <asm/processor.h>
15 #include <asm/cacheflush.h>
16 #include <asm/io.h>
17
18 void __flush_wback_region(void *start, int size)
19 {
20         unsigned long v;
21         unsigned long begin, end;
22
23         begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
24         end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
25                 & ~(L1_CACHE_BYTES-1);
26         for (v = begin; v < end; v+=L1_CACHE_BYTES) {
27                 /* FIXME cache purge */
28                 ctrl_outl((v & 0x1ffffc00), (v & 0x00000ff0) | 0x00000008);
29         }
30 }
31
32 void __flush_purge_region(void *start, int size)
33 {
34         unsigned long v;
35         unsigned long begin, end;
36
37         begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
38         end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
39                 & ~(L1_CACHE_BYTES-1);
40         for (v = begin; v < end; v+=L1_CACHE_BYTES) {
41                 ctrl_outl((v & 0x1ffffc00), (v & 0x00000ff0) | 0x00000008);
42         }
43 }
44
45 void __flush_invalidate_region(void *start, int size)
46 {
47         unsigned long v;
48         unsigned long begin, end;
49
50         begin = (unsigned long)start & ~(L1_CACHE_BYTES-1);
51         end = ((unsigned long)start + size + L1_CACHE_BYTES-1)
52                 & ~(L1_CACHE_BYTES-1);
53         for (v = begin; v < end; v+=L1_CACHE_BYTES) {
54                 ctrl_outl((v & 0x1ffffc00), (v & 0x00000ff0) | 0x00000008);
55         }
56 }
57