blob: 03aebe4b4c596a828d70263280b62acecbbf0225 [file] [log] [blame]
Wolfgang Denk6cb142f2006-03-12 02:12:27 +01001#define ASSEMBLY
2#include <asm/linkage.h>
Aubrey.Li3f0606a2007-03-09 13:38:44 +08003#include <config.h>
4#include <asm/blackfin.h>
Wolfgang Denk6cb142f2006-03-12 02:12:27 +01005
6.text
7.align 2
Aubrey.Li3f0606a2007-03-09 13:38:44 +08008ENTRY(_blackfin_icache_flush_range)
Wolfgang Denk6cb142f2006-03-12 02:12:27 +01009 R2 = -32;
10 R2 = R0 & R2;
11 P0 = R2;
12 P1 = R1;
13 CSYNC;
Aubrey Li8440bb12007-03-12 00:25:14 +0800141:
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010015 IFLUSH[P0++];
16 CC = P0 < P1(iu);
17 IF CC JUMP 1b(bp);
18 IFLUSH[P0];
19 SSYNC;
20 RTS;
21
Aubrey.Li3f0606a2007-03-09 13:38:44 +080022ENTRY(_blackfin_dcache_flush_range)
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010023 R2 = -32;
Wolfgang Denk8e7b7032006-03-12 02:55:22 +010024 R2 = R0 & R2;
25 P0 = R2;
26 P1 = R1;
27 CSYNC;
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100281:
Wolfgang Denk8e7b7032006-03-12 02:55:22 +010029 FLUSH[P0++];
30 CC = P0 < P1(iu);
31 IF CC JUMP 1b(bp);
32 FLUSH[P0];
33 SSYNC;
34 RTS;
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010035
36ENTRY(_icache_invalidate)
Aubrey.Li3f0606a2007-03-09 13:38:44 +080037ENTRY(_invalidate_entire_icache)
38 [--SP] = (R7:5);
Wolfgang Denk8e7b7032006-03-12 02:55:22 +010039
40 P0.L = (IMEM_CONTROL & 0xFFFF);
41 P0.H = (IMEM_CONTROL >> 16);
Aubrey.Li3f0606a2007-03-09 13:38:44 +080042 R7 =[P0];
Wolfgang Denk8e7b7032006-03-12 02:55:22 +010043
Aubrey Li8440bb12007-03-12 00:25:14 +080044 /*
45 * Clear the IMC bit , All valid bits in the instruction
46 * cache are set to the invalid state
47 */
Aubrey.Li3f0606a2007-03-09 13:38:44 +080048 BITCLR(R7, IMC_P);
Wolfgang Denk8e7b7032006-03-12 02:55:22 +010049 CLI R6;
Aubrey.Li3f0606a2007-03-09 13:38:44 +080050 /* SSYNC required before invalidating cache. */
51 SSYNC;
Wolfgang Denk8e7b7032006-03-12 02:55:22 +010052 .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.Li3f0606a2007-03-09 13:38:44 +080062 SSYNC;
Wolfgang Denk8e7b7032006-03-12 02:55:22 +010063 .align 8;
64 [P0] = R7;
65 SSYNC;
66 STI R6;
67
Aubrey.Li3f0606a2007-03-09 13:38:44 +080068 (R7:5) =[SP++];
Wolfgang Denk8e7b7032006-03-12 02:55:22 +010069 RTS;
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010070
Aubrey Li8db13d62007-03-10 23:49:29 +080071/*
Aubrey.Li3f0606a2007-03-09 13:38:44 +080072 * Invalidate the Entire Data cache by
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010073 * clearing DMC[1:0] bits
74 */
Aubrey.Li3f0606a2007-03-09 13:38:44 +080075ENTRY(_invalidate_entire_dcache)
Wolfgang Denk6cb142f2006-03-12 02:12:27 +010076ENTRY(_dcache_invalidate)
Aubrey.Li3f0606a2007-03-09 13:38:44 +080077 [--SP] = (R7:6);
Wolfgang Denk8e7b7032006-03-12 02:55:22 +010078
79 P0.L = (DMEM_CONTROL & 0xFFFF);
80 P0.H = (DMEM_CONTROL >> 16);
Aubrey.Li3f0606a2007-03-09 13:38:44 +080081 R7 =[P0];
Wolfgang Denk8e7b7032006-03-12 02:55:22 +010082
Aubrey Li8440bb12007-03-12 00:25:14 +080083 /*
84 * Clear the DMC[1:0] bits, All valid bits in the data
85 * cache are set to the invalid state
86 */
Aubrey.Li3f0606a2007-03-09 13:38:44 +080087 BITCLR(R7, DMC0_P);
88 BITCLR(R7, DMC1_P);
Wolfgang Denk8e7b7032006-03-12 02:55:22 +010089 CLI R6;
Aubrey.Li3f0606a2007-03-09 13:38:44 +080090 SSYNC;
Wolfgang Denk8e7b7032006-03-12 02:55:22 +010091 .align 8;
92 [P0] = R7;
93 SSYNC;
94 STI R6;
Wolfgang Denk8e7b7032006-03-12 02:55:22 +010095 /* Configures the data cache again */
96
97 R6 = (ACACHE_BCACHE | ENDCPLB | PORT_PREF0);
98 R7 = R7 | R6;
99
100 CLI R6;
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800101 SSYNC;
Wolfgang Denk8e7b7032006-03-12 02:55:22 +0100102 .align 8;
103 [P0] = R7;
104 SSYNC;
105 STI R6;
106
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800107 (R7:6) =[SP++];
Wolfgang Denk8e7b7032006-03-12 02:55:22 +0100108 RTS;
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100109
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800110ENTRY(_blackfin_dcache_invalidate_range)
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100111 R2 = -32;
112 R2 = R0 & R2;
113 P0 = R2;
114 P1 = R1;
115 CSYNC;
1161:
117 FLUSHINV[P0++];
Aubrey.Li3f0606a2007-03-09 13:38:44 +0800118 CC = P0 < P1(iu);
119 IF CC JUMP 1b(bp);
Wolfgang Denk6cb142f2006-03-12 02:12:27 +0100120
Aubrey Li8440bb12007-03-12 00:25:14 +0800121 /*
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 Denk6cb142f2006-03-12 02:12:27 +0100126 FLUSHINV[P0];
127 SSYNC;
128 RTS;