linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] watchdog: w83627hf_wdt: add bootstatus support
@ 2022-08-24 15:24 Henning Schild
  2022-08-24 15:25 ` Henning Schild
  2022-10-07 15:36 ` Henning Schild
  0 siblings, 2 replies; 5+ messages in thread
From: Henning Schild @ 2022-08-24 15:24 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, linux-watchdog, linux-kernel
  Cc: Henning Schild

The status bit in the status and control register can tell us whether
the last reboot was caused by the watchdog. Make sure to take that into
the bootstatus before clearing it.

Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 drivers/watchdog/w83627hf_wdt.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/w83627hf_wdt.c b/drivers/watchdog/w83627hf_wdt.c
index 56a4a4030ca9..bc33b63c5a5d 100644
--- a/drivers/watchdog/w83627hf_wdt.c
+++ b/drivers/watchdog/w83627hf_wdt.c
@@ -113,6 +113,10 @@ MODULE_PARM_DESC(early_disable, "Disable watchdog at boot time (default=0)");
 #define W836X7HF_WDT_CSR	0xf7
 #define NCT6102D_WDT_CSR	0xf2
 
+#define WDT_CSR_STATUS		0x10
+#define WDT_CSR_KBD		0x40
+#define WDT_CSR_MOUSE		0x80
+
 static void superio_outb(int reg, int val)
 {
 	outb(reg, WDT_EFER);
@@ -244,8 +248,12 @@ static int w83627hf_init(struct watchdog_device *wdog, enum chips chip)
 	t = superio_inb(cr_wdt_control) & ~0x0C;
 	superio_outb(cr_wdt_control, t);
 
-	/* reset trigger, disable keyboard & mouse turning off watchdog */
-	t = superio_inb(cr_wdt_csr) & ~0xD0;
+	t = superio_inb(cr_wdt_csr);
+	if (t & WDT_CSR_STATUS)
+		wdog->bootstatus |= WDIOF_CARDRESET;
+
+	/* reset status, disable keyboard & mouse turning off watchdog */
+	t &= ~(WDT_CSR_STATUS | WDT_CSR_KBD | WDT_CSR_MOUSE);
 	superio_outb(cr_wdt_csr, t);
 
 	superio_exit();
-- 
2.35.1


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

* Re: [PATCH v2] watchdog: w83627hf_wdt: add bootstatus support
  2022-08-24 15:24 [PATCH v2] watchdog: w83627hf_wdt: add bootstatus support Henning Schild
@ 2022-08-24 15:25 ` Henning Schild
  2022-10-07 15:36 ` Henning Schild
  1 sibling, 0 replies; 5+ messages in thread
From: Henning Schild @ 2022-08-24 15:25 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, linux-watchdog, linux-kernel

Diff to v1:
 - fixed typo in commit message
 - add Reviewed-by tag
 - make sure it still applies

Henning

Am Wed, 24 Aug 2022 17:24:48 +0200
schrieb Henning Schild <henning.schild@siemens.com>:

> The status bit in the status and control register can tell us whether
> the last reboot was caused by the watchdog. Make sure to take that
> into the bootstatus before clearing it.
> 
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>  drivers/watchdog/w83627hf_wdt.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/watchdog/w83627hf_wdt.c
> b/drivers/watchdog/w83627hf_wdt.c index 56a4a4030ca9..bc33b63c5a5d
> 100644 --- a/drivers/watchdog/w83627hf_wdt.c
> +++ b/drivers/watchdog/w83627hf_wdt.c
> @@ -113,6 +113,10 @@ MODULE_PARM_DESC(early_disable, "Disable
> watchdog at boot time (default=0)"); #define W836X7HF_WDT_CSR
> 0xf7 #define NCT6102D_WDT_CSR	0xf2
>  
> +#define WDT_CSR_STATUS		0x10
> +#define WDT_CSR_KBD		0x40
> +#define WDT_CSR_MOUSE		0x80
> +
>  static void superio_outb(int reg, int val)
>  {
>  	outb(reg, WDT_EFER);
> @@ -244,8 +248,12 @@ static int w83627hf_init(struct watchdog_device
> *wdog, enum chips chip) t = superio_inb(cr_wdt_control) & ~0x0C;
>  	superio_outb(cr_wdt_control, t);
>  
> -	/* reset trigger, disable keyboard & mouse turning off
> watchdog */
> -	t = superio_inb(cr_wdt_csr) & ~0xD0;
> +	t = superio_inb(cr_wdt_csr);
> +	if (t & WDT_CSR_STATUS)
> +		wdog->bootstatus |= WDIOF_CARDRESET;
> +
> +	/* reset status, disable keyboard & mouse turning off
> watchdog */
> +	t &= ~(WDT_CSR_STATUS | WDT_CSR_KBD | WDT_CSR_MOUSE);
>  	superio_outb(cr_wdt_csr, t);
>  
>  	superio_exit();


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

* Re: [PATCH v2] watchdog: w83627hf_wdt: add bootstatus support
  2022-08-24 15:24 [PATCH v2] watchdog: w83627hf_wdt: add bootstatus support Henning Schild
  2022-08-24 15:25 ` Henning Schild
@ 2022-10-07 15:36 ` Henning Schild
  2022-10-07 15:51   ` Guenter Roeck
  1 sibling, 1 reply; 5+ messages in thread
From: Henning Schild @ 2022-10-07 15:36 UTC (permalink / raw)
  To: Wim Van Sebroeck, Guenter Roeck, linux-watchdog, linux-kernel

Ping.

Henning

Am Wed, 24 Aug 2022 17:24:48 +0200
schrieb Henning Schild <henning.schild@siemens.com>:

> The status bit in the status and control register can tell us whether
> the last reboot was caused by the watchdog. Make sure to take that
> into the bootstatus before clearing it.
> 
> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>  drivers/watchdog/w83627hf_wdt.c | 12 ++++++++++--
>  1 file changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/watchdog/w83627hf_wdt.c
> b/drivers/watchdog/w83627hf_wdt.c index 56a4a4030ca9..bc33b63c5a5d
> 100644 --- a/drivers/watchdog/w83627hf_wdt.c
> +++ b/drivers/watchdog/w83627hf_wdt.c
> @@ -113,6 +113,10 @@ MODULE_PARM_DESC(early_disable, "Disable
> watchdog at boot time (default=0)"); #define W836X7HF_WDT_CSR
> 0xf7 #define NCT6102D_WDT_CSR	0xf2
>  
> +#define WDT_CSR_STATUS		0x10
> +#define WDT_CSR_KBD		0x40
> +#define WDT_CSR_MOUSE		0x80
> +
>  static void superio_outb(int reg, int val)
>  {
>  	outb(reg, WDT_EFER);
> @@ -244,8 +248,12 @@ static int w83627hf_init(struct watchdog_device
> *wdog, enum chips chip) t = superio_inb(cr_wdt_control) & ~0x0C;
>  	superio_outb(cr_wdt_control, t);
>  
> -	/* reset trigger, disable keyboard & mouse turning off
> watchdog */
> -	t = superio_inb(cr_wdt_csr) & ~0xD0;
> +	t = superio_inb(cr_wdt_csr);
> +	if (t & WDT_CSR_STATUS)
> +		wdog->bootstatus |= WDIOF_CARDRESET;
> +
> +	/* reset status, disable keyboard & mouse turning off
> watchdog */
> +	t &= ~(WDT_CSR_STATUS | WDT_CSR_KBD | WDT_CSR_MOUSE);
>  	superio_outb(cr_wdt_csr, t);
>  
>  	superio_exit();


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

* Re: [PATCH v2] watchdog: w83627hf_wdt: add bootstatus support
  2022-10-07 15:36 ` Henning Schild
@ 2022-10-07 15:51   ` Guenter Roeck
  2022-10-07 16:33     ` Henning Schild
  0 siblings, 1 reply; 5+ messages in thread
From: Guenter Roeck @ 2022-10-07 15:51 UTC (permalink / raw)
  To: Henning Schild, Wim Van Sebroeck, linux-watchdog, linux-kernel

On 10/7/22 08:36, Henning Schild wrote:
> Ping.
> 

The patch is queued in my watchdog-next branch. We'll see
if Wim will pick it up in his pull request for 6.1. If not,
try again after the commit window closes.

Guenter

> Henning
> 
> Am Wed, 24 Aug 2022 17:24:48 +0200
> schrieb Henning Schild <henning.schild@siemens.com>:
> 
>> The status bit in the status and control register can tell us whether
>> the last reboot was caused by the watchdog. Make sure to take that
>> into the bootstatus before clearing it.
>>
>> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
>> Signed-off-by: Henning Schild <henning.schild@siemens.com>
>> ---
>>   drivers/watchdog/w83627hf_wdt.c | 12 ++++++++++--
>>   1 file changed, 10 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/watchdog/w83627hf_wdt.c
>> b/drivers/watchdog/w83627hf_wdt.c index 56a4a4030ca9..bc33b63c5a5d
>> 100644 --- a/drivers/watchdog/w83627hf_wdt.c
>> +++ b/drivers/watchdog/w83627hf_wdt.c
>> @@ -113,6 +113,10 @@ MODULE_PARM_DESC(early_disable, "Disable
>> watchdog at boot time (default=0)"); #define W836X7HF_WDT_CSR
>> 0xf7 #define NCT6102D_WDT_CSR	0xf2
>>   
>> +#define WDT_CSR_STATUS		0x10
>> +#define WDT_CSR_KBD		0x40
>> +#define WDT_CSR_MOUSE		0x80
>> +
>>   static void superio_outb(int reg, int val)
>>   {
>>   	outb(reg, WDT_EFER);
>> @@ -244,8 +248,12 @@ static int w83627hf_init(struct watchdog_device
>> *wdog, enum chips chip) t = superio_inb(cr_wdt_control) & ~0x0C;
>>   	superio_outb(cr_wdt_control, t);
>>   
>> -	/* reset trigger, disable keyboard & mouse turning off
>> watchdog */
>> -	t = superio_inb(cr_wdt_csr) & ~0xD0;
>> +	t = superio_inb(cr_wdt_csr);
>> +	if (t & WDT_CSR_STATUS)
>> +		wdog->bootstatus |= WDIOF_CARDRESET;
>> +
>> +	/* reset status, disable keyboard & mouse turning off
>> watchdog */
>> +	t &= ~(WDT_CSR_STATUS | WDT_CSR_KBD | WDT_CSR_MOUSE);
>>   	superio_outb(cr_wdt_csr, t);
>>   
>>   	superio_exit();
> 


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

* Re: [PATCH v2] watchdog: w83627hf_wdt: add bootstatus support
  2022-10-07 15:51   ` Guenter Roeck
@ 2022-10-07 16:33     ` Henning Schild
  0 siblings, 0 replies; 5+ messages in thread
From: Henning Schild @ 2022-10-07 16:33 UTC (permalink / raw)
  To: Guenter Roeck; +Cc: Wim Van Sebroeck, linux-watchdog, linux-kernel

Am Fri, 7 Oct 2022 08:51:05 -0700
schrieb Guenter Roeck <linux@roeck-us.net>:

> On 10/7/22 08:36, Henning Schild wrote:
> > Ping.
> >   
> 
> The patch is queued in my watchdog-next branch. We'll see
> if Wim will pick it up in his pull request for 6.1. If not,
> try again after the commit window closes.

Thanks for the update.

regards,
Henning

> Guenter
> 
> > Henning
> > 
> > Am Wed, 24 Aug 2022 17:24:48 +0200
> > schrieb Henning Schild <henning.schild@siemens.com>:
> >   
> >> The status bit in the status and control register can tell us
> >> whether the last reboot was caused by the watchdog. Make sure to
> >> take that into the bootstatus before clearing it.
> >>
> >> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
> >> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> >> ---
> >>   drivers/watchdog/w83627hf_wdt.c | 12 ++++++++++--
> >>   1 file changed, 10 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/drivers/watchdog/w83627hf_wdt.c
> >> b/drivers/watchdog/w83627hf_wdt.c index 56a4a4030ca9..bc33b63c5a5d
> >> 100644 --- a/drivers/watchdog/w83627hf_wdt.c
> >> +++ b/drivers/watchdog/w83627hf_wdt.c
> >> @@ -113,6 +113,10 @@ MODULE_PARM_DESC(early_disable, "Disable
> >> watchdog at boot time (default=0)"); #define W836X7HF_WDT_CSR
> >> 0xf7 #define NCT6102D_WDT_CSR	0xf2
> >>   
> >> +#define WDT_CSR_STATUS		0x10
> >> +#define WDT_CSR_KBD		0x40
> >> +#define WDT_CSR_MOUSE		0x80
> >> +
> >>   static void superio_outb(int reg, int val)
> >>   {
> >>   	outb(reg, WDT_EFER);
> >> @@ -244,8 +248,12 @@ static int w83627hf_init(struct
> >> watchdog_device *wdog, enum chips chip) t =
> >> superio_inb(cr_wdt_control) & ~0x0C; superio_outb(cr_wdt_control,
> >> t); 
> >> -	/* reset trigger, disable keyboard & mouse turning off
> >> watchdog */
> >> -	t = superio_inb(cr_wdt_csr) & ~0xD0;
> >> +	t = superio_inb(cr_wdt_csr);
> >> +	if (t & WDT_CSR_STATUS)
> >> +		wdog->bootstatus |= WDIOF_CARDRESET;
> >> +
> >> +	/* reset status, disable keyboard & mouse turning off
> >> watchdog */
> >> +	t &= ~(WDT_CSR_STATUS | WDT_CSR_KBD | WDT_CSR_MOUSE);
> >>   	superio_outb(cr_wdt_csr, t);
> >>   
> >>   	superio_exit();  
> >   
> 


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

end of thread, other threads:[~2022-10-07 16:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-24 15:24 [PATCH v2] watchdog: w83627hf_wdt: add bootstatus support Henning Schild
2022-08-24 15:25 ` Henning Schild
2022-10-07 15:36 ` Henning Schild
2022-10-07 15:51   ` Guenter Roeck
2022-10-07 16:33     ` Henning Schild

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