msm: lpass-8660: Make send_q6_nmi atomic context safe.

Use the atomic version of the SCM API, mdelay
instead of msleep, and do not ioremap in send_q6_nmi
since this function is invoked in an atomic context
after a kernel panic occurs.

Change-Id: I64ce7c636434b2ceced5ca19c850b61864d11c5d
Signed-off-by: Vikram Mulukutla <markivx@codeaurora.org>
diff --git a/arch/arm/mach-msm/lpass-8660.c b/arch/arm/mach-msm/lpass-8660.c
index 36b8dcc..ff08eff 100644
--- a/arch/arm/mach-msm/lpass-8660.c
+++ b/arch/arm/mach-msm/lpass-8660.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
+/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 and
@@ -39,6 +39,7 @@
 static void *q6_ramdump_dev;
 static void q6_fatal_fn(struct work_struct *);
 static DECLARE_WORK(q6_fatal_work, q6_fatal_fn);
+static void __iomem *q6_wakeup_intr;
 
 static void q6_fatal_fn(struct work_struct *work)
 {
@@ -50,20 +51,16 @@
 static void send_q6_nmi(void)
 {
 	/* Send NMI to QDSP6 via an SCM call. */
-	uint32_t cmd = 0x1;
-	void __iomem *q6_wakeup_intr;
-
-	scm_call(SCM_SVC_UTIL, SCM_Q6_NMI_CMD,
-	&cmd, sizeof(cmd), NULL, 0);
+	scm_call_atomic1(SCM_SVC_UTIL, SCM_Q6_NMI_CMD, 0x1);
 
 	/* Wakeup the Q6 */
-	q6_wakeup_intr = ioremap_nocache(Q6SS_SOFT_INTR_WAKEUP, 8);
-	writel_relaxed(0x2000, q6_wakeup_intr);
-	iounmap(q6_wakeup_intr);
-	mb();
+	if (q6_wakeup_intr)
+		writel_relaxed(0x2000, q6_wakeup_intr);
+	else
+		pr_warn("lpass-8660: Unable to send wakeup interrupt to Q6.\n");
 
 	/* Q6 requires atleast 100ms to dump caches etc.*/
-	msleep(100);
+	mdelay(100);
 
 	pr_info("subsystem-fatal-8x60: Q6 NMI was sent.\n");
 }
@@ -133,6 +130,7 @@
 
 static void __exit lpass_fatal_exit(void)
 {
+	iounmap(q6_wakeup_intr);
 	free_irq(LPASS_Q6SS_WDOG_EXPIRED, NULL);
 }
 
@@ -156,6 +154,11 @@
 		goto out;
 	}
 
+	q6_wakeup_intr = ioremap_nocache(Q6SS_SOFT_INTR_WAKEUP, 8);
+
+	if (!q6_wakeup_intr)
+		pr_warn("lpass-8660: Unable to ioremap q6 wakeup address.");
+
 	ret = ssr_register_subsystem(&subsys_8x60_q6);
 out:
 	return ret;