aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/kernel/smp-bmips.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/kernel/smp-bmips.c')
-rw-r--r--arch/mips/kernel/smp-bmips.c30
1 files changed, 18 insertions, 12 deletions
diff --git a/arch/mips/kernel/smp-bmips.c b/arch/mips/kernel/smp-bmips.c
index aea6c0885838..126da74d4c55 100644
--- a/arch/mips/kernel/smp-bmips.c
+++ b/arch/mips/kernel/smp-bmips.c
@@ -66,6 +66,8 @@ static void __init bmips_smp_setup(void)
66 int i, cpu = 1, boot_cpu = 0; 66 int i, cpu = 1, boot_cpu = 0;
67 67
68#if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380) 68#if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380)
69 int cpu_hw_intr;
70
69 /* arbitration priority */ 71 /* arbitration priority */
70 clear_c0_brcm_cmt_ctrl(0x30); 72 clear_c0_brcm_cmt_ctrl(0x30);
71 73
@@ -79,15 +81,13 @@ static void __init bmips_smp_setup(void)
79 * MIPS interrupts 0,1 (SW INT 0,1) cross over to the other thread 81 * MIPS interrupts 0,1 (SW INT 0,1) cross over to the other thread
80 * MIPS interrupt 2 (HW INT 0) is the CPU0 L1 controller output 82 * MIPS interrupt 2 (HW INT 0) is the CPU0 L1 controller output
81 * MIPS interrupt 3 (HW INT 1) is the CPU1 L1 controller output 83 * MIPS interrupt 3 (HW INT 1) is the CPU1 L1 controller output
82 *
83 * If booting from TP1, leave the existing CMT interrupt routing
84 * such that TP0 responds to SW1 and TP1 responds to SW0.
85 */ 84 */
86 if (boot_cpu == 0) 85 if (boot_cpu == 0)
87 change_c0_brcm_cmt_intr(0xf8018000, 86 cpu_hw_intr = 0x02;
88 (0x02 << 27) | (0x03 << 15));
89 else 87 else
90 change_c0_brcm_cmt_intr(0xf8018000, (0x1d << 27)); 88 cpu_hw_intr = 0x1d;
89
90 change_c0_brcm_cmt_intr(0xf8018000, (cpu_hw_intr << 27) | (0x03 << 15));
91 91
92 /* single core, 2 threads (2 pipelines) */ 92 /* single core, 2 threads (2 pipelines) */
93 max_cpus = 2; 93 max_cpus = 2;
@@ -173,7 +173,7 @@ static void bmips_boot_secondary(int cpu, struct task_struct *idle)
173 else { 173 else {
174#if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380) 174#if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380)
175 /* Reset slave TP1 if booting from TP0 */ 175 /* Reset slave TP1 if booting from TP0 */
176 if (cpu_logical_map(cpu) == 0) 176 if (cpu_logical_map(cpu) == 1)
177 set_c0_brcm_cmt_ctrl(0x01); 177 set_c0_brcm_cmt_ctrl(0x01);
178#elif defined(CONFIG_CPU_BMIPS5000) 178#elif defined(CONFIG_CPU_BMIPS5000)
179 if (cpu & 0x01) 179 if (cpu & 0x01)
@@ -202,9 +202,15 @@ static void bmips_init_secondary(void)
202#if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380) 202#if defined(CONFIG_CPU_BMIPS4350) || defined(CONFIG_CPU_BMIPS4380)
203 void __iomem *cbr = BMIPS_GET_CBR(); 203 void __iomem *cbr = BMIPS_GET_CBR();
204 unsigned long old_vec; 204 unsigned long old_vec;
205 unsigned long relo_vector;
206 int boot_cpu;
207
208 boot_cpu = !!(read_c0_brcm_cmt_local() & (1 << 31));
209 relo_vector = boot_cpu ? BMIPS_RELO_VECTOR_CONTROL_0 :
210 BMIPS_RELO_VECTOR_CONTROL_1;
205 211
206 old_vec = __raw_readl(cbr + BMIPS_RELO_VECTOR_CONTROL_1); 212 old_vec = __raw_readl(cbr + relo_vector);
207 __raw_writel(old_vec & ~0x20000000, cbr + BMIPS_RELO_VECTOR_CONTROL_1); 213 __raw_writel(old_vec & ~0x20000000, cbr + relo_vector);
208 214
209 clear_c0_cause(smp_processor_id() ? C_SW1 : C_SW0); 215 clear_c0_cause(smp_processor_id() ? C_SW1 : C_SW0);
210#elif defined(CONFIG_CPU_BMIPS5000) 216#elif defined(CONFIG_CPU_BMIPS5000)
@@ -398,7 +404,7 @@ struct plat_smp_ops bmips_smp_ops = {
398 * UP BMIPS systems as well. 404 * UP BMIPS systems as well.
399 ***********************************************************************/ 405 ***********************************************************************/
400 406
401static void __cpuinit bmips_wr_vec(unsigned long dst, char *start, char *end) 407static void bmips_wr_vec(unsigned long dst, char *start, char *end)
402{ 408{
403 memcpy((void *)dst, start, end - start); 409 memcpy((void *)dst, start, end - start);
404 dma_cache_wback((unsigned long)start, end - start); 410 dma_cache_wback((unsigned long)start, end - start);
@@ -406,7 +412,7 @@ static void __cpuinit bmips_wr_vec(unsigned long dst, char *start, char *end)
406 instruction_hazard(); 412 instruction_hazard();
407} 413}
408 414
409static inline void __cpuinit bmips_nmi_handler_setup(void) 415static inline void bmips_nmi_handler_setup(void)
410{ 416{
411 bmips_wr_vec(BMIPS_NMI_RESET_VEC, &bmips_reset_nmi_vec, 417 bmips_wr_vec(BMIPS_NMI_RESET_VEC, &bmips_reset_nmi_vec,
412 &bmips_reset_nmi_vec_end); 418 &bmips_reset_nmi_vec_end);
@@ -414,7 +420,7 @@ static inline void __cpuinit bmips_nmi_handler_setup(void)
414 &bmips_smp_int_vec_end); 420 &bmips_smp_int_vec_end);
415} 421}
416 422
417void __cpuinit bmips_ebase_setup(void) 423void bmips_ebase_setup(void)
418{ 424{
419 unsigned long new_ebase = ebase; 425 unsigned long new_ebase = ebase;
420 void __iomem __maybe_unused *cbr; 426 void __iomem __maybe_unused *cbr;