* [PATCH 1/2] drivers: watchdog: marvell_gti: fix zero pretimeout handling
@ 2023-10-09 4:40 Bharat Bhushan
2023-10-09 4:40 ` [PATCH 2/2] drivers: watchdog: marvell_gti: Program the max_hw_heartbeat_ms Bharat Bhushan
2023-10-11 14:51 ` [PATCH 1/2] drivers: watchdog: marvell_gti: fix zero pretimeout handling Guenter Roeck
0 siblings, 2 replies; 4+ messages in thread
From: Bharat Bhushan @ 2023-10-09 4:40 UTC (permalink / raw)
To: wim, inux, linux-watchdog, linux-kernel; +Cc: Bharat Bhushan
When pretimeout is set to 0 then do not reprogram timer
with zero timeout, this will reset device immediately.
Also disable interrupt to stop pretimeout notification.
Signed-off-by: Bharat Bhushan <bbhushan2@marvell.com>
---
drivers/watchdog/marvell_gti_wdt.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/watchdog/marvell_gti_wdt.c b/drivers/watchdog/marvell_gti_wdt.c
index d7eb8286e11e..25b7ce0f0738 100644
--- a/drivers/watchdog/marvell_gti_wdt.c
+++ b/drivers/watchdog/marvell_gti_wdt.c
@@ -190,6 +190,13 @@ static int gti_wdt_set_pretimeout(struct watchdog_device *wdev,
struct gti_wdt_priv *priv = watchdog_get_drvdata(wdev);
struct watchdog_device *wdog_dev = &priv->wdev;
+ if (!timeout) {
+ /* Disable Interrupt */
+ writeq(GTI_CWD_INT_ENA_CLR_VAL(priv->wdt_timer_idx),
+ priv->base + GTI_CWD_INT_ENA_CLR);
+ return 0;
+ }
+
/* pretimeout should 1/3 of max_timeout */
if (timeout * 3 <= wdog_dev->max_timeout)
return gti_wdt_settimeout(wdev, timeout * 3);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] drivers: watchdog: marvell_gti: Program the max_hw_heartbeat_ms
2023-10-09 4:40 [PATCH 1/2] drivers: watchdog: marvell_gti: fix zero pretimeout handling Bharat Bhushan
@ 2023-10-09 4:40 ` Bharat Bhushan
2023-10-11 14:51 ` Guenter Roeck
2023-10-11 14:51 ` [PATCH 1/2] drivers: watchdog: marvell_gti: fix zero pretimeout handling Guenter Roeck
1 sibling, 1 reply; 4+ messages in thread
From: Bharat Bhushan @ 2023-10-09 4:40 UTC (permalink / raw)
To: wim, inux, linux-watchdog, linux-kernel; +Cc: George Cherian, Bharat Bhushan
From: George Cherian <george.cherian@marvell.com>
Program the max_hw_heartbeat_ms value so that the watchdog_pretimeout
worker is activated. This kernel worker thread makes sure to ping the
watchdog in case the userspace is unable to do so. This kernel worker
ping will be done only till the full watchdog timeout there by
maintaining the watchdog functionality in case of a real hang.
Signed-off-by: George Cherian <george.cherian@marvell.com>
Signed-off-by: Bharat Bhushan <bbhushan2@marvell.com>
---
drivers/watchdog/marvell_gti_wdt.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/watchdog/marvell_gti_wdt.c b/drivers/watchdog/marvell_gti_wdt.c
index 25b7ce0f0738..bfe0c819248c 100644
--- a/drivers/watchdog/marvell_gti_wdt.c
+++ b/drivers/watchdog/marvell_gti_wdt.c
@@ -299,6 +299,7 @@ static int gti_wdt_probe(struct platform_device *pdev)
/* Maximum timeout is 3 times the pretimeout */
wdog_dev->max_timeout = max_pretimeout * 3;
+ wdog_dev->max_hw_heartbeat_ms = max_pretimeout * 1000;
/* Minimum first timeout (pretimeout) is 1, so min_timeout as 3 */
wdog_dev->min_timeout = 3;
wdog_dev->timeout = wdog_dev->pretimeout;
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] drivers: watchdog: marvell_gti: fix zero pretimeout handling
2023-10-09 4:40 [PATCH 1/2] drivers: watchdog: marvell_gti: fix zero pretimeout handling Bharat Bhushan
2023-10-09 4:40 ` [PATCH 2/2] drivers: watchdog: marvell_gti: Program the max_hw_heartbeat_ms Bharat Bhushan
@ 2023-10-11 14:51 ` Guenter Roeck
1 sibling, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2023-10-11 14:51 UTC (permalink / raw)
To: Bharat Bhushan; +Cc: wim, inux, linux-watchdog, linux-kernel
On Mon, Oct 09, 2023 at 10:10:36AM +0530, Bharat Bhushan wrote:
> When pretimeout is set to 0 then do not reprogram timer
> with zero timeout, this will reset device immediately.
> Also disable interrupt to stop pretimeout notification.
>
> Signed-off-by: Bharat Bhushan <bbhushan2@marvell.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/marvell_gti_wdt.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/watchdog/marvell_gti_wdt.c b/drivers/watchdog/marvell_gti_wdt.c
> index d7eb8286e11e..25b7ce0f0738 100644
> --- a/drivers/watchdog/marvell_gti_wdt.c
> +++ b/drivers/watchdog/marvell_gti_wdt.c
> @@ -190,6 +190,13 @@ static int gti_wdt_set_pretimeout(struct watchdog_device *wdev,
> struct gti_wdt_priv *priv = watchdog_get_drvdata(wdev);
> struct watchdog_device *wdog_dev = &priv->wdev;
>
> + if (!timeout) {
> + /* Disable Interrupt */
> + writeq(GTI_CWD_INT_ENA_CLR_VAL(priv->wdt_timer_idx),
> + priv->base + GTI_CWD_INT_ENA_CLR);
> + return 0;
> + }
> +
> /* pretimeout should 1/3 of max_timeout */
> if (timeout * 3 <= wdog_dev->max_timeout)
> return gti_wdt_settimeout(wdev, timeout * 3);
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] drivers: watchdog: marvell_gti: Program the max_hw_heartbeat_ms
2023-10-09 4:40 ` [PATCH 2/2] drivers: watchdog: marvell_gti: Program the max_hw_heartbeat_ms Bharat Bhushan
@ 2023-10-11 14:51 ` Guenter Roeck
0 siblings, 0 replies; 4+ messages in thread
From: Guenter Roeck @ 2023-10-11 14:51 UTC (permalink / raw)
To: Bharat Bhushan; +Cc: wim, inux, linux-watchdog, linux-kernel, George Cherian
On Mon, Oct 09, 2023 at 10:10:37AM +0530, Bharat Bhushan wrote:
> From: George Cherian <george.cherian@marvell.com>
>
> Program the max_hw_heartbeat_ms value so that the watchdog_pretimeout
> worker is activated. This kernel worker thread makes sure to ping the
> watchdog in case the userspace is unable to do so. This kernel worker
> ping will be done only till the full watchdog timeout there by
> maintaining the watchdog functionality in case of a real hang.
>
> Signed-off-by: George Cherian <george.cherian@marvell.com>
> Signed-off-by: Bharat Bhushan <bbhushan2@marvell.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> ---
> drivers/watchdog/marvell_gti_wdt.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/watchdog/marvell_gti_wdt.c b/drivers/watchdog/marvell_gti_wdt.c
> index 25b7ce0f0738..bfe0c819248c 100644
> --- a/drivers/watchdog/marvell_gti_wdt.c
> +++ b/drivers/watchdog/marvell_gti_wdt.c
> @@ -299,6 +299,7 @@ static int gti_wdt_probe(struct platform_device *pdev)
>
> /* Maximum timeout is 3 times the pretimeout */
> wdog_dev->max_timeout = max_pretimeout * 3;
> + wdog_dev->max_hw_heartbeat_ms = max_pretimeout * 1000;
> /* Minimum first timeout (pretimeout) is 1, so min_timeout as 3 */
> wdog_dev->min_timeout = 3;
> wdog_dev->timeout = wdog_dev->pretimeout;
> --
> 2.34.1
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-10-11 14:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-09 4:40 [PATCH 1/2] drivers: watchdog: marvell_gti: fix zero pretimeout handling Bharat Bhushan
2023-10-09 4:40 ` [PATCH 2/2] drivers: watchdog: marvell_gti: Program the max_hw_heartbeat_ms Bharat Bhushan
2023-10-11 14:51 ` Guenter Roeck
2023-10-11 14:51 ` [PATCH 1/2] drivers: watchdog: marvell_gti: fix zero pretimeout handling Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox