msm: mdm: Disable panic on external mdm boot timeout

We now have the ability to not panic when we see a external modem has
not booted up within the expected timeframe. This functionality is
required in order to debug early bootup issues on the mdm's and is
configured via a sysfs flag.

Change-Id: Iac3bf980b239fdbe2ffdc8a5a25b875d47f0384c
Signed-off-by: Ameya Thakur <ameyat@codeaurora.org>
diff --git a/arch/arm/mach-msm/mdm_common.c b/arch/arm/mach-msm/mdm_common.c
index a2f1699..a96ec9d 100644
--- a/arch/arm/mach-msm/mdm_common.c
+++ b/arch/arm/mach-msm/mdm_common.c
@@ -104,6 +104,7 @@
 
 static struct list_head	mdm_devices;
 static DEFINE_SPINLOCK(mdm_devices_lock);
+static int disable_boot_timeout = 0;
 
 static int ssr_count;
 static DEFINE_SPINLOCK(ssr_lock);
@@ -138,6 +139,27 @@
 	spin_unlock_irqrestore(&mdm_devices_lock, flags);
 }
 
+static int param_set_disable_boot_timeout(const char *val,
+		const struct kernel_param *kp)
+{
+	int rcode;
+	pr_info("%s called\n",__func__);
+	rcode = param_set_bool(val, kp);
+	if (rcode)
+		pr_err("%s: Failed to set boot_timout_disabled flag\n",
+				__func__);
+	pr_info("%s: disable_boot_timeout is now %d\n",
+			__func__, disable_boot_timeout);
+	return rcode;
+}
+
+static struct kernel_param_ops disable_boot_timeout_ops = {
+	.set = param_set_disable_boot_timeout,
+	.get = param_get_bool,
+};
+module_param_cb(disable_boot_timeout, &disable_boot_timeout_ops,
+		&disable_boot_timeout, 0644);
+MODULE_PARM_DESC(disable_boot_timeout, "Disable panic on mdm bootup timeout");
 /* If the platform's cascading_ssr flag is set, the subsystem
  * restart module will restart the other modems so stop
  * monitoring them as well.
@@ -322,7 +344,8 @@
 		if (gpio_get_value(mdm_drv->mdm2ap_status_gpio) == 0) {
 			pr_err("%s: MDM2AP_STATUS did not go high on mdm id %d\n",
 				   __func__, mdev->mdm_data.device_id);
-			mdm_start_ssr(mdev);
+			if (!disable_boot_timeout)
+				mdm_start_ssr(mdev);
 		}
 	}
 }