2 * (C) Copyright 2008-2010 Freescale Semiconductor, Inc.
5 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
7 * See file CREDITS for list of people who contributed to this
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation; either version 2 of
13 * the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
27 #include <asm/system.h>
29 #if !(defined(CONFIG_SYS_NO_ICACHE) && defined(CONFIG_SYS_NO_DCACHE))
33 /* copro seems to need some delay between reading and writing */ \
34 for (i = 0; i < 100; i++) \
38 /* cache_bit must be either CR_I or CR_C */
39 #define cache_enable(cache_bit) \
42 reg = get_cr(); /* get control reg. */ \
43 set_cr(reg | cache_bit); \
47 /* cache_bit must be either CR_I or CR_C */
48 #define cache_disable(cache_bit) \
52 set_cr(reg & ~cache_bit); \
58 #ifdef CONFIG_SYS_NO_ICACHE
59 #define icache_enable()
61 #define icache_disable()
63 #define icache_status()
65 #define icache_enable() (cache_enable(CR_I))
67 #define icache_disable() (cache_disable(CR_I))
69 #define icache_status() ((get_cr() & CR_I) != 0)
72 #ifdef CONFIG_SYS_NO_DCACHE
73 #define dcache_enable()
75 #define dcache_disable()
77 #define dcache_status()
79 #define dcache_enable() (cache_enable(CR_C))
81 #define dcache_disable() \
83 cache_disable(CR_C); \
86 #define dcache_status() ((get_cr() & CR_C) != 0)