soc: qcom: watchdog_v2: update last_pet variable during resume

The last_pet variable is set in suspend callback and during
pet_watchdog() and is printed when watchdog bark handler gets
called. This variable does not represent exact last pet time in
cases where non secure bark occurs before system could pet the
watchdog upon wakeup event from low power mode. Reset the
watchdog during msm_watchdog_resume() and update last_pet
variable so that watchdog bark messages will represent latest
info.

This commit also adds memory barrier after resetting watchdog in
msm_watchdog_suspend(). This will make sure watchdog writes are
complete before proceeding further.

Change-Id: I44492a947bc3664b7d14cfae9e877ebe0dc32836
Signed-off-by: Sarangdhar Joshi <spjoshi@codeaurora.org>
Signed-off-by: Mohammed Khajapasha <mkhaja@codeaurora.org>
This commit is contained in:
Sarangdhar Joshi 2015-06-25 16:09:34 -07:00 committed by Mohammed Khajapasha
parent 8a9f65f16a
commit 62f99e7cea

View file

@ -134,6 +134,8 @@ static int msm_watchdog_suspend(struct device *dev)
return 0;
__raw_writel(1, wdog_dd->base + WDT0_RST);
if (wdog_dd->wakeup_irq_enable) {
/* Make sure register write is complete before proceeding */
mb();
wdog_dd->last_pet = sched_clock();
return 0;
}
@ -148,8 +150,15 @@ static int msm_watchdog_resume(struct device *dev)
{
struct msm_watchdog_data *wdog_dd =
(struct msm_watchdog_data *)dev_get_drvdata(dev);
if (!enable || wdog_dd->wakeup_irq_enable)
if (!enable)
return 0;
if (wdog_dd->wakeup_irq_enable) {
__raw_writel(1, wdog_dd->base + WDT0_RST);
/* Make sure register write is complete before proceeding */
mb();
wdog_dd->last_pet = sched_clock();
return 0;
}
__raw_writel(1, wdog_dd->base + WDT0_EN);
__raw_writel(1, wdog_dd->base + WDT0_RST);
mb();