aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/netlogic/common
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/netlogic/common')
-rw-r--r--arch/mips/netlogic/common/irq.c2
-rw-r--r--arch/mips/netlogic/common/reset.S39
-rw-r--r--arch/mips/netlogic/common/smp.c12
-rw-r--r--arch/mips/netlogic/common/smpboot.S12
-rw-r--r--arch/mips/netlogic/common/time.c5
5 files changed, 48 insertions, 22 deletions
diff --git a/arch/mips/netlogic/common/irq.c b/arch/mips/netlogic/common/irq.c
index 5afc4b7fce0f..c100b9afa0ab 100644
--- a/arch/mips/netlogic/common/irq.c
+++ b/arch/mips/netlogic/common/irq.c
@@ -203,6 +203,8 @@ void nlm_set_pic_extra_ack(int node, int irq, void (*xack)(struct irq_data *))
203 203
204 xirq = nlm_irq_to_xirq(node, irq); 204 xirq = nlm_irq_to_xirq(node, irq);
205 pic_data = irq_get_handler_data(xirq); 205 pic_data = irq_get_handler_data(xirq);
206 if (WARN_ON(!pic_data))
207 return;
206 pic_data->extra_ack = xack; 208 pic_data->extra_ack = xack;
207} 209}
208 210
diff --git a/arch/mips/netlogic/common/reset.S b/arch/mips/netlogic/common/reset.S
index b231fe1e7a09..701c4bcb9e47 100644
--- a/arch/mips/netlogic/common/reset.S
+++ b/arch/mips/netlogic/common/reset.S
@@ -35,6 +35,7 @@
35 35
36#include <asm/asm.h> 36#include <asm/asm.h>
37#include <asm/asm-offsets.h> 37#include <asm/asm-offsets.h>
38#include <asm/cpu.h>
38#include <asm/cacheops.h> 39#include <asm/cacheops.h>
39#include <asm/regdef.h> 40#include <asm/regdef.h>
40#include <asm/mipsregs.h> 41#include <asm/mipsregs.h>
@@ -74,13 +75,25 @@
74.endm 75.endm
75 76
76/* 77/*
78 * Allow access to physical mem >64G by enabling ELPA in PAGEGRAIN
79 * register. This is needed before going to C code since the SP can
80 * in this region. Called from all HW threads.
81 */
82.macro xlp_early_mmu_init
83 mfc0 t0, CP0_PAGEMASK, 1
84 li t1, (1 << 29) /* ELPA bit */
85 or t0, t1
86 mtc0 t0, CP0_PAGEMASK, 1
87.endm
88
89/*
77 * L1D cache has to be flushed before enabling threads in XLP. 90 * L1D cache has to be flushed before enabling threads in XLP.
78 * On XLP8xx/XLP3xx, we do a low level flush using processor control 91 * On XLP8xx/XLP3xx, we do a low level flush using processor control
79 * registers. On XLPII CPUs, usual cache instructions work. 92 * registers. On XLPII CPUs, usual cache instructions work.
80 */ 93 */
81.macro xlp_flush_l1_dcache 94.macro xlp_flush_l1_dcache
82 mfc0 t0, CP0_EBASE, 0 95 mfc0 t0, CP0_EBASE, 0
83 andi t0, t0, 0xff00 96 andi t0, t0, PRID_IMP_MASK
84 slt t1, t0, 0x1200 97 slt t1, t0, 0x1200
85 beqz t1, 15f 98 beqz t1, 15f
86 nop 99 nop
@@ -159,11 +172,15 @@ FEXPORT(nlm_reset_entry)
159 172
1601: /* Entry point on core wakeup */ 1731: /* Entry point on core wakeup */
161 mfc0 t0, CP0_EBASE, 0 /* processor ID */ 174 mfc0 t0, CP0_EBASE, 0 /* processor ID */
162 andi t0, 0xff00 175 andi t0, PRID_IMP_MASK
163 li t1, 0x1500 /* XLP 9xx */ 176 li t1, 0x1500 /* XLP 9xx */
164 beq t0, t1, 2f /* does not need to set coherent */ 177 beq t0, t1, 2f /* does not need to set coherent */
165 nop 178 nop
166 179
180 li t1, 0x1300 /* XLP 5xx */
181 beq t0, t1, 2f /* does not need to set coherent */
182 nop
183
167 /* set bit in SYS coherent register for the core */ 184 /* set bit in SYS coherent register for the core */
168 mfc0 t0, CP0_EBASE, 1 185 mfc0 t0, CP0_EBASE, 1
169 mfc0 t1, CP0_EBASE, 1 186 mfc0 t1, CP0_EBASE, 1
@@ -197,6 +214,9 @@ FEXPORT(nlm_reset_entry)
197EXPORT(nlm_boot_siblings) 214EXPORT(nlm_boot_siblings)
198 /* core L1D flush before enable threads */ 215 /* core L1D flush before enable threads */
199 xlp_flush_l1_dcache 216 xlp_flush_l1_dcache
217 /* save ra and sp, will be used later (only for boot cpu) */
218 dmtc0 ra, $22, 6
219 dmtc0 sp, $22, 7
200 /* Enable hw threads by writing to MAP_THREADMODE of the core */ 220 /* Enable hw threads by writing to MAP_THREADMODE of the core */
201 li t0, CKSEG1ADDR(RESET_DATA_PHYS) 221 li t0, CKSEG1ADDR(RESET_DATA_PHYS)
202 lw t1, BOOT_THREAD_MODE(t0) /* t1 <- thread mode */ 222 lw t1, BOOT_THREAD_MODE(t0) /* t1 <- thread mode */
@@ -225,6 +245,8 @@ EXPORT(nlm_boot_siblings)
225#endif 245#endif
226 mtc0 t1, CP0_STATUS 246 mtc0 t1, CP0_STATUS
227 247
248 xlp_early_mmu_init
249
228 /* mark CPU ready */ 250 /* mark CPU ready */
229 li t3, CKSEG1ADDR(RESET_DATA_PHYS) 251 li t3, CKSEG1ADDR(RESET_DATA_PHYS)
230 ADDIU t1, t3, BOOT_CPU_READY 252 ADDIU t1, t3, BOOT_CPU_READY
@@ -238,14 +260,12 @@ EXPORT(nlm_boot_siblings)
238 nop 260 nop
239 261
240 /* 262 /*
241 * For the boot CPU, we have to restore registers and 263 * For the boot CPU, we have to restore ra and sp and return, rest
242 * return 264 * of the registers will be restored by the caller
243 */ 265 */
2444: dmfc0 t0, $4, 2 /* restore SP from UserLocal */ 2664:
245 li t1, 0xfadebeef 267 dmfc0 ra, $22, 6
246 dmtc0 t1, $4, 2 /* restore SP from UserLocal */ 268 dmfc0 sp, $22, 7
247 PTR_SUBU sp, t0, PT_SIZE
248 RESTORE_ALL
249 jr ra 269 jr ra
250 nop 270 nop
251EXPORT(nlm_reset_entry_end) 271EXPORT(nlm_reset_entry_end)
@@ -253,6 +273,7 @@ EXPORT(nlm_reset_entry_end)
253LEAF(nlm_init_boot_cpu) 273LEAF(nlm_init_boot_cpu)
254#ifdef CONFIG_CPU_XLP 274#ifdef CONFIG_CPU_XLP
255 xlp_config_lsu 275 xlp_config_lsu
276 xlp_early_mmu_init
256#endif 277#endif
257 jr ra 278 jr ra
258 nop 279 nop
diff --git a/arch/mips/netlogic/common/smp.c b/arch/mips/netlogic/common/smp.c
index 6baae15cc7b1..4fde7ac76cc9 100644
--- a/arch/mips/netlogic/common/smp.c
+++ b/arch/mips/netlogic/common/smp.c
@@ -135,10 +135,6 @@ void nlm_smp_finish(void)
135 local_irq_enable(); 135 local_irq_enable();
136} 136}
137 137
138void nlm_cpus_done(void)
139{
140}
141
142/* 138/*
143 * Boot all other cpus in the system, initialize them, and bring them into 139 * Boot all other cpus in the system, initialize them, and bring them into
144 * the boot function 140 * the boot function
@@ -198,7 +194,7 @@ void __init nlm_smp_setup(void)
198 cpumask_scnprintf(buf, ARRAY_SIZE(buf), cpu_possible_mask); 194 cpumask_scnprintf(buf, ARRAY_SIZE(buf), cpu_possible_mask);
199 pr_info("Possible CPU mask: %s\n", buf); 195 pr_info("Possible CPU mask: %s\n", buf);
200 196
201 /* check with the cores we have worken up */ 197 /* check with the cores we have woken up */
202 for (ncore = 0, i = 0; i < NLM_NR_NODES; i++) 198 for (ncore = 0, i = 0; i < NLM_NR_NODES; i++)
203 ncore += hweight32(nlm_get_node(i)->coremask); 199 ncore += hweight32(nlm_get_node(i)->coremask);
204 200
@@ -213,6 +209,7 @@ static int nlm_parse_cpumask(cpumask_t *wakeup_mask)
213{ 209{
214 uint32_t core0_thr_mask, core_thr_mask; 210 uint32_t core0_thr_mask, core_thr_mask;
215 int threadmode, i, j; 211 int threadmode, i, j;
212 char buf[64];
216 213
217 core0_thr_mask = 0; 214 core0_thr_mask = 0;
218 for (i = 0; i < NLM_THREADS_PER_CORE; i++) 215 for (i = 0; i < NLM_THREADS_PER_CORE; i++)
@@ -247,8 +244,8 @@ static int nlm_parse_cpumask(cpumask_t *wakeup_mask)
247 return threadmode; 244 return threadmode;
248 245
249unsupp: 246unsupp:
250 panic("Unsupported CPU mask %lx", 247 cpumask_scnprintf(buf, ARRAY_SIZE(buf), wakeup_mask);
251 (unsigned long)cpumask_bits(wakeup_mask)[0]); 248 panic("Unsupported CPU mask %s", buf);
252 return 0; 249 return 0;
253} 250}
254 251
@@ -277,7 +274,6 @@ struct plat_smp_ops nlm_smp_ops = {
277 .send_ipi_mask = nlm_send_ipi_mask, 274 .send_ipi_mask = nlm_send_ipi_mask,
278 .init_secondary = nlm_init_secondary, 275 .init_secondary = nlm_init_secondary,
279 .smp_finish = nlm_smp_finish, 276 .smp_finish = nlm_smp_finish,
280 .cpus_done = nlm_cpus_done,
281 .boot_secondary = nlm_boot_secondary, 277 .boot_secondary = nlm_boot_secondary,
282 .smp_setup = nlm_smp_setup, 278 .smp_setup = nlm_smp_setup,
283 .prepare_cpus = nlm_prepare_cpus, 279 .prepare_cpus = nlm_prepare_cpus,
diff --git a/arch/mips/netlogic/common/smpboot.S b/arch/mips/netlogic/common/smpboot.S
index 8597657c27fc..805355b0bd05 100644
--- a/arch/mips/netlogic/common/smpboot.S
+++ b/arch/mips/netlogic/common/smpboot.S
@@ -54,8 +54,9 @@
54 .set noat 54 .set noat
55 .set arch=xlr /* for mfcr/mtcr, XLR is sufficient */ 55 .set arch=xlr /* for mfcr/mtcr, XLR is sufficient */
56 56
57FEXPORT(xlp_boot_core0_siblings) /* "Master" cpu starts from here */ 57/* Called by the boot cpu to wake up its sibling threads */
58 dmtc0 sp, $4, 2 /* SP saved in UserLocal */ 58NESTED(xlp_boot_core0_siblings, PT_SIZE, sp)
59 /* CPU register contents lost when enabling threads, save them first */
59 SAVE_ALL 60 SAVE_ALL
60 sync 61 sync
61 /* find the location to which nlm_boot_siblings was relocated */ 62 /* find the location to which nlm_boot_siblings was relocated */
@@ -65,9 +66,12 @@ FEXPORT(xlp_boot_core0_siblings) /* "Master" cpu starts from here */
65 dsubu t2, t1 66 dsubu t2, t1
66 daddu t2, t0 67 daddu t2, t0
67 /* call it */ 68 /* call it */
68 jr t2 69 jalr t2
69 nop 70 nop
70 /* not reached */ 71 RESTORE_ALL
72 jr ra
73 nop
74END(xlp_boot_core0_siblings)
71 75
72NESTED(nlm_boot_secondary_cpus, 16, sp) 76NESTED(nlm_boot_secondary_cpus, 16, sp)
73 /* Initialize CP0 Status */ 77 /* Initialize CP0 Status */
diff --git a/arch/mips/netlogic/common/time.c b/arch/mips/netlogic/common/time.c
index 13391b8a6031..0c0a1a606f73 100644
--- a/arch/mips/netlogic/common/time.c
+++ b/arch/mips/netlogic/common/time.c
@@ -82,6 +82,7 @@ static struct clocksource csrc_pic = {
82static void nlm_init_pic_timer(void) 82static void nlm_init_pic_timer(void)
83{ 83{
84 uint64_t picbase = nlm_get_node(0)->picbase; 84 uint64_t picbase = nlm_get_node(0)->picbase;
85 u32 picfreq;
85 86
86 nlm_pic_set_timer(picbase, PIC_CLOCK_TIMER, ~0ULL, 0, 0); 87 nlm_pic_set_timer(picbase, PIC_CLOCK_TIMER, ~0ULL, 0, 0);
87 if (current_cpu_data.cputype == CPU_XLR) { 88 if (current_cpu_data.cputype == CPU_XLR) {
@@ -92,7 +93,9 @@ static void nlm_init_pic_timer(void)
92 csrc_pic.read = nlm_get_pic_timer; 93 csrc_pic.read = nlm_get_pic_timer;
93 } 94 }
94 csrc_pic.rating = 1000; 95 csrc_pic.rating = 1000;
95 clocksource_register_hz(&csrc_pic, pic_timer_freq()); 96 picfreq = pic_timer_freq();
97 clocksource_register_hz(&csrc_pic, picfreq);
98 pr_info("PIC clock source added, frequency %d\n", picfreq);
96} 99}
97 100
98void __init plat_time_init(void) 101void __init plat_time_init(void)