MLK-22392: watchdog: imx8_wdt: correct pretimeout
authorRobin Gong <yibin.gong@nxp.com>
Thu, 8 Aug 2019 17:34:00 +0000 (01:34 +0800)
committerRobin Gong <yibin.gong@nxp.com>
Tue, 22 Oct 2019 17:36:26 +0000 (01:36 +0800)
scfw think 'new_pretimeout' as the time stamp from now, not
the time before watchdog timeout which is different with kernel
define. Convert it to scfw's format.

Signed-off-by: Robin Gong <yibin.gong@nxp.com>
Reviewed-by: Anson Huang <anson.huang@nxp.com>
(cherry picked from commit 674332ac12ddf593d89e87517573b31be2bbead3)

drivers/watchdog/imx8_wdt.c

index 4499feb..31f32ee 100644 (file)
@@ -105,6 +105,11 @@ static int imx8_wdt_set_pretimeout(struct watchdog_device *wdog,
 {
        struct arm_smccc_res res;
 
+       /*
+        * scfw calculate new_pretimeout based on current stamp instead of
+        * watchdog timeout stamp, convert it to scfw format.
+        */
+       new_pretimeout = wdog->timeout - new_pretimeout;
        arm_smccc_smc(FSL_SIP_SRTC, FSL_SIP_SRTC_SET_PRETIME_WDOG,
                        new_pretimeout * 1000, 0, 0, 0, 0, 0,
                        &res);