blob: cbcbe9cb094c480a928d22ad23642eec3ecc0178 [file] [log] [blame]
Rongjun Ying89e162a2011-07-08 02:40:14 -07001/*
2 * l2 cache initialization for CSR SiRFprimaII
3 *
4 * Copyright (c) 2011 Cambridge Silicon Radio Limited, a CSR plc group company.
5 *
6 * Licensed under GPLv2 or later.
7 */
8
9#include <linux/init.h>
10#include <linux/kernel.h>
Rongjun Ying89e162a2011-07-08 02:40:14 -070011#include <linux/of.h>
Rongjun Ying89e162a2011-07-08 02:40:14 -070012#include <asm/hardware/cache-l2x0.h>
Rongjun Ying89e162a2011-07-08 02:40:14 -070013
Barry Songea389602012-12-20 17:20:46 +080014struct l2x0_aux
15{
16 u32 val;
17 u32 mask;
18};
19
20static struct l2x0_aux prima2_l2x0_aux __initconst = {
21 .val = 2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT,
22 .mask = 0,
23};
24
25static struct l2x0_aux marco_l2x0_aux __initconst = {
26 .val = (2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) |
27 (1 << L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT),
28 .mask = L2X0_AUX_CTRL_MASK,
29};
30
31static struct of_device_id sirf_l2x0_ids[] __initconst = {
32 { .compatible = "sirf,prima2-pl310-cache", .data = &prima2_l2x0_aux, },
33 { .compatible = "sirf,marco-pl310-cache", .data = &marco_l2x0_aux, },
Barry Song917d8532011-09-15 19:16:28 -070034 {},
Rongjun Ying89e162a2011-07-08 02:40:14 -070035};
36
Barry Song917d8532011-09-15 19:16:28 -070037static int __init sirfsoc_l2x0_init(void)
Rongjun Ying89e162a2011-07-08 02:40:14 -070038{
39 struct device_node *np;
Barry Songea389602012-12-20 17:20:46 +080040 const struct l2x0_aux *aux;
Rongjun Ying89e162a2011-07-08 02:40:14 -070041
Barry Songea389602012-12-20 17:20:46 +080042 np = of_find_matching_node(NULL, sirf_l2x0_ids);
Barry Song917d8532011-09-15 19:16:28 -070043 if (np) {
Barry Songea389602012-12-20 17:20:46 +080044 aux = of_match_node(sirf_l2x0_ids, np)->data;
45 return l2x0_of_init(aux->val, aux->mask);
Rongjun Ying89e162a2011-07-08 02:40:14 -070046 }
Rongjun Ying89e162a2011-07-08 02:40:14 -070047
48 return 0;
49}
Barry Song917d8532011-09-15 19:16:28 -070050early_initcall(sirfsoc_l2x0_init);