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