From 5acff0a6d486e4ad5e67a1c512e86b22014f3401 Mon Sep 17 00:00:00 2001 From: Stepan Moskovchenko Date: Mon, 22 Jun 2015 20:00:34 -0700 Subject: [PATCH] soc: qcom: watchdog_v2: Increase timeout for forced bites Though we configure the watchdog timeout to be only one tick when deliberately trying to force a watchdog bite, the watchdog bite interrupt may be processed asynchronously by the secure environment on a different CPU. Therefore, we need to increase the amount of time we spend waiting for the watchdog bite to happen before falling back on other reset methods, to avoid a race condition between the fallback reset code and the secure environment itself. Change-Id: I73de0abbf8cdd77f22374886f4a89b25743b86eb Signed-off-by: Stepan Moskovchenko --- drivers/soc/qcom/watchdog_v2.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/drivers/soc/qcom/watchdog_v2.c b/drivers/soc/qcom/watchdog_v2.c index 82e8219fb827..761259842393 100644 --- a/drivers/soc/qcom/watchdog_v2.c +++ b/drivers/soc/qcom/watchdog_v2.c @@ -386,6 +386,24 @@ static int msm_watchdog_remove(struct platform_device *pdev) return 0; } +void msm_trigger_wdog_bite(void) +{ + if (!wdog_data) + return; + pr_info("Causing a watchdog bite!"); + __raw_writel(1, wdog_data->base + WDT0_BITE_TIME); + mb(); + __raw_writel(1, wdog_data->base + WDT0_RST); + mb(); + /* Delay to make sure bite occurs */ + mdelay(2000); + pr_err("Wdog - STS: 0x%x, CTL: 0x%x, BARK TIME: 0x%x, BITE TIME: 0x%x", + __raw_readl(wdog_data->base + WDT0_STS), + __raw_readl(wdog_data->base + WDT0_EN), + __raw_readl(wdog_data->base + WDT0_BARK_TIME), + __raw_readl(wdog_data->base + WDT0_BITE_TIME)); +} + static irqreturn_t wdog_bark_handler(int irq, void *dev_id) { struct msm_watchdog_data *wdog_dd = (struct msm_watchdog_data *)dev_id;