diff options
author | Oleksandr Suvorov <oleksandr.suvorov@toradex.com> | 2019-12-06 18:24:40 +0200 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2020-02-09 22:38:59 +0100 |
commit | 3c09e92969ec22218e51e35d9c21cce292ee80a2 (patch) | |
tree | 2e91c4d2df737dacf19ab023c3c95b695aea414b | |
parent | 8785cec65a359b1059aa75ec5c8e5d2943a79c25 (diff) |
watchdog: imx8_wdt: Pretimeout should follow SCU firmware format
backport of 2c50a6b825b ("watchdog: imx_sc_wdt: Pretimeout should follow SCU firmware format")
SCU firmware calculates pretimeout based on current time stamp
instead of watchdog timeout stamp, need to convert the pretimeout
to SCU firmware's timeout value.
Fixes: 15f7d7fc5542 ("watchdog: imx_sc: Add pretimeout support")
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Wim Van Sebroeck <wim@linux-watchdog.org>
Signed-off-by: Oleksandr Suvorov <oleksandr.suvorov@toradex.com>
-rw-r--r-- | drivers/watchdog/imx8_wdt.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/watchdog/imx8_wdt.c b/drivers/watchdog/imx8_wdt.c index 7a855012366a..0fc5c8861b6f 100644 --- a/drivers/watchdog/imx8_wdt.c +++ b/drivers/watchdog/imx8_wdt.c @@ -104,9 +104,14 @@ static int imx8_wdt_set_pretimeout(struct watchdog_device *wdog, { struct arm_smccc_res res; + /* + * SCU firmware calculates pretimeout based on current time + * stamp instead of watchdog timeout stamp, need to convert + * the pretimeout to SCU firmware's timeout value. + */ arm_smccc_smc(FSL_SIP_SRTC, FSL_SIP_SRTC_SET_PRETIME_WDOG, - new_pretimeout * 1000, 0, 0, 0, 0, 0, - &res); + (wdog->timeout - new_pretimeout) * 1000, 0, 0, 0, + 0, 0, &res); return res.a0; } |