MIPS: BMIPS: add a smp ops registration helper
authorJonas Gorski <jogo@openwrt.org>
Wed, 18 Dec 2013 13:12:06 +0000 (14:12 +0100)
committerRalf Baechle <ralf@linux-mips.org>
Wed, 22 Jan 2014 19:18:52 +0000 (20:18 +0100)
Add a helper similar to the generic register_XXX_smp_ops() for bmips.
Register SMP UP ops in case of BMIPS32/3300.

Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Signed-off-by: John Crispin <blogic@openwrt.org>
Patchwork: http://patchwork.linux-mips.org/patch/6248/

arch/mips/Kconfig
arch/mips/bcm63xx/prom.c
arch/mips/include/asm/bmips.h

index 7eaa4129dbcc88645bb82e26194c40d02e16e2e7..f2f6c1de2389b06ad86c8987fc6ec20adbea1a6c 100644 (file)
@@ -1479,6 +1479,7 @@ config CPU_LOONGSON1
        select CPU_SUPPORTS_HIGHMEM
 
 config CPU_BMIPS32_3300
+       select SMP_UP if SMP
        bool
 
 config CPU_BMIPS4350
index 9872ca34d0c420e9597b8ddb93e262b1994250af..f93f4fc00ca5bedf289d2311bd6c806db6dc58ad 100644 (file)
@@ -61,7 +61,7 @@ void __init prom_init(void)
 
        if (IS_ENABLED(CONFIG_CPU_BMIPS4350) && IS_ENABLED(CONFIG_SMP)) {
                /* set up SMP */
-               register_smp_ops(&bmips43xx_smp_ops);
+               register_bmips_smp_ops();
 
                /*
                 * BCM6328 might not have its second CPU enabled, while BCM3368
index 880f6aadeaeabe5eea19309df0f85b1a0717836e..cbaccebf5065cd30c7c7f0e30550b0003edacd8d 100644 (file)
 
 #include <linux/cpumask.h>
 #include <asm/r4kcache.h>
+#include <asm/smp-ops.h>
 
 extern struct plat_smp_ops bmips43xx_smp_ops;
 extern struct plat_smp_ops bmips5000_smp_ops;
+
+static inline int register_bmips_smp_ops(void)
+{
+#if IS_ENABLED(CONFIG_CPU_BMIPS) && IS_ENABLED(CONFIG_SMP)
+       switch (current_cpu_type()) {
+       case CPU_BMIPS32:
+       case CPU_BMIPS3300:
+               return register_up_smp_ops();
+       case CPU_BMIPS4350:
+       case CPU_BMIPS4380:
+               register_smp_ops(&bmips43xx_smp_ops);
+               break;
+       case CPU_BMIPS5000:
+               register_smp_ops(&bmips5000_smp_ops);
+               break;
+       default:
+               return -ENODEV;
+       }
+
+       return 0;
+#else
+       return -ENODEV;
+#endif
+}
+
 extern char bmips_reset_nmi_vec;
 extern char bmips_reset_nmi_vec_end;
 extern char bmips_smp_movevec;