]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - keystone-linux/linux.git/commitdiff
keystone: psci: adds cpu_die implementation
authorVitaly Andrianov <vitalya@ti.com>
Wed, 14 Jan 2015 14:37:30 +0000 (09:37 -0500)
committerVitaly Andrianov <vitalya@ti.com>
Tue, 20 Jan 2015 18:59:30 +0000 (13:59 -0500)
This commit add cpu_die implementation using psci api

Signed-off-by: Vitaly Andrianov <vitalya@ti.com>
arch/arm/mach-keystone/platsmp.c

index 0d400f52c34455a2e34d3cee7cab93824440225a..beeb8d83b8d04642dcbf6ec89a258cdfa52048ca 100644 (file)
 #include <asm/cacheflush.h>
 #include <asm/tlbflush.h>
 #include <asm/memory.h>
+#include <asm/psci.h>
 
 #include "keystone.h"
+asm(".arch_extension sec\n\t");
 
 static void __cpuinit keystone_smp_secondary_initmem(void)
 {
@@ -56,7 +58,7 @@ keystone_smp_boot_secondary(unsigned int cpu, struct task_struct *idle)
                "mov    r0, #0\n"       /* power on cmd */
                "mov    r1, %1\n"       /* cpu          */
                "mov    r2, %2\n"       /* start        */
-               ".inst  0xe1600070\n"   /* SMI          */
+               "smc    #0\n"           /* SMI          */
                "mov    %0, r0\n"
                : "=r" (error)
                : "r"(cpu), "r"(start)
@@ -69,18 +71,29 @@ keystone_smp_boot_secondary(unsigned int cpu, struct task_struct *idle)
 }
 
 #ifdef CONFIG_HOTPLUG_CPU
-static int keystone_cpu_kill(unsigned int cpu)
+static void keystone_cpu_die(unsigned int cpu)
 {
-       BUG();
-}
+#ifdef CONFIG_ARM_PSCI
+       struct psci_power_state pwr_state = {0, 0, 0};
 
-static int keystone_cpu_die(unsigned int cpu)
-{
-       BUG();
-}
-static int keystone_cpu_disable(unsigned int cpu)
-{
-       BUG();
+       printk(KERN_INFO "keystone_cpu_die(%d) from %d using PSCI\n", cpu,
+              smp_processor_id());
+
+       if (psci_ops.cpu_off)
+               psci_ops.cpu_off(pwr_state);
+#else
+       /*
+        * We may want to add here a direct smc call to monitor
+        * if the kernel doesn't support PSCI API
+        */
+#endif
+
+       /*
+        * we shouldn't come here. But in case something went
+        * wrong the code below prevents kernel from crush
+        */
+       while (1)
+               cpu_do_idle();
 }
 #endif
 
@@ -88,8 +101,6 @@ struct smp_operations keystone_smp_ops __initdata = {
        .smp_secondary_init     = keystone_smp_secondary_init,
        .smp_boot_secondary     = keystone_smp_boot_secondary,
 #ifdef CONFIG_HOTPLUG_CPU
-       .cpu_kill               = keystone_cpu_kill,
        .cpu_die                = keystone_cpu_die,
-       .cpu_disable            = keystone_cpu_disable,
 #endif
 };