From: Robin Gong Date: Thu, 8 Aug 2019 17:34:00 +0000 (+0800) Subject: MLK-22392: watchdog: imx8_wdt: correct pretimeout X-Git-Tag: rel_imx_4.19.35_1.1.0~22 X-Git-Url: https://git.somdevices.com/?a=commitdiff_plain;h=362180fd7ae0c2e474adfdd3d056e2c3d519e012;p=linux.git MLK-22392: watchdog: imx8_wdt: correct pretimeout 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 Reviewed-by: Anson Huang (cherry picked from commit 674332ac12ddf593d89e87517573b31be2bbead3) --- diff --git a/drivers/watchdog/imx8_wdt.c b/drivers/watchdog/imx8_wdt.c index 4499feb26395..31f32eef5559 100644 --- a/drivers/watchdog/imx8_wdt.c +++ b/drivers/watchdog/imx8_wdt.c @@ -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);