xtensa: convert to asm-generic/hardirq.h
[safe/jmp/linux-2.6] / arch / arm / mach-realview / platsmp.c
index c567d3e..0092658 100644 (file)
 #include <mach/hardware.h>
 #include <asm/mach-types.h>
 #include <asm/localtimer.h>
+#include <asm/unified.h>
 
 #include <mach/board-eb.h>
 #include <mach/board-pb11mp.h>
+#include <mach/board-pbx.h>
 #include <asm/smp_scu.h>
 
 #include "core.h"
@@ -41,35 +43,19 @@ static void __iomem *scu_base_addr(void)
                return __io_address(REALVIEW_EB11MP_SCU_BASE);
        else if (machine_is_realview_pb11mp())
                return __io_address(REALVIEW_TC11MP_SCU_BASE);
+       else if (machine_is_realview_pbx() &&
+                (core_tile_pbx11mp() || core_tile_pbxa9mp()))
+               return __io_address(REALVIEW_PBX_TILE_SCU_BASE);
        else
                return (void __iomem *)0;
 }
 
-static unsigned int __init get_core_count(void)
+static inline unsigned int get_core_count(void)
 {
-       unsigned int ncores;
        void __iomem *scu_base = scu_base_addr();
-
-       if (scu_base) {
-               ncores = __raw_readl(scu_base + SCU_CONFIG);
-               ncores = (ncores & 0x03) + 1;
-       } else
-               ncores = 1;
-
-       return ncores;
-}
-
-/*
- * Setup the SCU
- */
-static void scu_enable(void)
-{
-       u32 scu_ctrl;
-       void __iomem *scu_base = scu_base_addr();
-
-       scu_ctrl = __raw_readl(scu_base + SCU_CTRL);
-       scu_ctrl |= 1;
-       __raw_writel(scu_ctrl, scu_base + SCU_CTRL);
+       if (scu_base)
+               return scu_get_core_count(scu_base);
+       return 1;
 }
 
 static DEFINE_SPINLOCK(boot_lock);
@@ -152,26 +138,16 @@ int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
 
 static void __init poke_milo(void)
 {
-       extern void secondary_startup(void);
-
        /* nobody is to be released from the pen yet */
        pen_release = -1;
 
        /*
-        * write the address of secondary startup into the system-wide
-        * flags register, then clear the bottom two bits, which is what
-        * BootMonitor is waiting for
+        * Write the address of secondary startup into the system-wide flags
+        * register. The BootMonitor waits for this register to become
+        * non-zero.
         */
-#if 1
-#define REALVIEW_SYS_FLAGSS_OFFSET 0x30
-       __raw_writel(virt_to_phys(realview_secondary_startup),
-                    __io_address(REALVIEW_SYS_BASE) +
-                    REALVIEW_SYS_FLAGSS_OFFSET);
-#define REALVIEW_SYS_FLAGSC_OFFSET 0x34
-       __raw_writel(3,
-                    __io_address(REALVIEW_SYS_BASE) +
-                    REALVIEW_SYS_FLAGSC_OFFSET);
-#endif
+       __raw_writel(BSYM(virt_to_phys(realview_secondary_startup)),
+                    __io_address(REALVIEW_SYS_FLAGSSET));
 
        mb();
 }
@@ -185,7 +161,7 @@ void __init smp_init_cpus(void)
        unsigned int i, ncores = get_core_count();
 
        for (i = 0; i < ncores; i++)
-               cpu_set(i, cpu_possible_map);
+               set_cpu_possible(i, true);
 }
 
 void __init smp_prepare_cpus(unsigned int max_cpus)
@@ -223,7 +199,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
         * actually populated at the present time.
         */
        for (i = 0; i < max_cpus; i++)
-               cpu_set(i, cpu_present_map);
+               set_cpu_present(i, true);
 
        /*
         * Initialise the SCU if there are more than one CPU and let
@@ -239,7 +215,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
                 */
                percpu_timer_setup();
 
-               scu_enable();
+               scu_enable(scu_base_addr());
                poke_milo();
        }
 }