diff options
author | David Daney <david.daney@cavium.com> | 2014-05-28 17:52:09 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-05-30 15:01:10 -0400 |
commit | 18a8cd63c0d800bbc8b91f03054fcb13d308f6ec (patch) | |
tree | 0b63b2e2c0d7b373372ab277557b2d87198ed429 /arch/mips/mm/c-r4k.c | |
parent | 35d0470668cca234e49ed35342b3f9a0eec8355c (diff) |
MIPS: Add minimal support for OCTEON3 to c-r4k.c
These are needed to boot a generic mips64r2 kernel on OCTEONIII.
Signed-off-by: David Daney <david.daney@cavium.com>
Signed-off-by: Andreas Herrmann <andreas.herrmann@caviumnetworks.com>
Cc: linux-mips@linux-mips.org
Cc: James Hogan <james.hogan@imgtec.com>
Cc: kvm@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/7003/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/mm/c-r4k.c')
-rw-r--r-- | arch/mips/mm/c-r4k.c | 48 |
1 files changed, 44 insertions, 4 deletions
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index 587a14874f98..f2e8302fa70f 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c | |||
@@ -109,18 +109,34 @@ static inline void r4k_blast_dcache_page_dc64(unsigned long addr) | |||
109 | blast_dcache64_page(addr); | 109 | blast_dcache64_page(addr); |
110 | } | 110 | } |
111 | 111 | ||
112 | static inline void r4k_blast_dcache_page_dc128(unsigned long addr) | ||
113 | { | ||
114 | blast_dcache128_page(addr); | ||
115 | } | ||
116 | |||
112 | static void r4k_blast_dcache_page_setup(void) | 117 | static void r4k_blast_dcache_page_setup(void) |
113 | { | 118 | { |
114 | unsigned long dc_lsize = cpu_dcache_line_size(); | 119 | unsigned long dc_lsize = cpu_dcache_line_size(); |
115 | 120 | ||
116 | if (dc_lsize == 0) | 121 | switch (dc_lsize) { |
122 | case 0: | ||
117 | r4k_blast_dcache_page = (void *)cache_noop; | 123 | r4k_blast_dcache_page = (void *)cache_noop; |
118 | else if (dc_lsize == 16) | 124 | break; |
125 | case 16: | ||
119 | r4k_blast_dcache_page = blast_dcache16_page; | 126 | r4k_blast_dcache_page = blast_dcache16_page; |
120 | else if (dc_lsize == 32) | 127 | break; |
128 | case 32: | ||
121 | r4k_blast_dcache_page = r4k_blast_dcache_page_dc32; | 129 | r4k_blast_dcache_page = r4k_blast_dcache_page_dc32; |
122 | else if (dc_lsize == 64) | 130 | break; |
131 | case 64: | ||
123 | r4k_blast_dcache_page = r4k_blast_dcache_page_dc64; | 132 | r4k_blast_dcache_page = r4k_blast_dcache_page_dc64; |
133 | break; | ||
134 | case 128: | ||
135 | r4k_blast_dcache_page = r4k_blast_dcache_page_dc128; | ||
136 | break; | ||
137 | default: | ||
138 | break; | ||
139 | } | ||
124 | } | 140 | } |
125 | 141 | ||
126 | #ifndef CONFIG_EVA | 142 | #ifndef CONFIG_EVA |
@@ -159,6 +175,8 @@ static void r4k_blast_dcache_page_indexed_setup(void) | |||
159 | r4k_blast_dcache_page_indexed = blast_dcache32_page_indexed; | 175 | r4k_blast_dcache_page_indexed = blast_dcache32_page_indexed; |
160 | else if (dc_lsize == 64) | 176 | else if (dc_lsize == 64) |
161 | r4k_blast_dcache_page_indexed = blast_dcache64_page_indexed; | 177 | r4k_blast_dcache_page_indexed = blast_dcache64_page_indexed; |
178 | else if (dc_lsize == 128) | ||
179 | r4k_blast_dcache_page_indexed = blast_dcache128_page_indexed; | ||
162 | } | 180 | } |
163 | 181 | ||
164 | void (* r4k_blast_dcache)(void); | 182 | void (* r4k_blast_dcache)(void); |
@@ -176,6 +194,8 @@ static void r4k_blast_dcache_setup(void) | |||
176 | r4k_blast_dcache = blast_dcache32; | 194 | r4k_blast_dcache = blast_dcache32; |
177 | else if (dc_lsize == 64) | 195 | else if (dc_lsize == 64) |
178 | r4k_blast_dcache = blast_dcache64; | 196 | r4k_blast_dcache = blast_dcache64; |
197 | else if (dc_lsize == 128) | ||
198 | r4k_blast_dcache = blast_dcache128; | ||
179 | } | 199 | } |
180 | 200 | ||
181 | /* force code alignment (used for TX49XX_ICACHE_INDEX_INV_WAR) */ | 201 | /* force code alignment (used for TX49XX_ICACHE_INDEX_INV_WAR) */ |
@@ -265,6 +285,8 @@ static void r4k_blast_icache_page_setup(void) | |||
265 | r4k_blast_icache_page = blast_icache32_page; | 285 | r4k_blast_icache_page = blast_icache32_page; |
266 | else if (ic_lsize == 64) | 286 | else if (ic_lsize == 64) |
267 | r4k_blast_icache_page = blast_icache64_page; | 287 | r4k_blast_icache_page = blast_icache64_page; |
288 | else if (ic_lsize == 128) | ||
289 | r4k_blast_icache_page = blast_icache128_page; | ||
268 | } | 290 | } |
269 | 291 | ||
270 | #ifndef CONFIG_EVA | 292 | #ifndef CONFIG_EVA |
@@ -338,6 +360,8 @@ static void r4k_blast_icache_setup(void) | |||
338 | r4k_blast_icache = blast_icache32; | 360 | r4k_blast_icache = blast_icache32; |
339 | } else if (ic_lsize == 64) | 361 | } else if (ic_lsize == 64) |
340 | r4k_blast_icache = blast_icache64; | 362 | r4k_blast_icache = blast_icache64; |
363 | else if (ic_lsize == 128) | ||
364 | r4k_blast_icache = blast_icache128; | ||
341 | } | 365 | } |
342 | 366 | ||
343 | static void (* r4k_blast_scache_page)(unsigned long addr); | 367 | static void (* r4k_blast_scache_page)(unsigned long addr); |
@@ -1094,6 +1118,21 @@ static void probe_pcache(void) | |||
1094 | c->dcache.waybit = 0; | 1118 | c->dcache.waybit = 0; |
1095 | break; | 1119 | break; |
1096 | 1120 | ||
1121 | case CPU_CAVIUM_OCTEON3: | ||
1122 | /* For now lie about the number of ways. */ | ||
1123 | c->icache.linesz = 128; | ||
1124 | c->icache.sets = 16; | ||
1125 | c->icache.ways = 8; | ||
1126 | c->icache.flags |= MIPS_CACHE_VTAG; | ||
1127 | icache_size = c->icache.sets * c->icache.ways * c->icache.linesz; | ||
1128 | |||
1129 | c->dcache.linesz = 128; | ||
1130 | c->dcache.ways = 8; | ||
1131 | c->dcache.sets = 8; | ||
1132 | dcache_size = c->dcache.sets * c->dcache.ways * c->dcache.linesz; | ||
1133 | c->options |= MIPS_CPU_PREFETCH; | ||
1134 | break; | ||
1135 | |||
1097 | default: | 1136 | default: |
1098 | if (!(config & MIPS_CONF_M)) | 1137 | if (!(config & MIPS_CONF_M)) |
1099 | panic("Don't know how to probe P-caches on this cpu."); | 1138 | panic("Don't know how to probe P-caches on this cpu."); |
@@ -1414,6 +1453,7 @@ static void setup_scache(void) | |||
1414 | loongson3_sc_init(); | 1453 | loongson3_sc_init(); |
1415 | return; | 1454 | return; |
1416 | 1455 | ||
1456 | case CPU_CAVIUM_OCTEON3: | ||
1417 | case CPU_XLP: | 1457 | case CPU_XLP: |
1418 | /* don't need to worry about L2, fully coherent */ | 1458 | /* don't need to worry about L2, fully coherent */ |
1419 | return; | 1459 | return; |