]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ARM: keystone: Move CPU bringup code to dedicated asm file
authorSantosh Shilimkar <santosh.shilimkar@ti.com>
Fri, 21 Jun 2013 22:54:47 +0000 (18:54 -0400)
committerArnd Bergmann <arnd@arndb.de>
Mon, 24 Jun 2013 14:23:36 +0000 (16:23 +0200)
Because of inline asm usage in platsmp.c, smc instruction
creates build failure for ARM V6+V7 build where as using instruction
encoding for smc breaks the thumb2 build.

So move the code snippet to separate asm file and mark
it with 'armv7-a$(plus_sec)' to avoid any build issues.

Signed-off-by: Santosh Shilimkar <santosh.shilimkar@ti.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
arch/arm/mach-keystone/Makefile
arch/arm/mach-keystone/keystone.h
arch/arm/mach-keystone/platsmp.c
arch/arm/mach-keystone/smc.S [new file with mode: 0644]

index 3f6b8ab822357e452bfa72e35f35884866c10197..ddc52b05dc84b01a5008e611739a0eb2117c1ea0 100644 (file)
@@ -1,2 +1,6 @@
-obj-y                                  := keystone.o
+obj-y                                  := keystone.o smc.o
+
+plus_sec := $(call as-instr,.arch_extension sec,+sec)
+AFLAGS_smc.o                           :=-Wa,-march=armv7-a$(plus_sec)
+
 obj-$(CONFIG_SMP)                      += platsmp.o
index 43a1b4789a6ed2019492576e0b815dd726e917c3..60bef9dedb129b29a7aa67097cb51b0a05f0559d 100644 (file)
 #ifndef __KEYSTONE_H__
 #define __KEYSTONE_H__
 
+#define KEYSTONE_MON_CPU_UP_IDX                0x00
+
+#ifndef __ASSEMBLER__
+
 extern struct smp_operations keystone_smp_ops;
 extern void secondary_startup(void);
+extern u32 keystone_cpu_smc(u32 command, u32 cpu, u32 addr);
 
+#endif /* __ASSEMBLER__ */
 #endif /* __KEYSTONE_H__ */
index 630ab3bd5f7842d87ee5c65d154454980c8e3285..1d4181e1daf2f83fafc38ce904dd2e14c5459af9 100644 (file)
@@ -30,18 +30,9 @@ static int __cpuinit keystone_smp_boot_secondary(unsigned int cpu,
        pr_debug("keystone-smp: booting cpu %d, vector %08lx\n",
                 cpu, start);
 
-       asm volatile (
-               "mov    r0, #0\n"       /* power on cmd */
-               "mov    r1, %1\n"       /* cpu          */
-               "mov    r2, %2\n"       /* start        */
-               ".inst  0xe1600070\n"   /* smc #0       */
-               "mov    %0, r0\n"
-               : "=r" (error)
-               : "r"(cpu), "r"(start)
-               : "cc", "r0", "r1", "r2", "memory"
-       );
-
-       pr_debug("keystone-smp: monitor returned %d\n", error);
+       error = keystone_cpu_smc(KEYSTONE_MON_CPU_UP_IDX, cpu, start);
+       if (error)
+               pr_err("CPU %d bringup failed with %d\n", cpu, error);
 
        return error;
 }
diff --git a/arch/arm/mach-keystone/smc.S b/arch/arm/mach-keystone/smc.S
new file mode 100644 (file)
index 0000000..9b9e4f7
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Keystone Secure APIs
+ *
+ * Copyright (C) 2013 Texas Instruments, Inc.
+ *     Santosh Shilimkar <santosh.shilimkar@ti.com>
+ *
+ * This program is free software,you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <linux/linkage.h>
+
+/**
+ * u32 keystone_cpu_smc(u32 command, u32 cpu, u32 addr)
+ *
+ * Low level CPU monitor API
+ * @command:   Monitor command.
+ * @cpu:       CPU Number
+ * @addr:      Kernel jump address for boot CPU
+ *
+ * Return: Non zero value on failure
+ */
+ENTRY(keystone_cpu_smc)
+       stmfd   sp!, {r4-r12, lr}
+       smc     #0
+       dsb
+       ldmfd   sp!, {r4-r12, pc}
+ENDPROC(keystone_cpu_smc)