aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/bcm63xx/prom.c
diff options
context:
space:
mode:
authorKevin Cernekee <cernekee@gmail.com>2013-06-18 04:34:31 -0400
committerRalf Baechle <ralf@linux-mips.org>2013-07-01 09:10:59 -0400
commita068dde168e0c618e1dc2151a0922254ec3bbf04 (patch)
tree420cc77a04b8c6435214965b2fed4dcca8842bee /arch/mips/bcm63xx/prom.c
parentedd4201ebc2f1a7ab2158ad91ddc0af71e58dce7 (diff)
MIPS: BCM63xx: Add SMP support to prom.c
This involves two changes to the BSP code: 1) register_smp_ops() for BMIPS SMP 2) The CPU1 boot vector on some of the BCM63xx platforms conflicts with the special interrupt vector (IV). Move it to 0x8000_0380 at boot time, to resolve the conflict. Signed-off-by: Kevin Cernekee <cernekee@gmail.com> [jogo@openwrt.org: moved SMP ops registration into ifdef guard, changed ifdef guards to if (IS_ENABLED())] Signed-off-by: Jonas Gorski <jogo@openwrt.org> Cc: linux-mips@linux-mips.org Cc: John Crispin <blogic@openwrt.org> Cc: Maxime Bizon <mbizon@freebox.fr> Cc: Florian Fainelli <florian@openwrt.org> Patchwork: https://patchwork.linux-mips.org/patch/5489/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/bcm63xx/prom.c')
-rw-r--r--arch/mips/bcm63xx/prom.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/arch/mips/bcm63xx/prom.c b/arch/mips/bcm63xx/prom.c
index f3ff28f4c258..3b21454c56a0 100644
--- a/arch/mips/bcm63xx/prom.c
+++ b/arch/mips/bcm63xx/prom.c
@@ -8,7 +8,11 @@
8 8
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/bootmem.h> 10#include <linux/bootmem.h>
11#include <linux/smp.h>
11#include <asm/bootinfo.h> 12#include <asm/bootinfo.h>
13#include <asm/bmips.h>
14#include <asm/smp-ops.h>
15#include <asm/mipsregs.h>
12#include <bcm63xx_board.h> 16#include <bcm63xx_board.h>
13#include <bcm63xx_cpu.h> 17#include <bcm63xx_cpu.h>
14#include <bcm63xx_io.h> 18#include <bcm63xx_io.h>
@@ -54,6 +58,43 @@ void __init prom_init(void)
54 58
55 /* do low level board init */ 59 /* do low level board init */
56 board_prom_init(); 60 board_prom_init();
61
62 if (IS_ENABLED(CONFIG_CPU_BMIPS4350) && IS_ENABLED(CONFIG_SMP)) {
63 /* set up SMP */
64 register_smp_ops(&bmips_smp_ops);
65
66 /*
67 * BCM6328 might not have its second CPU enabled, while BCM6358
68 * needs special handling for its shared TLB, so disable SMP
69 * for now.
70 */
71 if (BCMCPU_IS_6328()) {
72 bmips_smp_enabled = 0;
73 } else if (BCMCPU_IS_6358()) {
74 bmips_smp_enabled = 0;
75 }
76
77 if (!bmips_smp_enabled)
78 return;
79
80 /*
81 * The bootloader has set up the CPU1 reset vector at
82 * 0xa000_0200.
83 * This conflicts with the special interrupt vector (IV).
84 * The bootloader has also set up CPU1 to respond to the wrong
85 * IPI interrupt.
86 * Here we will start up CPU1 in the background and ask it to
87 * reconfigure itself then go back to sleep.
88 */
89 memcpy((void *)0xa0000200, &bmips_smp_movevec, 0x20);
90 __sync();
91 set_c0_cause(C_SW0);
92 cpumask_set_cpu(1, &bmips_booted_mask);
93
94 /*
95 * FIXME: we really should have some sort of hazard barrier here
96 */
97 }
57} 98}
58 99
59void __init prom_free_prom_memory(void) 100void __init prom_free_prom_memory(void)