3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
25 #include <asm/system.h>
27 #if !(defined(CONFIG_SYS_NO_ICACHE) && defined(CONFIG_SYS_NO_DCACHE))
28 static void cp_delay (void)
32 /* copro seems to need some delay between reading and writing */
33 for (i = 0; i < 100; i++)
37 /* cache_bit must be either CR_I or CR_C */
38 static void cache_enable(uint32_t cache_bit)
42 reg = get_cr(); /* get control reg. */
44 set_cr(reg | cache_bit);
47 /* cache_bit must be either CR_I or CR_C */
48 static void cache_disable(uint32_t cache_bit)
54 set_cr(reg & ~cache_bit);
58 #ifdef CONFIG_SYS_NO_ICACHE
59 void icache_enable (void)
64 void icache_disable (void)
69 int icache_status (void)
71 return 0; /* always off */
74 void icache_enable(void)
79 void icache_disable(void)
84 int icache_status(void)
86 return (get_cr() & CR_I) != 0;
90 #ifdef CONFIG_SYS_NO_DCACHE
91 void dcache_enable (void)
96 void dcache_disable (void)
101 int dcache_status (void)
103 return 0; /* always off */
106 void dcache_enable(void)
111 void dcache_disable(void)
116 int dcache_status(void)
118 return (get_cr() & CR_C) != 0;