amd64_edac: bump driver version
[sfrench/cifs-2.6.git] / arch / sh / mm / pmb-fixed.c
1 /*
2  * arch/sh/mm/fixed_pmb.c
3  *
4  * Copyright (C) 2009  Renesas Solutions Corp.
5  *
6  * This file is subject to the terms and conditions of the GNU General Public
7  * License.  See the file "COPYING" in the main directory of this archive
8  * for more details.
9  */
10 #include <linux/init.h>
11 #include <linux/mm.h>
12 #include <linux/io.h>
13 #include <asm/mmu.h>
14 #include <asm/mmu_context.h>
15
16 static int __uses_jump_to_uncached fixed_pmb_init(void)
17 {
18         int i;
19         unsigned long addr, data;
20
21         jump_to_uncached();
22
23         for (i = 0; i < PMB_ENTRY_MAX; i++) {
24                 addr = PMB_DATA + (i << PMB_E_SHIFT);
25                 data = ctrl_inl(addr);
26                 if (!(data & PMB_V))
27                         continue;
28
29                 if (data & PMB_C) {
30 #if defined(CONFIG_CACHE_WRITETHROUGH)
31                         data |= PMB_WT;
32 #elif defined(CONFIG_CACHE_WRITEBACK)
33                         data &= ~PMB_WT;
34 #else
35                         data &= ~(PMB_C | PMB_WT);
36 #endif
37                 }
38                 ctrl_outl(data, addr);
39         }
40
41         back_to_cached();
42
43         return 0;
44 }
45 arch_initcall(fixed_pmb_init);