From 62f99e7cea8c025b617a8c9eec2f6eae3ca51575 Mon Sep 17 00:00:00 2001 From: Sarangdhar Joshi Date: Thu, 25 Jun 2015 16:09:34 -0700 Subject: [PATCH] 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 Signed-off-by: Mohammed Khajapasha --- drivers/soc/qcom/watchdog_v2.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/soc/qcom/watchdog_v2.c b/drivers/soc/qcom/watchdog_v2.c index 745a069df88a..625030f1f256 100644 --- a/drivers/soc/qcom/watchdog_v2.c +++ b/drivers/soc/qcom/watchdog_v2.c @@ -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();