Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 1 | #define ASSEMBLY |
2 | #include <asm/linkage.h> | ||||
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 3 | #include <config.h> |
4 | #include <asm/blackfin.h> | ||||
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 5 | |
6 | .text | ||||
7 | .align 2 | ||||
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 8 | ENTRY(_blackfin_icache_flush_range) |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 9 | R2 = -32; |
10 | R2 = R0 & R2; | ||||
11 | P0 = R2; | ||||
12 | P1 = R1; | ||||
13 | CSYNC; | ||||
Aubrey Li | 8440bb1 | 2007-03-12 00:25:14 +0800 | [diff] [blame] | 14 | 1: |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 15 | IFLUSH[P0++]; |
16 | CC = P0 < P1(iu); | ||||
17 | IF CC JUMP 1b(bp); | ||||
18 | IFLUSH[P0]; | ||||
19 | SSYNC; | ||||
20 | RTS; | ||||
21 | |||||
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 22 | ENTRY(_blackfin_dcache_flush_range) |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 23 | R2 = -32; |
Wolfgang Denk | 8e7b703 | 2006-03-12 02:55:22 +0100 | [diff] [blame] | 24 | R2 = R0 & R2; |
25 | P0 = R2; | ||||
26 | P1 = R1; | ||||
27 | CSYNC; | ||||
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 28 | 1: |
Wolfgang Denk | 8e7b703 | 2006-03-12 02:55:22 +0100 | [diff] [blame] | 29 | FLUSH[P0++]; |
30 | CC = P0 < P1(iu); | ||||
31 | IF CC JUMP 1b(bp); | ||||
32 | FLUSH[P0]; | ||||
33 | SSYNC; | ||||
34 | RTS; | ||||
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 35 | |
36 | ENTRY(_icache_invalidate) | ||||
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 37 | ENTRY(_invalidate_entire_icache) |
38 | [--SP] = (R7:5); | ||||
Wolfgang Denk | 8e7b703 | 2006-03-12 02:55:22 +0100 | [diff] [blame] | 39 | |
40 | P0.L = (IMEM_CONTROL & 0xFFFF); | ||||
41 | P0.H = (IMEM_CONTROL >> 16); | ||||
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 42 | R7 =[P0]; |
Wolfgang Denk | 8e7b703 | 2006-03-12 02:55:22 +0100 | [diff] [blame] | 43 | |
Aubrey Li | 8440bb1 | 2007-03-12 00:25:14 +0800 | [diff] [blame] | 44 | /* |
45 | * Clear the IMC bit , All valid bits in the instruction | ||||
46 | * cache are set to the invalid state | ||||
47 | */ | ||||
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 48 | BITCLR(R7, IMC_P); |
Wolfgang Denk | 8e7b703 | 2006-03-12 02:55:22 +0100 | [diff] [blame] | 49 | CLI R6; |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 50 | /* SSYNC required before invalidating cache. */ |
51 | SSYNC; | ||||
Wolfgang Denk | 8e7b703 | 2006-03-12 02:55:22 +0100 | [diff] [blame] | 52 | .align 8; |
53 | [P0] = R7; | ||||
54 | SSYNC; | ||||
55 | STI R6; | ||||
56 | |||||
57 | /* Configures the instruction cache agian */ | ||||
58 | R6 = (IMC | ENICPLB); | ||||
59 | R7 = R7 | R6; | ||||
60 | |||||
61 | CLI R6; | ||||
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 62 | SSYNC; |
Wolfgang Denk | 8e7b703 | 2006-03-12 02:55:22 +0100 | [diff] [blame] | 63 | .align 8; |
64 | [P0] = R7; | ||||
65 | SSYNC; | ||||
66 | STI R6; | ||||
67 | |||||
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 68 | (R7:5) =[SP++]; |
Wolfgang Denk | 8e7b703 | 2006-03-12 02:55:22 +0100 | [diff] [blame] | 69 | RTS; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 70 | |
Aubrey Li | 8db13d6 | 2007-03-10 23:49:29 +0800 | [diff] [blame] | 71 | /* |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 72 | * Invalidate the Entire Data cache by |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 73 | * clearing DMC[1:0] bits |
74 | */ | ||||
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 75 | ENTRY(_invalidate_entire_dcache) |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 76 | ENTRY(_dcache_invalidate) |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 77 | [--SP] = (R7:6); |
Wolfgang Denk | 8e7b703 | 2006-03-12 02:55:22 +0100 | [diff] [blame] | 78 | |
79 | P0.L = (DMEM_CONTROL & 0xFFFF); | ||||
80 | P0.H = (DMEM_CONTROL >> 16); | ||||
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 81 | R7 =[P0]; |
Wolfgang Denk | 8e7b703 | 2006-03-12 02:55:22 +0100 | [diff] [blame] | 82 | |
Aubrey Li | 8440bb1 | 2007-03-12 00:25:14 +0800 | [diff] [blame] | 83 | /* |
84 | * Clear the DMC[1:0] bits, All valid bits in the data | ||||
85 | * cache are set to the invalid state | ||||
86 | */ | ||||
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 87 | BITCLR(R7, DMC0_P); |
88 | BITCLR(R7, DMC1_P); | ||||
Wolfgang Denk | 8e7b703 | 2006-03-12 02:55:22 +0100 | [diff] [blame] | 89 | CLI R6; |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 90 | SSYNC; |
Wolfgang Denk | 8e7b703 | 2006-03-12 02:55:22 +0100 | [diff] [blame] | 91 | .align 8; |
92 | [P0] = R7; | ||||
93 | SSYNC; | ||||
94 | STI R6; | ||||
Wolfgang Denk | 8e7b703 | 2006-03-12 02:55:22 +0100 | [diff] [blame] | 95 | /* Configures the data cache again */ |
96 | |||||
97 | R6 = (ACACHE_BCACHE | ENDCPLB | PORT_PREF0); | ||||
98 | R7 = R7 | R6; | ||||
99 | |||||
100 | CLI R6; | ||||
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 101 | SSYNC; |
Wolfgang Denk | 8e7b703 | 2006-03-12 02:55:22 +0100 | [diff] [blame] | 102 | .align 8; |
103 | [P0] = R7; | ||||
104 | SSYNC; | ||||
105 | STI R6; | ||||
106 | |||||
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 107 | (R7:6) =[SP++]; |
Wolfgang Denk | 8e7b703 | 2006-03-12 02:55:22 +0100 | [diff] [blame] | 108 | RTS; |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 109 | |
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 110 | ENTRY(_blackfin_dcache_invalidate_range) |
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 111 | R2 = -32; |
112 | R2 = R0 & R2; | ||||
113 | P0 = R2; | ||||
114 | P1 = R1; | ||||
115 | CSYNC; | ||||
116 | 1: | ||||
117 | FLUSHINV[P0++]; | ||||
Aubrey.Li | 3f0606a | 2007-03-09 13:38:44 +0800 | [diff] [blame] | 118 | CC = P0 < P1(iu); |
119 | IF CC JUMP 1b(bp); | ||||
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 120 | |
Aubrey Li | 8440bb1 | 2007-03-12 00:25:14 +0800 | [diff] [blame] | 121 | /* |
122 | * If the data crosses a cache line, then we'll be pointing to | ||||
123 | * the last cache line, but won't have flushed/invalidated it yet, so do | ||||
124 | * one more. | ||||
125 | */ | ||||
Wolfgang Denk | 6cb142f | 2006-03-12 02:12:27 +0100 | [diff] [blame] | 126 | FLUSHINV[P0]; |
127 | SSYNC; | ||||
128 | RTS; |