4 * Copyright (c) 2005-2008 Analog Devices Inc.
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
9 * Licensed under the GPL-2 or later.
13 #include <asm/blackfin.h>
14 #include <asm/mach-common/bits/mpu.h>
16 void flush_cache(unsigned long addr, unsigned long size)
18 /* no need to flush stuff in on chip memory (L1/L2/etc...) */
19 if (addr >= 0xE0000000)
23 blackfin_icache_flush_range((void *)addr, (void *)(addr + size));
26 blackfin_dcache_flush_range((void *)addr, (void *)(addr + size));
29 void icache_enable(void)
31 bfin_write_IMEM_CONTROL(IMC | ENICPLB);
35 void icache_disable(void)
37 bfin_write_IMEM_CONTROL(0);
41 int icache_status(void)
43 return bfin_read_IMEM_CONTROL() & IMC;
46 void dcache_enable(void)
48 bfin_write_DMEM_CONTROL(ACACHE_BCACHE | ENDCPLB | PORT_PREF0);
52 void dcache_disable(void)
54 bfin_write_DMEM_CONTROL(0);
58 int dcache_status(void)
60 return bfin_read_DMEM_CONTROL() & ACACHE_BCACHE;