Linux-Watchdog Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] watchdog: imx_sc_wdt: Pretimeout should follow SCU firmware format
@ 2019-10-09  7:37 Anson Huang
  2019-10-09 13:42 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Anson Huang @ 2019-10-09  7:37 UTC (permalink / raw)
  To: wim, linux, shawnguo, s.hauer, kernel, festevam, linux-watchdog,
	linux-arm-kernel, linux-kernel
  Cc: Linux-imx

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>
---
 drivers/watchdog/imx_sc_wdt.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/imx_sc_wdt.c b/drivers/watchdog/imx_sc_wdt.c
index 7ea5cf5..8ed89f0 100644
--- a/drivers/watchdog/imx_sc_wdt.c
+++ b/drivers/watchdog/imx_sc_wdt.c
@@ -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;
 
-- 
2.7.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] watchdog: imx_sc_wdt: Pretimeout should follow SCU firmware format
  2019-10-09  7:37 [PATCH] watchdog: imx_sc_wdt: Pretimeout should follow SCU firmware format Anson Huang
@ 2019-10-09 13:42 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2019-10-09 13:42 UTC (permalink / raw)
  To: Anson Huang, wim, shawnguo, s.hauer, kernel, festevam,
	linux-watchdog, linux-arm-kernel, linux-kernel
  Cc: Linux-imx

On 10/9/19 12:37 AM, Anson Huang wrote:
> 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>

> ---
>   drivers/watchdog/imx_sc_wdt.c | 8 +++++++-
>   1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/imx_sc_wdt.c b/drivers/watchdog/imx_sc_wdt.c
> index 7ea5cf5..8ed89f0 100644
> --- a/drivers/watchdog/imx_sc_wdt.c
> +++ b/drivers/watchdog/imx_sc_wdt.c
> @@ -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;
>   
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-09  7:37 [PATCH] watchdog: imx_sc_wdt: Pretimeout should follow SCU firmware format Anson Huang
2019-10-09 13:42 ` Guenter Roeck

Linux-Watchdog Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-watchdog/0 linux-watchdog/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-watchdog linux-watchdog/ https://lore.kernel.org/linux-watchdog \
		linux-watchdog@vger.kernel.org
	public-inbox-index linux-watchdog

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-watchdog


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git