l2x0.c 1.1 KB
Newer Older
R
Rongjun Ying 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13
/*
 * l2 cache initialization for CSR SiRFprimaII
 *
 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
 *
 * Licensed under GPLv2 or later.
 */

#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/of.h>
#include <asm/hardware/cache-l2x0.h>

14
struct l2x0_aux {
15 16 17 18
	u32 val;
	u32 mask;
};

19
static const struct l2x0_aux prima2_l2x0_aux __initconst = {
20 21 22 23
	.val = 2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT,
	.mask =	0,
};

24
static const struct l2x0_aux marco_l2x0_aux __initconst = {
25 26 27 28 29
	.val = (2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) |
		(1 << L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT),
	.mask = L2X0_AUX_CTRL_MASK,
};

30
static const struct of_device_id sirf_l2x0_ids[] __initconst = {
31 32
	{ .compatible = "sirf,prima2-pl310-cache", .data = &prima2_l2x0_aux, },
	{ .compatible = "sirf,marco-pl310-cache", .data = &marco_l2x0_aux, },
33
	{},
R
Rongjun Ying 已提交
34 35
};

36
static int __init sirfsoc_l2x0_init(void)
R
Rongjun Ying 已提交
37 38
{
	struct device_node *np;
39
	const struct l2x0_aux *aux;
R
Rongjun Ying 已提交
40

41
	np = of_find_matching_node(NULL, sirf_l2x0_ids);
42
	if (np) {
43 44
		aux = of_match_node(sirf_l2x0_ids, np)->data;
		return l2x0_of_init(aux->val, aux->mask);
R
Rongjun Ying 已提交
45 46 47 48
	}

	return 0;
}
49
early_initcall(sirfsoc_l2x0_init);