aboutsummaryrefslogtreecommitdiff
path: root/arch/sh/mm/pmb-fixed.c
blob: 43c8eac4d8a150a8414e50ad00f1d10d34e872c3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
 * arch/sh/mm/fixed_pmb.c
 *
 * Copyright (C) 2009  Renesas Solutions Corp.
 *
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 */
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/io.h>
#include <asm/mmu.h>
#include <asm/mmu_context.h>

static int __uses_jump_to_uncached fixed_pmb_init(void)
{
	int i;
	unsigned long addr, data;

	jump_to_uncached();

	for (i = 0; i < PMB_ENTRY_MAX; i++) {
		addr = PMB_DATA + (i << PMB_E_SHIFT);
		data = ctrl_inl(addr);
		if (!(data & PMB_V))
			continue;

		if (data & PMB_C) {
#if defined(CONFIG_CACHE_WRITETHROUGH)
			data |= PMB_WT;
#elif defined(CONFIG_CACHE_WRITEBACK)
			data &= ~PMB_WT;
#else
			data &= ~(PMB_C | PMB_WT);
#endif
		}
		ctrl_outl(data, addr);
	}

	back_to_cached();

	return 0;
}
arch_initcall(fixed_pmb_init);