msm: charm: Wait for status to go low in panic handler
When a panic occurs in the kernel, the external modem
responds and goes through its own shutdown process.
Wait until the external modem gives a signal that
it has finished shutting down (dropping MDM2AP_STATUS)
before exiting the panic handler.
CRs-Fixed: 303416
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
diff --git a/arch/arm/mach-msm/mdm.c b/arch/arm/mach-msm/mdm.c
index 13cac2e..1ec6bc1 100644
--- a/arch/arm/mach-msm/mdm.c
+++ b/arch/arm/mach-msm/mdm.c
@@ -115,11 +115,21 @@
static int charm_panic_prep(struct notifier_block *this,
unsigned long event, void *ptr)
{
+ int i;
+
CHARM_DBG("%s: setting AP2MDM_ERRFATAL high for a non graceful reset\n",
__func__);
charm_disable_irqs();
gpio_set_value(AP2MDM_ERRFATAL, 1);
gpio_set_value(AP2MDM_WAKEUP, 1);
+ for (i = CHARM_MODEM_TIMEOUT; i > 0; i -= CHARM_MODEM_DELTA) {
+ pet_watchdog();
+ mdelay(CHARM_MODEM_DELTA);
+ if (gpio_get_value(MDM2AP_STATUS) == 0)
+ break;
+ }
+ if (i <= 0)
+ pr_err("%s: MDM2AP_STATUS never went low\n", __func__);
return NOTIFY_DONE;
}