summaryrefslogtreecommitdiff
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorBai Ping <ping.bai@nxp.com>2016-12-19 18:11:07 +0800
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commitaef810dd3ccaa272ea5824dbd9edb643651b7ca7 (patch)
tree79ac039d35d553d1926c5e2953f388df11a265bd /drivers/watchdog
parent95eae03a5df49190d1bb5fed1fa81e5e1f60d7dd (diff)
MLK-13632 driver: watchdog: Fix system reset when sending wdog unlock sequence
For i.MX7ULP wdog, when we want to unlock the wdog with 16bit unlock command, the two unlock command sequence must be write to WDOG_CNT register within 16 bus clocks, otherwise, system may be reset unexpected. As writel include memory barrier, if we use writel to send the unlock command, it may take more time than 16 bus clock, so we should use writel_relaxed to write the unlock command to the CNT register. Signed-off-by: Bai Ping <ping.bai@nxp.com>
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/imx7ulp_wdt.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/drivers/watchdog/imx7ulp_wdt.c b/drivers/watchdog/imx7ulp_wdt.c
index 845c900b5bcb..b54268849ce6 100644
--- a/drivers/watchdog/imx7ulp_wdt.c
+++ b/drivers/watchdog/imx7ulp_wdt.c
@@ -146,15 +146,10 @@ static inline void imx7ulp_wdt_init(void __iomem *base, unsigned int timeout)
local_irq_disable();
- /*
- * if the wdog is in unlocked status, the UNLOCK
- * sequence no need to be send.
- */
- val = readl(base + WDOG_CS);
- if (!(val & WDOG_CS_ULK)) {
- writel(UNLOCK_SEQ0, base + WDOG_CNT);
- writel(UNLOCK_SEQ1, base + WDOG_CNT);
- }
+ /* unlock the wdog for reconfiguration */
+ writel_relaxed(UNLOCK_SEQ0, base + WDOG_CNT);
+ writel_relaxed(UNLOCK_SEQ1, base + WDOG_CNT);
+
/*set an initial timeout value in TOVAL */
writel(timeout, base + WDOG_TOVAL);
/* enable 32bit command sequence and reconfigure */