493d9fa111452cb195b108e464c7811f7c0b5dd9
[openwrt/staging/chunkeey.git] / target / linux / coldfire / files-2.6.31 / arch / m68k / coldfire / common / cache.c
1 /*
2 * linux/arch/m68k/coldfire/cache.c
3 *
4 * Copyright 2007-2009 Freescale Semiconductor, Inc. All Rights Reserved.
5 * Matt Waddel Matt.Waddel@freescale.com
6 * Kurt Mahan kmahan@freescale.com
7 * Jason Jin Jason.Jin@freescale.com
8 * Shrek Wu B16972@freescale.com
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 */
15
16 #include <linux/interrupt.h>
17 #include <asm/cfcache.h>
18 #include <asm/coldfire.h>
19 #include <asm/system.h>
20
21 /* Cache Control Reg shadow reg */
22 unsigned long shadow_cacr;
23
24 /**
25 * cacr_set - Set the Cache Control Register
26 * @x Value to set
27 */
28 void cacr_set(unsigned long x)
29 {
30 shadow_cacr = x;
31
32 __asm__ __volatile__ ("movec %0, %%cacr"
33 : /* no outputs */
34 : "r" (shadow_cacr));
35 }
36
37 /**
38 * cacr_get - Get the current value of the Cache Control Register
39 *
40 * @return CACR value
41 */
42 unsigned long cacr_get(void)
43 {
44 return shadow_cacr;
45 }