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: 15f7d7fc55 ("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>
This commit is contained in:
Anson Huang 2019-10-09 15:37:47 +08:00 committed by Wim Van Sebroeck
parent 2c77734642
commit 2c50a6b825
1 changed files with 7 additions and 1 deletions

View File

@ -99,8 +99,14 @@ static int imx_sc_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(IMX_SIP_TIMER, IMX_SIP_TIMER_SET_PRETIME_WDOG,
pretimeout * 1000, 0, 0, 0, 0, 0, &res);
(wdog->timeout - pretimeout) * 1000, 0, 0, 0,
0, 0, &res);
if (res.a0)
return -EACCES;