2 * linux/arch/m32r/mm/cache.c
4 * Copyright (C) 2002 Hirokazu Takata
9 #include <linux/config.h>
10 #include <asm/pgtable.h>
14 #if defined(CONFIG_CHIP_XNUX2) || defined(CONFIG_CHIP_M32700) || defined(CONFIG_CHIP_VDEC2) || defined(CONFIG_CHIP_OPSP)
15 /* Cache Control Register */
16 #define MCCR ((volatile unsigned long*)0xfffffffc)
17 #define MCCR_CC (1UL << 7) /* Cache mode modify bit */
18 #define MCCR_IIV (1UL << 6) /* I-cache invalidate */
19 #define MCCR_DIV (1UL << 5) /* D-cache invalidate */
20 #define MCCR_DCB (1UL << 4) /* D-cache copy back */
21 #define MCCR_ICM (1UL << 1) /* I-cache mode [0:off,1:on] */
22 #define MCCR_DCM (1UL << 0) /* D-cache mode [0:off,1:on] */
23 #define MCCR_ICACHE_INV (MCCR_CC|MCCR_IIV)
24 #define MCCR_DCACHE_CB (MCCR_CC|MCCR_DCB)
25 #define MCCR_DCACHE_CBINV (MCCR_CC|MCCR_DIV|MCCR_DCB)
26 #define CHECK_MCCR(mccr) (mccr = *MCCR)
27 #elif defined(CONFIG_CHIP_M32102)
28 #define MCCR ((volatile unsigned long*)0xfffffffc)
29 #define MCCR_IIV (1UL << 8) /* I-cache invalidate */
30 #define MCCR_ICACHE_INV MCCR_IIV
31 #endif /* CONFIG_CHIP_XNUX2 || CONFIG_CHIP_M32700 */
34 #error Unknown cache type.
38 /* Copy back and invalidate D-cache and invalidate I-cache all */
39 void _flush_cache_all(void)
41 #if defined(CONFIG_CHIP_M32102)
42 *MCCR
= MCCR_ICACHE_INV
;
46 /* Copyback and invalidate D-cache */
47 /* Invalidate I-cache */
48 *MCCR
= MCCR_ICACHE_INV
| MCCR_DCACHE_CBINV
;
49 while ((mccr
= *MCCR
) & MCCR_IIV
); /* loop while invalidating... */
53 /* Copy back D-cache and invalidate I-cache all */
54 void _flush_cache_copyback_all(void)
56 #if defined(CONFIG_CHIP_M32102)
57 *MCCR
= MCCR_ICACHE_INV
;
61 /* Copyback D-cache */
62 /* Invalidate I-cache */
63 *MCCR
= MCCR_ICACHE_INV
| MCCR_DCACHE_CB
;
64 while ((mccr
= *MCCR
) & MCCR_IIV
); /* loop while invalidating... */