Skip to content

Commit 52c4d05

Browse files
Ye LiWim Van Sebroeck
authored andcommitted
watchdog: imx7ulp_wdt: Fix RCS timeout issue
According to measure on i.MX7ULP and i.MX8ULP, the RCS done needs about 3400us and 6700us respectively. So current 20us timeout is not enough. When reconfiguring is on-going, unlock and configure CS will lead to unknown result. Increase the wait timeout value to 10ms and check the return value of RCS wait to fix the issue 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 e809dae commit 52c4d05

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

drivers/watchdog/imx7ulp_wdt.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
#define DEFAULT_TIMEOUT 60
4040
#define MAX_TIMEOUT 128
4141
#define WDOG_CLOCK_RATE 1000
42-
#define WDOG_WAIT_TIMEOUT 20
42+
#define WDOG_WAIT_TIMEOUT 10000
4343

4444
static bool nowayout = WATCHDOG_NOWAYOUT;
4545
module_param(nowayout, bool, 0000);
@@ -80,7 +80,7 @@ static int imx7ulp_wdt_enable(struct watchdog_device *wdog, bool enable)
8080
writel(val | WDOG_CS_EN, wdt->base + WDOG_CS);
8181
else
8282
writel(val & ~WDOG_CS_EN, wdt->base + WDOG_CS);
83-
imx7ulp_wdt_wait(wdt->base, WDOG_CS_RCS);
83+
ret = imx7ulp_wdt_wait(wdt->base, WDOG_CS_RCS);
8484

8585
enable_out:
8686
local_irq_enable();
@@ -127,7 +127,9 @@ static int imx7ulp_wdt_set_timeout(struct watchdog_device *wdog,
127127
if (ret)
128128
goto timeout_out;
129129
writel(val, wdt->base + WDOG_TOVAL);
130-
imx7ulp_wdt_wait(wdt->base, WDOG_CS_RCS);
130+
ret = imx7ulp_wdt_wait(wdt->base, WDOG_CS_RCS);
131+
if (ret)
132+
goto timeout_out;
131133

132134
wdog->timeout = timeout;
133135

0 commit comments

Comments
 (0)