Skip to content

Commit e809dae

Browse files
Ye LiWim Van Sebroeck
authored andcommitted
watchdog: imx7ulp_wdt: Check CMD32EN in wdog init
When bootloader has enabled the CMD32EN bit, switch to use 32bits unlock command to unlock the CS register. Using 32bits command will help on avoiding 16 bus cycle window violation for two 16 bits commands. Signed-off-by: Ye Li <[email protected]> Signed-off-by: Alice Guo <[email protected]> Reviewed-by: Jacky Bai <[email protected]> Acked-by: Jason Liu <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent 6371593 commit e809dae

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

drivers/watchdog/imx7ulp_wdt.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,11 +180,16 @@ static int imx7ulp_wdt_init(void __iomem *base, unsigned int timeout)
180180

181181
local_irq_disable();
182182

183-
mb();
184-
/* unlock the wdog for reconfiguration */
185-
writel_relaxed(UNLOCK_SEQ0, base + WDOG_CNT);
186-
writel_relaxed(UNLOCK_SEQ1, base + WDOG_CNT);
187-
mb();
183+
val = readl(base + WDOG_CS);
184+
if (val & WDOG_CS_CMD32EN) {
185+
writel(UNLOCK, base + WDOG_CNT);
186+
} else {
187+
mb();
188+
/* unlock the wdog for reconfiguration */
189+
writel_relaxed(UNLOCK_SEQ0, base + WDOG_CNT);
190+
writel_relaxed(UNLOCK_SEQ1, base + WDOG_CNT);
191+
mb();
192+
}
188193

189194
ret = imx7ulp_wdt_wait(base, WDOG_CS_ULK);
190195
if (ret)

0 commit comments

Comments
 (0)