esoc: mdm-4x: Handle primary soc reset

Force cold reset of mdm in case of a restart or poweroff
of the primary soc.

Change-Id: I786f867d490486a9ec08ab90136ffa890db7d386
Signed-off-by: Hanumant Singh <hanumant@codeaurora.org>
This commit is contained in:
Hanumant Singh 2014-02-25 16:27:10 -08:00
parent 5157332245
commit 2613adda44
3 changed files with 28 additions and 1 deletions

View File

@ -545,6 +545,15 @@ static void mdm_notify(enum esoc_notify notify, struct esoc_clink *esoc)
!mdm->soft_reset_inverted);
}
break;
case ESOC_PRIMARY_REBOOT:
dev_dbg(mdm->dev, "Triggering mdm cold reset");
mdm->ready = 0;
gpio_direction_output(MDM_GPIO(mdm, AP2MDM_SOFT_RESET),
!!mdm->soft_reset_inverted);
mdelay(300);
gpio_direction_output(MDM_GPIO(mdm, AP2MDM_SOFT_RESET),
!mdm->soft_reset_inverted);
break;
};
return;
}

View File

@ -12,6 +12,7 @@
#include <linux/delay.h>
#include <linux/workqueue.h>
#include <linux/reboot.h>
#include "esoc.h"
enum {
@ -36,10 +37,22 @@ struct mdm_drv {
bool boot_fail;
struct workqueue_struct *mdm_queue;
struct work_struct ssr_work;
struct notifier_block esoc_restart;
};
#define to_mdm_drv(d) container_of(d, struct mdm_drv, cmd_eng)
static int esoc_msm_restart_handler(struct notifier_block *nb,
unsigned long action, void *data)
{
struct mdm_drv *mdm_drv = container_of(nb, struct mdm_drv,
esoc_restart);
struct esoc_clink *esoc_clink = mdm_drv->esoc_clink;
const struct esoc_clink_ops const *clink_ops = esoc_clink->clink_ops;
dev_dbg(&esoc_clink->dev, "Notifying esoc of cold reboot\n");
clink_ops->notify(ESOC_PRIMARY_REBOOT, esoc_clink);
return NOTIFY_OK;
}
static void mdm_handle_clink_evt(enum esoc_evt evt,
struct esoc_eng *eng)
{
@ -226,6 +239,10 @@ int esoc_ssr_probe(struct esoc_clink *esoc_clink)
mdm_drv->esoc_clink = esoc_clink;
mdm_drv->mode = PWR_OFF;
mdm_drv->boot_fail = false;
mdm_drv->esoc_restart.notifier_call = esoc_msm_restart_handler;
ret = register_reboot_notifier(&mdm_drv->esoc_restart);
if (ret)
dev_err(&esoc_clink->dev, "register for reboot failed\n");
return 0;
queue_err:
esoc_clink_unregister_ssr(esoc_clink);

View File

@ -37,6 +37,7 @@ enum esoc_notify {
ESOC_DEBUG_DONE,
ESOC_DEBUG_FAIL,
ESOC_PRIMARY_CRASH,
ESOC_PRIMARY_REBOOT,
};
enum esoc_req {