3 * Nobuhiro Iwamatsu <iwamatsu@nigauri.org>
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,
26 #include <asm/processor.h>
31 * When handling TLB or caches, we need to do it from P2 area.
33 #define jump_to_P2() \
35 unsigned long __dummy; \
36 __asm__ __volatile__( \
45 : "r" (0x20000000)); \
51 #define back_to_P1() \
53 unsigned long __dummy; \
54 __asm__ __volatile__( \
55 "nop;nop;nop;nop;nop;nop;nop\n\t" \
66 #define CACHE_UPDATED 2
68 static inline void cache_wback_all(void)
70 unsigned long addr, data, i, j;
73 for (i = 0; i < CACHE_OC_NUM_ENTRIES; i++){
74 for (j = 0; j < CACHE_OC_NUM_WAYS; j++) {
75 addr = CACHE_OC_ADDRESS_ARRAY | (j << CACHE_OC_WAY_SHIFT)
76 | (i << CACHE_OC_ENTRY_SHIFT);
78 if (data & CACHE_UPDATED) {
79 data &= ~CACHE_UPDATED;
88 #define CACHE_ENABLE 0
89 #define CACHE_DISABLE 1
91 int cache_control(unsigned int cmd)
98 if (ccr & CCR_CACHE_ENABLE)
101 if (cmd == CACHE_DISABLE)
102 outl(CCR_CACHE_STOP, CCR);
104 outl(CCR_CACHE_INIT, CCR);