ARM: socfpga: use CPU_METHOD_OF_DECLARE for socfpga_cyclone5
[deliverable/linux.git] / arch / arm / mach-socfpga / platsmp.c
index c64d89b7c0ca80c6a61f3d8e1c7439756bb83ee2..b84c1a12d3aef76bd45ff6d2784a0be82690e1b4 100644 (file)
@@ -54,32 +54,20 @@ static int socfpga_boot_secondary(unsigned int cpu, struct task_struct *idle)
        return 0;
 }
 
-/*
- * Initialise the CPU possible map early - this describes the CPUs
- * which may be present or become present in the system.
- */
-static void __init socfpga_smp_init_cpus(void)
+static void __init socfpga_smp_prepare_cpus(unsigned int max_cpus)
 {
-       unsigned int i, ncores;
-
-       ncores = scu_get_core_count(socfpga_scu_base_addr);
-
-       for (i = 0; i < ncores; i++)
-               set_cpu_possible(i, true);
+       struct device_node *np;
+       void __iomem *socfpga_scu_base_addr;
 
-       /* sanity check */
-       if (ncores > num_possible_cpus()) {
-               pr_warn("socfpga: no. of cores (%d) greater than configured"
-                       "maximum of %d - clipping\n", ncores, num_possible_cpus());
-               ncores = num_possible_cpus();
+       np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu");
+       if (!np) {
+               pr_err("%s: missing scu\n", __func__);
+               return;
        }
 
-       for (i = 0; i < ncores; i++)
-               set_cpu_possible(i, true);
-}
-
-static void __init socfpga_smp_prepare_cpus(unsigned int max_cpus)
-{
+       socfpga_scu_base_addr = of_iomap(np, 0);
+       if (!socfpga_scu_base_addr)
+               return;
        scu_enable(socfpga_scu_base_addr);
 }
 
@@ -95,11 +83,12 @@ static void socfpga_cpu_die(unsigned int cpu)
                cpu_do_idle();
 }
 
-struct smp_operations socfpga_smp_ops __initdata = {
-       .smp_init_cpus          = socfpga_smp_init_cpus,
+static struct smp_operations socfpga_smp_ops __initdata = {
        .smp_prepare_cpus       = socfpga_smp_prepare_cpus,
        .smp_boot_secondary     = socfpga_boot_secondary,
 #ifdef CONFIG_HOTPLUG_CPU
        .cpu_die                = socfpga_cpu_die,
 #endif
 };
+
+CPU_METHOD_OF_DECLARE(socfpga_smp, "altr,socfpga-smp", &socfpga_smp_ops);
This page took 0.027008 seconds and 5 git commands to generate.