diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-04 20:26:15 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-08-04 20:26:15 -0400 |
| commit | 2e1e9212ed8c532c6b324de77d3cafef5d2bc846 (patch) | |
| tree | 15097a99d03679f2c95ea2fdc0eb3c3ebcc474b8 /arch/sh/mm/cache-sh2.c | |
| parent | 2acb802b0c5485aedb46e23b2b45e49573454c09 (diff) | |
| parent | f5663f5bded3364158e2d31904173cb1debc2ecd (diff) | |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/lethal/sh-2.6: (29 commits)
sh: enable maple_keyb in dreamcast_defconfig.
SH2(A) cache update
nommu: Provide vmalloc_exec().
add addrespace definition for sh2a.
sh: Kill off ARCH_SUPPORTS_AOUT and remnants of a.out support.
sh: define GENERIC_HARDIRQS_NO__DO_IRQ.
sh: define GENERIC_LOCKBREAK.
sh: Save NUMA node data in vmcore for crash dumps.
sh: module_alloc() should be using vmalloc_exec().
sh: Fix up __bug_table handling in module loader.
sh: Add documentation and integrate into docbook build.
sh: Fix up broken kerneldoc comments.
maple: Kill useless private_data pointer.
maple: Clean up maple_driver_register/unregister routines.
input: Clean up maple keyboard driver
maple: allow removal and reinsertion of keyboard driver module
sh: /proc/asids depends on MMU.
arch/sh/boards/mach-se/7343/irq.c: removed duplicated #include
arch/sh/boards/board-ap325rxa.c: removed duplicated #include
sh/boards/Makefile typo fix
...
Diffstat (limited to 'arch/sh/mm/cache-sh2.c')
| -rw-r--r-- | arch/sh/mm/cache-sh2.c | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/arch/sh/mm/cache-sh2.c b/arch/sh/mm/cache-sh2.c index 6614033f6be9..c4e80d2b764b 100644 --- a/arch/sh/mm/cache-sh2.c +++ b/arch/sh/mm/cache-sh2.c | |||
| @@ -2,6 +2,7 @@ | |||
| 2 | * arch/sh/mm/cache-sh2.c | 2 | * arch/sh/mm/cache-sh2.c |
| 3 | * | 3 | * |
| 4 | * Copyright (C) 2002 Paul Mundt | 4 | * Copyright (C) 2002 Paul Mundt |
| 5 | * Copyright (C) 2008 Yoshinori Sato | ||
| 5 | * | 6 | * |
| 6 | * Released under the terms of the GNU GPL v2.0. | 7 | * Released under the terms of the GNU GPL v2.0. |
| 7 | */ | 8 | */ |
| @@ -24,8 +25,15 @@ void __flush_wback_region(void *start, int size) | |||
| 24 | end = ((unsigned long)start + size + L1_CACHE_BYTES-1) | 25 | end = ((unsigned long)start + size + L1_CACHE_BYTES-1) |
| 25 | & ~(L1_CACHE_BYTES-1); | 26 | & ~(L1_CACHE_BYTES-1); |
| 26 | for (v = begin; v < end; v+=L1_CACHE_BYTES) { | 27 | for (v = begin; v < end; v+=L1_CACHE_BYTES) { |
| 27 | /* FIXME cache purge */ | 28 | unsigned long addr = CACHE_OC_ADDRESS_ARRAY | (v & 0x00000ff0); |
| 28 | ctrl_outl((v & 0x1ffffc00), (v & 0x00000ff0) | 0x00000008); | 29 | int way; |
| 30 | for (way = 0; way < 4; way++) { | ||
| 31 | unsigned long data = ctrl_inl(addr | (way << 12)); | ||
| 32 | if ((data & CACHE_PHYSADDR_MASK) == (v & CACHE_PHYSADDR_MASK)) { | ||
| 33 | data &= ~SH_CACHE_UPDATED; | ||
| 34 | ctrl_outl(data, addr | (way << 12)); | ||
| 35 | } | ||
| 36 | } | ||
| 29 | } | 37 | } |
| 30 | } | 38 | } |
| 31 | 39 | ||
| @@ -37,21 +45,40 @@ void __flush_purge_region(void *start, int size) | |||
| 37 | begin = (unsigned long)start & ~(L1_CACHE_BYTES-1); | 45 | begin = (unsigned long)start & ~(L1_CACHE_BYTES-1); |
| 38 | end = ((unsigned long)start + size + L1_CACHE_BYTES-1) | 46 | end = ((unsigned long)start + size + L1_CACHE_BYTES-1) |
| 39 | & ~(L1_CACHE_BYTES-1); | 47 | & ~(L1_CACHE_BYTES-1); |
| 40 | for (v = begin; v < end; v+=L1_CACHE_BYTES) { | 48 | |
| 41 | ctrl_outl((v & 0x1ffffc00), (v & 0x00000ff0) | 0x00000008); | 49 | for (v = begin; v < end; v+=L1_CACHE_BYTES) |
| 42 | } | 50 | ctrl_outl((v & CACHE_PHYSADDR_MASK), |
| 51 | CACHE_OC_ADDRESS_ARRAY | (v & 0x00000ff0) | 0x00000008); | ||
| 43 | } | 52 | } |
| 44 | 53 | ||
| 45 | void __flush_invalidate_region(void *start, int size) | 54 | void __flush_invalidate_region(void *start, int size) |
| 46 | { | 55 | { |
| 56 | #ifdef CONFIG_CACHE_WRITEBACK | ||
| 57 | /* | ||
| 58 | * SH-2 does not support individual line invalidation, only a | ||
| 59 | * global invalidate. | ||
| 60 | */ | ||
| 61 | unsigned long ccr; | ||
| 62 | unsigned long flags; | ||
| 63 | local_irq_save(flags); | ||
| 64 | jump_to_uncached(); | ||
| 65 | |||
| 66 | ccr = ctrl_inl(CCR); | ||
| 67 | ccr |= CCR_CACHE_INVALIDATE; | ||
| 68 | ctrl_outl(ccr, CCR); | ||
| 69 | |||
| 70 | back_to_cached(); | ||
| 71 | local_irq_restore(flags); | ||
| 72 | #else | ||
| 47 | unsigned long v; | 73 | unsigned long v; |
| 48 | unsigned long begin, end; | 74 | unsigned long begin, end; |
| 49 | 75 | ||
| 50 | begin = (unsigned long)start & ~(L1_CACHE_BYTES-1); | 76 | begin = (unsigned long)start & ~(L1_CACHE_BYTES-1); |
| 51 | end = ((unsigned long)start + size + L1_CACHE_BYTES-1) | 77 | end = ((unsigned long)start + size + L1_CACHE_BYTES-1) |
| 52 | & ~(L1_CACHE_BYTES-1); | 78 | & ~(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 | 79 | ||
| 80 | for (v = begin; v < end; v+=L1_CACHE_BYTES) | ||
| 81 | ctrl_outl((v & CACHE_PHYSADDR_MASK), | ||
| 82 | CACHE_OC_ADDRESS_ARRAY | (v & 0x00000ff0) | 0x00000008); | ||
| 83 | #endif | ||
| 84 | } | ||
