diff options
author | Mike Frysinger <vapier.adi@gmail.com> | 2008-11-18 04:48:22 -0500 |
---|---|---|
committer | Bryan Wu <cooloney@kernel.org> | 2008-11-18 04:48:22 -0500 |
commit | 3c1fbd5184f9c3c52c0a392fae0efb0b0d99a079 (patch) | |
tree | 1b94bd6487234e7cbfc0b09bf6221e25e02e0a12 | |
parent | fe85cad25e56aad5e020ea5cab50a100892f645b (diff) |
Blackfin arch: rewrite blackfin_invalidate_entire_dcache function
rewrite blackfin_invalidate_entire_dcache() in C for easier management,
better optimization, and so we take all SSYNC anomalies into account
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
-rw-r--r-- | arch/blackfin/mach-common/Makefile | 2 | ||||
-rw-r--r-- | arch/blackfin/mach-common/cache-c.c | 24 | ||||
-rw-r--r-- | arch/blackfin/mach-common/cache.S | 36 |
3 files changed, 25 insertions, 37 deletions
diff --git a/arch/blackfin/mach-common/Makefile b/arch/blackfin/mach-common/Makefile index 9388b4ab7349..38911c6f964f 100644 --- a/arch/blackfin/mach-common/Makefile +++ b/arch/blackfin/mach-common/Makefile | |||
@@ -3,7 +3,7 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | obj-y := \ | 5 | obj-y := \ |
6 | cache.o entry.o head.o \ | 6 | cache.o cache-c.o entry.o head.o \ |
7 | interrupt.o irqpanic.o arch_checks.o ints-priority.o | 7 | interrupt.o irqpanic.o arch_checks.o ints-priority.o |
8 | 8 | ||
9 | obj-$(CONFIG_BFIN_ICACHE_LOCK) += lock.o | 9 | obj-$(CONFIG_BFIN_ICACHE_LOCK) += lock.o |
diff --git a/arch/blackfin/mach-common/cache-c.c b/arch/blackfin/mach-common/cache-c.c new file mode 100644 index 000000000000..e6ab1f815123 --- /dev/null +++ b/arch/blackfin/mach-common/cache-c.c | |||
@@ -0,0 +1,24 @@ | |||
1 | /* | ||
2 | * Blackfin cache control code (simpler control-style functions) | ||
3 | * | ||
4 | * Copyright 2004-2008 Analog Devices Inc. | ||
5 | * | ||
6 | * Enter bugs at http://blackfin.uclinux.org/ | ||
7 | * | ||
8 | * Licensed under the GPL-2 or later. | ||
9 | */ | ||
10 | |||
11 | #include <asm/blackfin.h> | ||
12 | |||
13 | /* Invalidate the Entire Data cache by | ||
14 | * clearing DMC[1:0] bits | ||
15 | */ | ||
16 | void blackfin_invalidate_entire_dcache(void) | ||
17 | { | ||
18 | u32 dmem = bfin_read_DMEM_CONTROL(); | ||
19 | SSYNC(); | ||
20 | bfin_write_DMEM_CONTROL(dmem & ~0xc); | ||
21 | SSYNC(); | ||
22 | bfin_write_DMEM_CONTROL(dmem); | ||
23 | SSYNC(); | ||
24 | } | ||
diff --git a/arch/blackfin/mach-common/cache.S b/arch/blackfin/mach-common/cache.S index 118751287437..3c98dacbf289 100644 --- a/arch/blackfin/mach-common/cache.S +++ b/arch/blackfin/mach-common/cache.S | |||
@@ -97,39 +97,3 @@ ENTRY(_blackfin_dflush_page) | |||
97 | P1 = 1 << (PAGE_SHIFT - L1_CACHE_SHIFT); | 97 | P1 = 1 << (PAGE_SHIFT - L1_CACHE_SHIFT); |
98 | jump .Ldfr; | 98 | jump .Ldfr; |
99 | ENDPROC(_blackfin_dflush_page) | 99 | ENDPROC(_blackfin_dflush_page) |
100 | |||
101 | /* Invalidate the Entire Data cache by | ||
102 | * clearing DMC[1:0] bits | ||
103 | */ | ||
104 | ENTRY(_blackfin_invalidate_entire_dcache) | ||
105 | [--SP] = ( R7:5); | ||
106 | |||
107 | P0.L = LO(DMEM_CONTROL); | ||
108 | P0.H = HI(DMEM_CONTROL); | ||
109 | R7 = [P0]; | ||
110 | R5 = R7; /* Save DMEM_CNTR */ | ||
111 | |||
112 | /* Clear the DMC[1:0] bits, All valid bits in the data | ||
113 | * cache are set to the invalid state | ||
114 | */ | ||
115 | BITCLR(R7,DMC0_P); | ||
116 | BITCLR(R7,DMC1_P); | ||
117 | CLI R6; | ||
118 | SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */ | ||
119 | .align 8; | ||
120 | [P0] = R7; | ||
121 | SSYNC; | ||
122 | STI R6; | ||
123 | |||
124 | /* Configures the data cache again */ | ||
125 | |||
126 | CLI R6; | ||
127 | SSYNC; /* SSYNC required before writing to DMEM_CONTROL. */ | ||
128 | .align 8; | ||
129 | [P0] = R5; | ||
130 | SSYNC; | ||
131 | STI R6; | ||
132 | |||
133 | ( R7:5) = [SP++]; | ||
134 | RTS; | ||
135 | ENDPROC(_blackfin_invalidate_entire_dcache) | ||