u-boot/cpu/bf533/cache.S

129 lines
1.9 KiB
ArmAsm
Raw Normal View History

2006-03-12 01:12:27 +00:00
#define ASSEMBLY
#include <asm/linkage.h>
#include <config.h>
#include <asm/blackfin.h>
2006-03-12 01:12:27 +00:00
.text
.align 2
ENTRY(_blackfin_icache_flush_range)
2006-03-12 01:12:27 +00:00
R2 = -32;
R2 = R0 & R2;
P0 = R2;
P1 = R1;
CSYNC;
2007-03-11 16:25:14 +00:00
1:
2006-03-12 01:12:27 +00:00
IFLUSH[P0++];
CC = P0 < P1(iu);
IF CC JUMP 1b(bp);
IFLUSH[P0];
SSYNC;
RTS;
ENTRY(_blackfin_dcache_flush_range)
2006-03-12 01:12:27 +00:00
R2 = -32;
2006-03-12 01:55:22 +00:00
R2 = R0 & R2;
P0 = R2;
P1 = R1;
CSYNC;
2006-03-12 01:12:27 +00:00
1:
2006-03-12 01:55:22 +00:00
FLUSH[P0++];
CC = P0 < P1(iu);
IF CC JUMP 1b(bp);
FLUSH[P0];
SSYNC;
RTS;
2006-03-12 01:12:27 +00:00
ENTRY(_icache_invalidate)
ENTRY(_invalidate_entire_icache)
[--SP] = (R7:5);
2006-03-12 01:55:22 +00:00
P0.L = (IMEM_CONTROL & 0xFFFF);
P0.H = (IMEM_CONTROL >> 16);
R7 =[P0];
2006-03-12 01:55:22 +00:00
2007-03-11 16:25:14 +00:00
/*
* Clear the IMC bit , All valid bits in the instruction
* cache are set to the invalid state
*/
BITCLR(R7, IMC_P);
2006-03-12 01:55:22 +00:00
CLI R6;
/* SSYNC required before invalidating cache. */
SSYNC;
2006-03-12 01:55:22 +00:00
.align 8;
[P0] = R7;
SSYNC;
STI R6;
/* Configures the instruction cache agian */
R6 = (IMC | ENICPLB);
R7 = R7 | R6;
CLI R6;
SSYNC;
2006-03-12 01:55:22 +00:00
.align 8;
[P0] = R7;
SSYNC;
STI R6;
(R7:5) =[SP++];
2006-03-12 01:55:22 +00:00
RTS;
2006-03-12 01:12:27 +00:00
2007-03-10 15:49:29 +00:00
/*
* Invalidate the Entire Data cache by
2006-03-12 01:12:27 +00:00
* clearing DMC[1:0] bits
*/
ENTRY(_invalidate_entire_dcache)
2006-03-12 01:12:27 +00:00
ENTRY(_dcache_invalidate)
[--SP] = (R7:6);
2006-03-12 01:55:22 +00:00
P0.L = (DMEM_CONTROL & 0xFFFF);
P0.H = (DMEM_CONTROL >> 16);
R7 =[P0];
2006-03-12 01:55:22 +00:00
2007-03-11 16:25:14 +00:00
/*
* Clear the DMC[1:0] bits, All valid bits in the data
* cache are set to the invalid state
*/
BITCLR(R7, DMC0_P);
BITCLR(R7, DMC1_P);
2006-03-12 01:55:22 +00:00
CLI R6;
SSYNC;
2006-03-12 01:55:22 +00:00
.align 8;
[P0] = R7;
SSYNC;
STI R6;
/* Configures the data cache again */
R6 = (ACACHE_BCACHE | ENDCPLB | PORT_PREF0);
R7 = R7 | R6;
CLI R6;
SSYNC;
2006-03-12 01:55:22 +00:00
.align 8;
[P0] = R7;
SSYNC;
STI R6;
(R7:6) =[SP++];
2006-03-12 01:55:22 +00:00
RTS;
2006-03-12 01:12:27 +00:00
ENTRY(_blackfin_dcache_invalidate_range)
2006-03-12 01:12:27 +00:00
R2 = -32;
R2 = R0 & R2;
P0 = R2;
P1 = R1;
CSYNC;
1:
FLUSHINV[P0++];
CC = P0 < P1(iu);
IF CC JUMP 1b(bp);
2006-03-12 01:12:27 +00:00
2007-03-11 16:25:14 +00:00
/*
* If the data crosses a cache line, then we'll be pointing to
* the last cache line, but won't have flushed/invalidated it yet, so do
* one more.
*/
2006-03-12 01:12:27 +00:00
FLUSHINV[P0];
SSYNC;
RTS;