msm: scm-io: Replace open-coded register call with SCM atomic

Instead of open-coding the SCM register calling convention, use
the SCM atomic apis.

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
diff --git a/arch/arm/mach-msm/include/mach/scm.h b/arch/arm/mach-msm/include/mach/scm.h
index feb5b8d..6fe0d21 100644
--- a/arch/arm/mach-msm/include/mach/scm.h
+++ b/arch/arm/mach-msm/include/mach/scm.h
@@ -16,6 +16,7 @@
 #define SCM_SVC_PIL			0x2
 #define SCM_SVC_UTIL			0x3
 #define SCM_SVC_TZ                      0x4
+#define SCM_SVC_IO                      0x5
 #define SCM_SVC_TZSCHEDULER             0xFC
 
 extern int scm_call(u32 svc_id, u32 cmd_id, const void *cmd_buf, size_t cmd_len,
diff --git a/arch/arm/mach-msm/scm-io.c b/arch/arm/mach-msm/scm-io.c
index 0fc068a..28614d3 100644
--- a/arch/arm/mach-msm/scm-io.c
+++ b/arch/arm/mach-msm/scm-io.c
@@ -14,10 +14,11 @@
 #include <linux/io.h>
 
 #include <mach/msm_iomap.h>
+#include <mach/scm.h>
 #include <mach/scm-io.h>
 
-#define SCM_IO_READ	((((0x5 << 10) | 0x1) << 12) | (0x2 << 8) | 0x1)
-#define SCM_IO_WRITE	((((0x5 << 10) | 0x2) << 12) | (0x2 << 8) | 0x2)
+#define SCM_IO_READ	0x1
+#define SCM_IO_WRITE	0x2
 
 #define BETWEEN(p, st, sz) ((p) >= (void __iomem *)(st) && \
 				(p) < ((void __iomem *)(st) + (sz)))
@@ -25,21 +26,10 @@
 
 static u32 __secure_readl(u32 addr)
 {
-	u32 context_id;
-	register u32 r0 asm("r0") = SCM_IO_READ;
-	register u32 r1 asm("r1") = (u32)&context_id;
-	register u32 r2 asm("r2") = addr;
-	asm(
-		__asmeq("%0", "r0")
-		__asmeq("%1", "r0")
-		__asmeq("%2", "r1")
-		__asmeq("%3", "r2")
-		"smc    #0      @ switch to secure world\n"
-		: "=r" (r0)
-		: "r" (r0), "r" (r1), "r" (r2)
-	);
+	u32 r;
+	r = scm_call_atomic1(SCM_SVC_IO, SCM_IO_READ, addr);
 	__iormb();
-	return r0;
+	return r;
 }
 
 u32 secure_readl(void __iomem *c)
@@ -55,22 +45,8 @@
 
 static void __secure_writel(u32 v, u32 addr)
 {
-	u32 context_id;
-	register u32 r0 asm("r0") = SCM_IO_WRITE;
-	register u32 r1 asm("r1") = (u32)&context_id;
-	register u32 r2 asm("r2") = addr;
-	register u32 r3 asm("r3") = v;
-
 	__iowmb();
-	asm(
-		__asmeq("%0", "r0")
-		__asmeq("%1", "r1")
-		__asmeq("%2", "r2")
-		__asmeq("%3", "r3")
-		"smc    #0      @ switch to secure world\n"
-		: /* No return value */
-		: "r" (r0), "r" (r1), "r" (r2), "r" (r3)
-	);
+	scm_call_atomic2(SCM_SVC_IO, SCM_IO_WRITE, addr, v);
 }
 
 void secure_writel(u32 v, void __iomem *c)