diff options
author | Hirokazu Takata <takata@linux-m32r.org> | 2006-01-06 03:18:44 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-01-06 11:33:44 -0500 |
commit | 9b791d4766c19ac014a7b81a551efe4a7511e12a (patch) | |
tree | ac8aaaf5042fb0e6f9cd05e073f7e5d60823445f /arch/m32r/mm | |
parent | 46ea178b7a5162405bf70954d769165cf2161309 (diff) |
[PATCH] m32r: Fix M32104 cache flushing routines
This patch fixes cache memory parameter setting for the M32104 target. So
far, its performance seemed to have been degraded due to incorrect cache
parameter setting.
* arch/m32r/boot/setup.S: Set SFR(Special Fuction Registers) region
to be non-cachable explicitly.
* arch/m32r/mm/cache.c: Fix cache flushing routines not to switch off
the M32104 cache.
Signed-off-by: Hayato Fujiwara <fujiwara@linux-m32r.org>
Signed-off-by: Hirokazu Takata <takata@linux-m32r.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'arch/m32r/mm')
-rw-r--r-- | arch/m32r/mm/cache.c | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/arch/m32r/mm/cache.c b/arch/m32r/mm/cache.c index c6f72a64ae12..9f54dd937013 100644 --- a/arch/m32r/mm/cache.c +++ b/arch/m32r/mm/cache.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * linux/arch/m32r/mm/cache.c | 2 | * linux/arch/m32r/mm/cache.c |
3 | * | 3 | * |
4 | * Copyright (C) 2002 Hirokazu Takata | 4 | * Copyright (C) 2002-2005 Hirokazu Takata, Hayato Fujiwara |
5 | */ | 5 | */ |
6 | 6 | ||
7 | #include <linux/config.h> | 7 | #include <linux/config.h> |
@@ -9,7 +9,8 @@ | |||
9 | 9 | ||
10 | #undef MCCR | 10 | #undef MCCR |
11 | 11 | ||
12 | #if defined(CONFIG_CHIP_XNUX2) || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_OPSP) | 12 | #if defined(CONFIG_CHIP_XNUX2) || defined(CONFIG_CHIP_M32700) \ |
13 | || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_OPSP) | ||
13 | /* Cache Control Register */ | 14 | /* Cache Control Register */ |
14 | #define MCCR ((volatile unsigned long*)0xfffffffc) | 15 | #define MCCR ((volatile unsigned long*)0xfffffffc) |
15 | #define MCCR_CC (1UL << 7) /* Cache mode modify bit */ | 16 | #define MCCR_CC (1UL << 7) /* Cache mode modify bit */ |
@@ -27,7 +28,7 @@ | |||
27 | #define MCCR_IIV (1UL << 0) /* I-cache invalidate */ | 28 | #define MCCR_IIV (1UL << 0) /* I-cache invalidate */ |
28 | #define MCCR_ICACHE_INV MCCR_IIV | 29 | #define MCCR_ICACHE_INV MCCR_IIV |
29 | #elif defined(CONFIG_CHIP_M32104) | 30 | #elif defined(CONFIG_CHIP_M32104) |
30 | #define MCCR ((volatile unsigned long*)0xfffffffc) | 31 | #define MCCR ((volatile unsigned short*)0xfffffffe) |
31 | #define MCCR_IIV (1UL << 8) /* I-cache invalidate */ | 32 | #define MCCR_IIV (1UL << 8) /* I-cache invalidate */ |
32 | #define MCCR_DIV (1UL << 9) /* D-cache invalidate */ | 33 | #define MCCR_DIV (1UL << 9) /* D-cache invalidate */ |
33 | #define MCCR_DCB (1UL << 10) /* D-cache copy back */ | 34 | #define MCCR_DCB (1UL << 10) /* D-cache copy back */ |
@@ -36,7 +37,7 @@ | |||
36 | #define MCCR_ICACHE_INV MCCR_IIV | 37 | #define MCCR_ICACHE_INV MCCR_IIV |
37 | #define MCCR_DCACHE_CB MCCR_DCB | 38 | #define MCCR_DCACHE_CB MCCR_DCB |
38 | #define MCCR_DCACHE_CBINV (MCCR_DIV|MCCR_DCB) | 39 | #define MCCR_DCACHE_CBINV (MCCR_DIV|MCCR_DCB) |
39 | #endif /* CONFIG_CHIP_XNUX2 || CONFIG_CHIP_M32700 */ | 40 | #endif |
40 | 41 | ||
41 | #ifndef MCCR | 42 | #ifndef MCCR |
42 | #error Unknown cache type. | 43 | #error Unknown cache type. |
@@ -47,29 +48,42 @@ | |||
47 | void _flush_cache_all(void) | 48 | void _flush_cache_all(void) |
48 | { | 49 | { |
49 | #if defined(CONFIG_CHIP_M32102) | 50 | #if defined(CONFIG_CHIP_M32102) |
51 | unsigned char mccr; | ||
50 | *MCCR = MCCR_ICACHE_INV; | 52 | *MCCR = MCCR_ICACHE_INV; |
53 | #elif defined(CONFIG_CHIP_M32104) | ||
54 | unsigned short mccr; | ||
55 | |||
56 | /* Copyback and invalidate D-cache */ | ||
57 | /* Invalidate I-cache */ | ||
58 | *MCCR |= (MCCR_ICACHE_INV | MCCR_DCACHE_CBINV); | ||
51 | #else | 59 | #else |
52 | unsigned long mccr; | 60 | unsigned long mccr; |
53 | 61 | ||
54 | /* Copyback and invalidate D-cache */ | 62 | /* Copyback and invalidate D-cache */ |
55 | /* Invalidate I-cache */ | 63 | /* Invalidate I-cache */ |
56 | *MCCR = MCCR_ICACHE_INV | MCCR_DCACHE_CBINV; | 64 | *MCCR = MCCR_ICACHE_INV | MCCR_DCACHE_CBINV; |
57 | while ((mccr = *MCCR) & MCCR_IIV); /* loop while invalidating... */ | ||
58 | #endif | 65 | #endif |
66 | while ((mccr = *MCCR) & MCCR_IIV); /* loop while invalidating... */ | ||
59 | } | 67 | } |
60 | 68 | ||
61 | /* Copy back D-cache and invalidate I-cache all */ | 69 | /* Copy back D-cache and invalidate I-cache all */ |
62 | void _flush_cache_copyback_all(void) | 70 | void _flush_cache_copyback_all(void) |
63 | { | 71 | { |
64 | #if defined(CONFIG_CHIP_M32102) | 72 | #if defined(CONFIG_CHIP_M32102) |
73 | unsigned char mccr; | ||
65 | *MCCR = MCCR_ICACHE_INV; | 74 | *MCCR = MCCR_ICACHE_INV; |
75 | #elif defined(CONFIG_CHIP_M32104) | ||
76 | unsigned short mccr; | ||
77 | |||
78 | /* Copyback and invalidate D-cache */ | ||
79 | /* Invalidate I-cache */ | ||
80 | *MCCR |= (MCCR_ICACHE_INV | MCCR_DCACHE_CB); | ||
66 | #else | 81 | #else |
67 | unsigned long mccr; | 82 | unsigned long mccr; |
68 | 83 | ||
69 | /* Copyback D-cache */ | 84 | /* Copyback D-cache */ |
70 | /* Invalidate I-cache */ | 85 | /* Invalidate I-cache */ |
71 | *MCCR = MCCR_ICACHE_INV | MCCR_DCACHE_CB; | 86 | *MCCR = MCCR_ICACHE_INV | MCCR_DCACHE_CB; |
72 | while ((mccr = *MCCR) & MCCR_IIV); /* loop while invalidating... */ | ||
73 | |||
74 | #endif | 87 | #endif |
88 | while ((mccr = *MCCR) & MCCR_IIV); /* loop while invalidating... */ | ||
75 | } | 89 | } |