drivers: watchdog: marvell_gti: fix zero pretimeout handling
PATCH 1/2 drivers: watchdog: marvell_gti: fix zero pretimeout handling
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.
--- drivers/watchdog/marvell_gti_wdt.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/watchdog/marvell_gti_wdt.c +7 -0
@@ -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 );
Signature · 1 line
2.34.1
PATCH 2/2 drivers: watchdog: marvell_gti: Program the max_hw_heartbeat_ms
From: George Cherian <[email protected]>
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.
--- drivers/watchdog/marvell_gti_wdt.c | 1 + 1 file changed, 1 insertion(+)
drivers/watchdog/marvell_gti_wdt.c +1 -0
@@ -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;
Signature · 1 line
2.34.1
Re: [PATCH 2/2] drivers: watchdog: marvell_gti: Program the max_hw_heartbeat_ms
Quoted 10 lines · Bharat Bhushan
From: George Cherian <[email protected]>
Program the
max_hw_heartbeat_msvalue so that thewatchdog_pretimeoutworker 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 <[email protected]>Signed-off-by Bharat Bhushan <[email protected]>
Quoted 19 lines
--- drivers/watchdog/marvell_gti_wdt.c | 1 + 1 file changed, 1 insertion(+)drivers/watchdog/marvell_gti_wdt.c +1
-0@@ -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;Signature · 1 line
2.34.1
Quoted 5 lines · 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 <[email protected]>
Quoted 25 lines
--- drivers/watchdog/marvell_gti_wdt.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/watchdog/marvell_gti_wdt.c +7
-0@@ -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 );Signature · 1 line
2.34.1