LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Guenter Roeck <linux@roeck-us.net>
To: Jongsung Kim <neidhard.kim@lge.com>,
	Wim Van Sebroeck <wim@linux-watchdog.org>,
	linux-watchdog@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Chanho Min <chanho.min@lge.com>
Subject: Re: [PATCH v2] watchdog: sp805: add restart handler
Date: Wed, 2 May 2018 06:21:57 -0700	[thread overview]
Message-ID: <cf2f151a-06d7-368e-7ae5-68e992dfc3ea@roeck-us.net> (raw)
In-Reply-To: <1525247979-23156-1-git-send-email-neidhard.kim@lge.com>

On 05/02/2018 12:59 AM, Jongsung Kim wrote:
> Add restart handler for SP805 watchdog so that the driver can be
> used to reboot the system.
> 
> Signed-off-by: Jongsung Kim <neidhard.kim@lge.com>
> Cc: Guenter Roeck <linux@roeck-us.net>
> ---
>   drivers/watchdog/sp805_wdt.c | 13 +++++++++++++
>   1 file changed, 13 insertions(+)
> 
> diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
> index 03805bc..969369e 100644
> --- a/drivers/watchdog/sp805_wdt.c
> +++ b/drivers/watchdog/sp805_wdt.c
> @@ -121,6 +121,18 @@ static unsigned int wdt_timeleft(struct watchdog_device *wdd)
>   	return div_u64(load, rate);
>   }
>   
> +static int
> +wdt_restart(struct watchdog_device *wdd, unsigned long mode, void *cmd)
> +{
> +	struct sp805_wdt *wdt = watchdog_get_drvdata(wdd);
> +
> +	writel_relaxed(0, wdt->base + WDTCONTROL);
> +	writel_relaxed(0, wdt->base + WDTLOAD);
> +	writel_relaxed(INT_ENABLE | RESET_ENABLE, wdt->base + WDTCONTROL);
> +
> +	return 0;
> +}
> +
>   static int wdt_config(struct watchdog_device *wdd, bool ping)
>   {
>   	struct sp805_wdt *wdt = watchdog_get_drvdata(wdd);
> @@ -197,6 +209,7 @@ static const struct watchdog_ops wdt_ops = {
>   	.ping		= wdt_ping,
>   	.set_timeout	= wdt_setload,
>   	.get_timeleft	= wdt_timeleft,
> +	.restart	= wdt_restart,
>   };
>   
>   static int
> 
Please add the restart priority

	watchdog_set_restart_priority(&wdt->wdd, 128);

before registering the watchdog.

Thanks,
Guenter

  reply	other threads:[~2018-05-02 13:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-02  7:59 Jongsung Kim
2018-05-02 13:21 ` Guenter Roeck [this message]
2018-05-04  6:05   ` [PATCH v3] " Jongsung Kim
2018-05-04 13:11     ` Guenter Roeck
2018-05-09  2:40       ` Jongsung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cf2f151a-06d7-368e-7ae5-68e992dfc3ea@roeck-us.net \
    --to=linux@roeck-us.net \
    --cc=chanho.min@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-watchdog@vger.kernel.org \
    --cc=neidhard.kim@lge.com \
    --cc=wim@linux-watchdog.org \
    --subject='Re: [PATCH v2] watchdog: sp805: add restart handler' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).