All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3] watchdog: intel-mid_wdt: Keep watchdog running
@ 2017-03-10 22:22 Andy Shevchenko
  2017-03-11 15:54 ` Guenter Roeck
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2017-03-10 22:22 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, linux-watchdog; +Cc: Andy Shevchenko

Firmware followed by bootloader leaves watchdog running.

Keep it running in the driver.

User will not need any additional options to reboot in case of panic
during boot.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/watchdog/intel-mid_wdt.c | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/intel-mid_wdt.c b/drivers/watchdog/intel-mid_wdt.c
index 45e4d02221b5..72c108a12c19 100644
--- a/drivers/watchdog/intel-mid_wdt.c
+++ b/drivers/watchdog/intel-mid_wdt.c
@@ -147,8 +147,21 @@ static int mid_wdt_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	/* Make sure the watchdog is not running */
-	wdt_stop(wdt_dev);
+	/*
+	 * The firmware followed by U-Boot leaves the watchdog running
+	 * with the default threshold which may vary. When we get here
+	 * we should make a decision to prevent any side effects before
+	 * user space daemon will take care of it. The best option,
+	 * taking into consideration that there is no way to read values
+	 * back from hardware, is to enforce watchdog being run with
+	 * deterministic values.
+	 */
+	ret = wdt_start(wdt_dev);
+	if (ret)
+		return ret;
+
+	/* Make sure the watchdog is serviced */
+	set_bit(WDOG_HW_RUNNING, &wdt_dev->status);
 
 	ret = devm_watchdog_register_device(&pdev->dev, wdt_dev);
 	if (ret) {
-- 
2.11.0


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

* Re: [PATCH v3] watchdog: intel-mid_wdt: Keep watchdog running
  2017-03-10 22:22 [PATCH v3] watchdog: intel-mid_wdt: Keep watchdog running Andy Shevchenko
@ 2017-03-11 15:54 ` Guenter Roeck
  0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2017-03-11 15:54 UTC (permalink / raw)
  To: Andy Shevchenko, Wim Van Sebroeck, linux-watchdog

On 03/10/2017 02:22 PM, Andy Shevchenko wrote:
> Firmware followed by bootloader leaves watchdog running.
>
> Keep it running in the driver.
>
> User will not need any additional options to reboot in case of panic
> during boot.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>

> ---
>  drivers/watchdog/intel-mid_wdt.c | 17 +++++++++++++++--
>  1 file changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/watchdog/intel-mid_wdt.c b/drivers/watchdog/intel-mid_wdt.c
> index 45e4d02221b5..72c108a12c19 100644
> --- a/drivers/watchdog/intel-mid_wdt.c
> +++ b/drivers/watchdog/intel-mid_wdt.c
> @@ -147,8 +147,21 @@ static int mid_wdt_probe(struct platform_device *pdev)
>  		return ret;
>  	}
>
> -	/* Make sure the watchdog is not running */
> -	wdt_stop(wdt_dev);
> +	/*
> +	 * The firmware followed by U-Boot leaves the watchdog running
> +	 * with the default threshold which may vary. When we get here
> +	 * we should make a decision to prevent any side effects before
> +	 * user space daemon will take care of it. The best option,
> +	 * taking into consideration that there is no way to read values
> +	 * back from hardware, is to enforce watchdog being run with
> +	 * deterministic values.
> +	 */
> +	ret = wdt_start(wdt_dev);
> +	if (ret)
> +		return ret;
> +
> +	/* Make sure the watchdog is serviced */
> +	set_bit(WDOG_HW_RUNNING, &wdt_dev->status);
>
>  	ret = devm_watchdog_register_device(&pdev->dev, wdt_dev);
>  	if (ret) {
>


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

end of thread, other threads:[~2017-03-11 15:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-10 22:22 [PATCH v3] watchdog: intel-mid_wdt: Keep watchdog running Andy Shevchenko
2017-03-11 15:54 ` Guenter Roeck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.