LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v2] watchdog: sp805: add restart handler
@ 2018-05-02  7:59 Jongsung Kim
  2018-05-02 13:21 ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Jongsung Kim @ 2018-05-02  7:59 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, linux-watchdog, linux-kernel
  Cc: Chanho Min, Jongsung Kim

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
-- 
2.7.4

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

* Re: [PATCH v2] watchdog: sp805: add restart handler
  2018-05-02  7:59 [PATCH v2] watchdog: sp805: add restart handler Jongsung Kim
@ 2018-05-02 13:21 ` Guenter Roeck
  2018-05-04  6:05   ` [PATCH v3] " Jongsung Kim
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2018-05-02 13:21 UTC (permalink / raw)
  To: Jongsung Kim, Wim Van Sebroeck, linux-watchdog, linux-kernel; +Cc: Chanho Min

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

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

* [PATCH v3] watchdog: sp805: add restart handler
  2018-05-02 13:21 ` Guenter Roeck
@ 2018-05-04  6:05   ` Jongsung Kim
  2018-05-04 13:11     ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Jongsung Kim @ 2018-05-04  6:05 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, linux-watchdog, linux-kernel
  Cc: Chanho Min, Jongsung Kim

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 | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
index 03805bc..9849db0 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
@@ -230,6 +243,7 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id)
 	spin_lock_init(&wdt->lock);
 	watchdog_set_nowayout(&wdt->wdd, nowayout);
 	watchdog_set_drvdata(&wdt->wdd, wdt);
+	watchdog_set_restart_priority(&wdt->wdd, 128);
 	wdt_setload(&wdt->wdd, DEFAULT_TIMEOUT);
 
 	ret = watchdog_register_device(&wdt->wdd);
-- 
2.7.4

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

* Re: [PATCH v3] watchdog: sp805: add restart handler
  2018-05-04  6:05   ` [PATCH v3] " Jongsung Kim
@ 2018-05-04 13:11     ` Guenter Roeck
  2018-05-09  2:40       ` Jongsung Kim
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2018-05-04 13:11 UTC (permalink / raw)
  To: Jongsung Kim, Wim Van Sebroeck, linux-watchdog, linux-kernel; +Cc: Chanho Min

On 05/03/2018 11:05 PM, 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>

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

> ---

For future patches: change log goes here, please.

Thanks,
Guenter

>   drivers/watchdog/sp805_wdt.c | 14 ++++++++++++++
>   1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
> index 03805bc..9849db0 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
> @@ -230,6 +243,7 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id)
>   	spin_lock_init(&wdt->lock);
>   	watchdog_set_nowayout(&wdt->wdd, nowayout);
>   	watchdog_set_drvdata(&wdt->wdd, wdt);
> +	watchdog_set_restart_priority(&wdt->wdd, 128);
>   	wdt_setload(&wdt->wdd, DEFAULT_TIMEOUT);
>   
>   	ret = watchdog_register_device(&wdt->wdd);
> 

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

* Re: [PATCH v3] watchdog: sp805: add restart handler
  2018-05-04 13:11     ` Guenter Roeck
@ 2018-05-09  2:40       ` Jongsung Kim
  0 siblings, 0 replies; 5+ messages in thread
From: Jongsung Kim @ 2018-05-09  2:40 UTC (permalink / raw)
  To: Guenter Roeck, Wim Van Sebroeck, linux-watchdog, linux-kernel; +Cc: Chanho Min

On 05/04/2018 10:11 PM, Guenter Roeck wrote:
> On 05/03/2018 11:05 PM, 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>
>
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
>
>> ---
>
> For future patches: change log goes here, please.
>
> Thanks,
> Guenter

Thank you for your review and kind comments.
JS

>
>>   drivers/watchdog/sp805_wdt.c | 14 ++++++++++++++
>>   1 file changed, 14 insertions(+)
>>
>> diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
>> index 03805bc..9849db0 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
>> @@ -230,6 +243,7 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id)
>>       spin_lock_init(&wdt->lock);
>>       watchdog_set_nowayout(&wdt->wdd, nowayout);
>>       watchdog_set_drvdata(&wdt->wdd, wdt);
>> +    watchdog_set_restart_priority(&wdt->wdd, 128);
>>       wdt_setload(&wdt->wdd, DEFAULT_TIMEOUT);
>>         ret = watchdog_register_device(&wdt->wdd);
>>
>
>

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

end of thread, other threads:[~2018-05-09  2:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-02  7:59 [PATCH v2] watchdog: sp805: add restart handler Jongsung Kim
2018-05-02 13:21 ` Guenter Roeck
2018-05-04  6:05   ` [PATCH v3] " Jongsung Kim
2018-05-04 13:11     ` Guenter Roeck
2018-05-09  2:40       ` Jongsung Kim

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).