1 From 7c44eabf20cba12049bf9eebfa192afcc2053b2d Mon Sep 17 00:00:00 2001
2 From: Kevin Cernekee <cernekee@gmail.com>
3 Date: Sat, 9 Jul 2011 12:15:06 -0700
4 Subject: [PATCH V2 1/2] MIPS: BCM63XX: Add SMP support to prom.c
6 This involves two changes to the BSP code:
8 1) register_smp_ops() for BMIPS SMP
10 2) The CPU1 boot vector on some of the BCM63xx platforms conflicts with
11 the special interrupt vector (IV). Move it to 0x8000_0380 at boot time,
12 to resolve the conflict.
14 Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
15 [jogo@openwrt.org: moved SMP ops registration into ifdef guard,
16 changed ifdef guards to if (IS_ENABLED())]
17 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
20 * changed ifdef guards to if (IS_ENABLED())
22 arch/mips/bcm63xx/prom.c | 41 +++++++++++++++++++++++++++++++++++++++++
23 1 file changed, 41 insertions(+)
25 --- a/arch/mips/bcm63xx/prom.c
26 +++ b/arch/mips/bcm63xx/prom.c
29 #include <linux/init.h>
30 #include <linux/bootmem.h>
31 +#include <linux/smp.h>
32 #include <asm/bootinfo.h>
33 +#include <asm/bmips.h>
34 +#include <asm/smp-ops.h>
35 +#include <asm/mipsregs.h>
36 #include <bcm63xx_board.h>
37 #include <bcm63xx_cpu.h>
38 #include <bcm63xx_io.h>
39 @@ -54,6 +58,43 @@ void __init prom_init(void)
41 /* do low level board init */
44 + if (IS_ENABLED(CONFIG_CPU_BMIPS4350) && IS_ENABLED(CONFIG_SMP)) {
46 + register_smp_ops(&bmips_smp_ops);
49 + * BCM6328 might not have its second CPU enabled, while BCM6358
50 + * needs special handling for its shared TLB, so disable SMP
53 + if (BCMCPU_IS_6328()) {
54 + bmips_smp_enabled = 0;
55 + } else if (BCMCPU_IS_6358()) {
56 + bmips_smp_enabled = 0;
59 + if (!bmips_smp_enabled)
63 + * The bootloader has set up the CPU1 reset vector at
65 + * This conflicts with the special interrupt vector (IV).
66 + * The bootloader has also set up CPU1 to respond to the wrong
68 + * Here we will start up CPU1 in the background and ask it to
69 + * reconfigure itself then go back to sleep.
71 + memcpy((void *)0xa0000200, &bmips_smp_movevec, 0x20);
73 + set_c0_cause(C_SW0);
74 + cpumask_set_cpu(1, &bmips_booted_mask);
77 + * FIXME: we really should have some sort of hazard barrier here
82 void __init prom_free_prom_memory(void)