diff options
author | Bai Ping <ping.bai@nxp.com> | 2016-12-19 18:11:07 +0800 |
---|---|---|
committer | Jason Liu <jason.hui.liu@nxp.com> | 2019-02-12 10:25:28 +0800 |
commit | 774616b69a59103569d40b1faaac4fe470f9c5c9 (patch) | |
tree | 522038de4fe6c8787b8eadbd85db1e0574fcf037 /drivers/watchdog | |
parent | 8388a488664731d4e211431a2b66e242d3a855d5 (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.c | 13 |
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 */ |