Linux-Watchdog Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2 0/3] watchdog: npcm: add last bootstatus support
@ 2020-03-03 10:01 Tomer Maimon
  2020-03-03 10:01 ` [PATCH v2 1/3] dt-binding: watchdog: add bootstatus reset type documentation Tomer Maimon
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Tomer Maimon @ 2020-03-03 10:01 UTC (permalink / raw)
  To: wim, linux, robh+dt, mark.rutland, joel, avifishman70,
	tali.perry1, yuenn, benjaminfair
  Cc: linux-watchdog, devicetree, linux-kernel, openbmc, Tomer Maimon

This patch set adds last reset bootstatus support in 
watchdog the Nuvoton NPCM Baseboard Management Controller (BMC).

The NPCM watchdog driver tested on NPCM750 evaluation board.

Addressed comments from:.
 - Guenter Roeck: https://www.spinics.net/lists/kernel/msg3425926.html 
 - Guenter Roeck: https://lkml.org/lkml/2020/3/1/144 
				  
Changes since version 1:
 - Remove restart priority support.
 - Modify commit message.
 - Modify define in alphabetic order.
 - Add reset bootstatus remarks.
 - Remove and modify whitespace.

Tomer Maimon (3):
  dt-binding: watchdog: add bootstatus reset type documentation
  watchdog: npcm: sets card ext1 and ext2 bootstatus during probe
  watchdog: npcm: remove whitespaces

 .../bindings/watchdog/nuvoton,npcm-wdt.txt    |  30 ++++
 drivers/watchdog/npcm_wdt.c                   | 131 ++++++++++++++++--
 2 files changed, 151 insertions(+), 10 deletions(-)

-- 
2.22.0


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

* [PATCH v2 1/3] dt-binding: watchdog: add bootstatus reset type documentation
  2020-03-03 10:01 [PATCH v2 0/3] watchdog: npcm: add last bootstatus support Tomer Maimon
@ 2020-03-03 10:01 ` Tomer Maimon
  2020-03-04 17:08   ` Guenter Roeck
  2020-03-03 10:01 ` [PATCH v2 2/3] watchdog: npcm: sets card ext1 and ext2 bootstatus during probe Tomer Maimon
  2020-03-03 10:01 ` [PATCH v2 3/3] watchdog: npcm: remove whitespaces Tomer Maimon
  2 siblings, 1 reply; 7+ messages in thread
From: Tomer Maimon @ 2020-03-03 10:01 UTC (permalink / raw)
  To: wim, linux, robh+dt, mark.rutland, joel, avifishman70,
	tali.perry1, yuenn, benjaminfair
  Cc: linux-watchdog, devicetree, linux-kernel, openbmc, Tomer Maimon

Add device tree three bootstatus reset types documentation.

Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
---
 .../bindings/watchdog/nuvoton,npcm-wdt.txt    | 30 +++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/Documentation/devicetree/bindings/watchdog/nuvoton,npcm-wdt.txt b/Documentation/devicetree/bindings/watchdog/nuvoton,npcm-wdt.txt
index 6d593003c933..65e24a80ee70 100644
--- a/Documentation/devicetree/bindings/watchdog/nuvoton,npcm-wdt.txt
+++ b/Documentation/devicetree/bindings/watchdog/nuvoton,npcm-wdt.txt
@@ -17,6 +17,33 @@ Required clocking property, have to be one of:
 
 Optional properties:
 - timeout-sec : Contains the watchdog timeout in seconds
+- nuvoton,card-reset-type : "porst|corst|wd0|wd1|wd2|sw1|sw2|sw3|sw4"
+  Contains the card reset type for checking and indicating
+  the last card reset status (WDIOF_CARDRESET)
+
+  If 'nuvoton,card-reset-type' is not specified the default is porst
+
+  Reset types:
+       - porst: Power reset
+       - corst: Core reset
+	   - wdX : Watchdog reset X (X represante 0-2)
+	   - swX : Software reset X (X represante 1-4)
+
+- nuvoton,ext1-reset-type : "porst|corst|wd0|wd1|wd2|sw1|sw2|sw3|sw4"
+  Contains the external 2 reset type for checking and indicating
+  the last external 2 reset status (WDIOF_EXTERN1)
+
+  If 'nuvoton,card-reset-type' is not specified the default is wd0.
+
+  Reset types are the same as in nuvoton,card-reset-type property.
+
+- nuvoton,ext2-reset-type : "porst|corst|wd0|wd1|wd2|sw1|sw2|sw3|sw4"
+  Contains the external 2 reset type for checking and indicating
+  the last external 2 reset status (WDIOF_EXTERN2)
+
+  If 'nuvoton,card-reset-type' is not specified the default is sw1.
+
+  Reset types are the same as in nuvoton,card-reset-type property.
 
 Example:
 
@@ -25,4 +52,7 @@ timer@f000801c {
     interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>;
     reg = <0xf000801c 0x4>;
     clocks = <&clk NPCM7XX_CLK_TIMER>;
+	nuvoton,card-reset-type = "porst";
+	nuvoton,ext1-reset-type = "wd1";
+	nuvoton,ext2-reset-type = "sw2";
 };
-- 
2.22.0


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

* [PATCH v2 2/3] watchdog: npcm: sets card ext1 and ext2 bootstatus during probe
  2020-03-03 10:01 [PATCH v2 0/3] watchdog: npcm: add last bootstatus support Tomer Maimon
  2020-03-03 10:01 ` [PATCH v2 1/3] dt-binding: watchdog: add bootstatus reset type documentation Tomer Maimon
@ 2020-03-03 10:01 ` Tomer Maimon
  2020-03-03 10:01 ` [PATCH v2 3/3] watchdog: npcm: remove whitespaces Tomer Maimon
  2 siblings, 0 replies; 7+ messages in thread
From: Tomer Maimon @ 2020-03-03 10:01 UTC (permalink / raw)
  To: wim, linux, robh+dt, mark.rutland, joel, avifishman70,
	tali.perry1, yuenn, benjaminfair
  Cc: linux-watchdog, devicetree, linux-kernel, openbmc, Tomer Maimon

The NPCM750 have the following nine resets:
- Power on reset.
- Core reset
- Watchdog0-2 resets.
- Software1-4 resets

During probe NPCM watchdog sets WDIOF_CARDRESET, WDIOF_EXTERN1 and
WDIOF_EXTERN2 bootstatus flags.

Each bootstatus flag can represent one of the NPCM750 resets.

Bootstatus flag configure by the DT properties.

Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
---
 drivers/watchdog/npcm_wdt.c | 112 ++++++++++++++++++++++++++++++++++++
 1 file changed, 112 insertions(+)

diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c
index 9c773c3d6d5d..84a728af6664 100644
--- a/drivers/watchdog/npcm_wdt.c
+++ b/drivers/watchdog/npcm_wdt.c
@@ -6,12 +6,29 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/kernel.h>
+#include <linux/mfd/syscon.h>
 #include <linux/module.h>
 #include <linux/of_irq.h>
 #include <linux/platform_device.h>
+#include <linux/regmap.h>
 #include <linux/slab.h>
 #include <linux/watchdog.h>
 
+/* NPCM7xx GCR module */
+#define NPCM7XX_RESSR_OFFSET		0x6C
+#define NPCM7XX_INTCR2_OFFSET		0x60
+
+#define NPCM7XX_PORST			BIT(31)
+#define NPCM7XX_CORST			BIT(30)
+#define NPCM7XX_WD0RST			BIT(29)
+#define NPCM7XX_WD1RST			BIT(24)
+#define NPCM7XX_WD2RST			BIT(23)
+#define NPCM7XX_SWR1RST			BIT(28)
+#define NPCM7XX_SWR2RST			BIT(27)
+#define NPCM7XX_SWR3RST			BIT(26)
+#define NPCM7XX_SWR4RST			BIT(25)
+
+ /* WD register */
 #define NPCM_WTCR	0x1C
 
 #define NPCM_WTCLK	(BIT(10) | BIT(11))	/* Clock divider */
@@ -43,6 +60,9 @@
 struct npcm_wdt {
 	struct watchdog_device  wdd;
 	void __iomem		*reg;
+	u32			card_reset;
+	u32			ext1_reset;
+	u32			ext2_reset;
 };
 
 static inline struct npcm_wdt *to_npcm_wdt(struct watchdog_device *wdd)
@@ -177,9 +197,66 @@ static const struct watchdog_ops npcm_wdt_ops = {
 	.restart = npcm_wdt_restart,
 };
 
+static void npcm_get_reset_status(struct npcm_wdt *wdt, struct device *dev)
+{
+	struct regmap *gcr_regmap;
+	u32 rstval;
+
+	if (of_device_is_compatible(dev->of_node, "nuvoton,npcm750-wdt")) {
+		gcr_regmap = syscon_regmap_lookup_by_compatible("nuvoton,npcm750-gcr");
+		if (IS_ERR(gcr_regmap))
+			dev_warn(dev, "Failed to find nuvoton,npcm750-gcr WD reset status not supported\n");
+
+		/* Reading last reset status bit */
+		regmap_read(gcr_regmap, NPCM7XX_RESSR_OFFSET, &rstval);
+		/* In case of NPCM750 power on, the reset status copied to
+		 * NPCM7XX_INTCR2_OFFSET register and then NPCM7XX_RESSR_OFFSET
+		 * register is cleaned.
+		 */
+		if (!rstval) {
+			regmap_read(gcr_regmap, NPCM7XX_INTCR2_OFFSET, &rstval);
+			rstval = ~rstval;
+		}
+
+		if (rstval & wdt->card_reset)
+			wdt->wdd.bootstatus |= WDIOF_CARDRESET;
+		if (rstval & wdt->ext1_reset)
+			wdt->wdd.bootstatus |= WDIOF_EXTERN1;
+		if (rstval & wdt->ext2_reset)
+			wdt->wdd.bootstatus |= WDIOF_EXTERN2;
+	}
+}
+
+static u32 npcm_wdt_reset_type(const char *reset_type)
+{
+	if (!strcmp(reset_type, "porst"))
+		return NPCM7XX_PORST;
+	else if (!strcmp(reset_type, "corst"))
+		return NPCM7XX_CORST;
+	else if (!strcmp(reset_type, "wd0"))
+		return NPCM7XX_WD0RST;
+	else if (!strcmp(reset_type, "wd1"))
+		return NPCM7XX_WD1RST;
+	else if (!strcmp(reset_type, "wd2"))
+		return NPCM7XX_WD2RST;
+	else if (!strcmp(reset_type, "sw1"))
+		return NPCM7XX_SWR1RST;
+	else if (!strcmp(reset_type, "sw2"))
+		return NPCM7XX_SWR2RST;
+	else if (!strcmp(reset_type, "sw3"))
+		return NPCM7XX_SWR3RST;
+	else if (!strcmp(reset_type, "sw4"))
+		return NPCM7XX_SWR4RST;
+
+	return 0;
+}
+
 static int npcm_wdt_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
+	const char *card_reset_type;
+	const char *ext1_reset_type;
+	const char *ext2_reset_type;
 	struct npcm_wdt *wdt;
 	int irq;
 	int ret;
@@ -196,6 +273,39 @@ static int npcm_wdt_probe(struct platform_device *pdev)
 	if (irq < 0)
 		return irq;
 
+	ret = of_property_read_string(pdev->dev.of_node,
+				      "nuvoton,card-reset-type",
+				      &card_reset_type);
+	if (ret) {
+		wdt->card_reset = NPCM7XX_PORST;
+	} else {
+		wdt->card_reset = npcm_wdt_reset_type(card_reset_type);
+		if (!wdt->card_reset)
+			wdt->card_reset = NPCM7XX_PORST;
+	}
+
+	ret = of_property_read_string(pdev->dev.of_node,
+				      "nuvoton,ext1-reset-type",
+				      &ext1_reset_type);
+	if (ret) {
+		wdt->ext1_reset = NPCM7XX_WD0RST;
+	} else {
+		wdt->ext1_reset = npcm_wdt_reset_type(ext1_reset_type);
+		if (!wdt->ext1_reset)
+			wdt->ext1_reset = NPCM7XX_WD0RST;
+	}
+
+	ret = of_property_read_string(pdev->dev.of_node,
+				      "nuvoton,ext2-reset-type",
+				      &ext2_reset_type);
+	if (ret) {
+		wdt->ext2_reset = NPCM7XX_SWR1RST;
+	} else {
+		wdt->ext2_reset = npcm_wdt_reset_type(ext2_reset_type);
+		if (!wdt->ext2_reset)
+			wdt->ext2_reset = NPCM7XX_SWR1RST;
+	}
+
 	wdt->wdd.info = &npcm_wdt_info;
 	wdt->wdd.ops = &npcm_wdt_ops;
 	wdt->wdd.min_timeout = 1;
@@ -214,6 +324,8 @@ static int npcm_wdt_probe(struct platform_device *pdev)
 		set_bit(WDOG_HW_RUNNING, &wdt->wdd.status);
 	}
 
+	npcm_get_reset_status(wdt, dev);
+
 	ret = devm_request_irq(dev, irq, npcm_wdt_interrupt, 0, "watchdog",
 			       wdt);
 	if (ret)
-- 
2.22.0


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

* [PATCH v2 3/3] watchdog: npcm: remove whitespaces
  2020-03-03 10:01 [PATCH v2 0/3] watchdog: npcm: add last bootstatus support Tomer Maimon
  2020-03-03 10:01 ` [PATCH v2 1/3] dt-binding: watchdog: add bootstatus reset type documentation Tomer Maimon
  2020-03-03 10:01 ` [PATCH v2 2/3] watchdog: npcm: sets card ext1 and ext2 bootstatus during probe Tomer Maimon
@ 2020-03-03 10:01 ` Tomer Maimon
  2020-03-03 21:25   ` Guenter Roeck
  2 siblings, 1 reply; 7+ messages in thread
From: Tomer Maimon @ 2020-03-03 10:01 UTC (permalink / raw)
  To: wim, linux, robh+dt, mark.rutland, joel, avifishman70,
	tali.perry1, yuenn, benjaminfair
  Cc: linux-watchdog, devicetree, linux-kernel, openbmc, Tomer Maimon

Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
---
 drivers/watchdog/npcm_wdt.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c
index 84a728af6664..bd38bf1ee6a1 100644
--- a/drivers/watchdog/npcm_wdt.c
+++ b/drivers/watchdog/npcm_wdt.c
@@ -123,30 +123,29 @@ static int npcm_wdt_stop(struct watchdog_device *wdd)
 	return 0;
 }
 
-
 static int npcm_wdt_set_timeout(struct watchdog_device *wdd,
 				unsigned int timeout)
 {
 	if (timeout < 2)
 		wdd->timeout = 1;
 	else if (timeout < 3)
-	      wdd->timeout = 2;
+		wdd->timeout = 2;
 	else if (timeout < 6)
-	      wdd->timeout = 5;
+		wdd->timeout = 5;
 	else if (timeout < 11)
-	      wdd->timeout = 10;
+		wdd->timeout = 10;
 	else if (timeout < 22)
-	      wdd->timeout = 21;
+		wdd->timeout = 21;
 	else if (timeout < 44)
-	      wdd->timeout = 43;
+		wdd->timeout = 43;
 	else if (timeout < 87)
-	      wdd->timeout = 86;
+		wdd->timeout = 86;
 	else if (timeout < 173)
-	      wdd->timeout = 172;
+		wdd->timeout = 172;
 	else if (timeout < 688)
-	      wdd->timeout = 687;
+		wdd->timeout = 687;
 	else
-	      wdd->timeout = 2750;
+		wdd->timeout = 2750;
 
 	if (watchdog_active(wdd))
 		npcm_wdt_start(wdd);
-- 
2.22.0


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

* Re: [PATCH v2 3/3] watchdog: npcm: remove whitespaces
  2020-03-03 10:01 ` [PATCH v2 3/3] watchdog: npcm: remove whitespaces Tomer Maimon
@ 2020-03-03 21:25   ` Guenter Roeck
       [not found]     ` <CAP6Zq1gW53NEH7vD9C9GK2sg1pOxeZinA5uMJQQmbntrf=2ySA@mail.gmail.com>
  0 siblings, 1 reply; 7+ messages in thread
From: Guenter Roeck @ 2020-03-03 21:25 UTC (permalink / raw)
  To: Tomer Maimon
  Cc: wim, robh+dt, mark.rutland, joel, avifishman70, tali.perry1,
	yuenn, benjaminfair, linux-watchdog, devicetree, linux-kernel,
	openbmc

On Tue, Mar 03, 2020 at 12:01:14PM +0200, Tomer Maimon wrote:
> Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>

Turns out this problem does not actually exist in the upstream driver
(as of v5.6-rc4). You might want to align your code with the upstream
kernel.

Guenter

> ---
>  drivers/watchdog/npcm_wdt.c | 19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c
> index 84a728af6664..bd38bf1ee6a1 100644
> --- a/drivers/watchdog/npcm_wdt.c
> +++ b/drivers/watchdog/npcm_wdt.c
> @@ -123,30 +123,29 @@ static int npcm_wdt_stop(struct watchdog_device *wdd)
>  	return 0;
>  }
>  
> -
>  static int npcm_wdt_set_timeout(struct watchdog_device *wdd,
>  				unsigned int timeout)
>  {
>  	if (timeout < 2)
>  		wdd->timeout = 1;
>  	else if (timeout < 3)
> -	      wdd->timeout = 2;
> +		wdd->timeout = 2;
>  	else if (timeout < 6)
> -	      wdd->timeout = 5;
> +		wdd->timeout = 5;
>  	else if (timeout < 11)
> -	      wdd->timeout = 10;
> +		wdd->timeout = 10;
>  	else if (timeout < 22)
> -	      wdd->timeout = 21;
> +		wdd->timeout = 21;
>  	else if (timeout < 44)
> -	      wdd->timeout = 43;
> +		wdd->timeout = 43;
>  	else if (timeout < 87)
> -	      wdd->timeout = 86;
> +		wdd->timeout = 86;
>  	else if (timeout < 173)
> -	      wdd->timeout = 172;
> +		wdd->timeout = 172;
>  	else if (timeout < 688)
> -	      wdd->timeout = 687;
> +		wdd->timeout = 687;
>  	else
> -	      wdd->timeout = 2750;
> +		wdd->timeout = 2750;
>  
>  	if (watchdog_active(wdd))
>  		npcm_wdt_start(wdd);

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

* Re: [PATCH v2 3/3] watchdog: npcm: remove whitespaces
       [not found]     ` <CAP6Zq1gW53NEH7vD9C9GK2sg1pOxeZinA5uMJQQmbntrf=2ySA@mail.gmail.com>
@ 2020-03-04 17:02       ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2020-03-04 17:02 UTC (permalink / raw)
  To: Tomer Maimon
  Cc: Wim Van Sebroeck, Rob Herring, Mark Rutland, Joel Stanley,
	Avi Fishman, Tali Perry, Nancy Yuen, Benjamin Fair,
	linux-watchdog, devicetree, Linux Kernel Mailing List,
	OpenBMC Maillist

On Wed, Mar 04, 2020 at 10:18:12AM +0200, Tomer Maimon wrote:
> Hi Guenter,
> 
> I still see the whitespaces warning in v5.6-rc4
> 
> https://github.com/torvalds/linux/blob/master/drivers/watchdog/npcm_wdt.c#L106
> 
You are corerct, sorry. No idea what I looked at yesterday.

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

> 
> bash-4.2$ ./scripts/checkpatch.pl --strict --file
> drivers/watchdog/npcm_wdt.c
> CHECK: Please don't use multiple blank lines
> #106: FILE: drivers/watchdog/npcm_wdt.c:106:
> +
> +
> 
> WARNING: suspect code indent for conditional statements (8, 14)
> #112: FILE: drivers/watchdog/npcm_wdt.c:112:
> + else if (timeout < 3)
> +      wdd->timeout = 2;
> 
> WARNING: suspect code indent for conditional statements (8, 14)
> #114: FILE: drivers/watchdog/npcm_wdt.c:114:
> + else if (timeout < 6)
> +      wdd->timeout = 5;
> 
> WARNING: suspect code indent for conditional statements (8, 14)
> #116: FILE: drivers/watchdog/npcm_wdt.c:116:
> + else if (timeout < 11)
> +      wdd->timeout = 10;
> 
> WARNING: suspect code indent for conditional statements (8, 14)
> #118: FILE: drivers/watchdog/npcm_wdt.c:118:
> + else if (timeout < 22)
> +      wdd->timeout = 21;
> 
> WARNING: suspect code indent for conditional statements (8, 14)
> #120: FILE: drivers/watchdog/npcm_wdt.c:120:
> + else if (timeout < 44)
> +      wdd->timeout = 43;
> 
> WARNING: suspect code indent for conditional statements (8, 14)
> #122: FILE: drivers/watchdog/npcm_wdt.c:122:
> + else if (timeout < 87)
> +      wdd->timeout = 86;
> 
> WARNING: suspect code indent for conditional statements (8, 14)
> #124: FILE: drivers/watchdog/npcm_wdt.c:124:
> + else if (timeout < 173)
> +      wdd->timeout = 172;
> 
> WARNING: suspect code indent for conditional statements (8, 14)
> #126: FILE: drivers/watchdog/npcm_wdt.c:126:
> + else if (timeout < 688)
> +      wdd->timeout = 687;
> 
> WARNING: suspect code indent for conditional statements (8, 14)
> #128: FILE: drivers/watchdog/npcm_wdt.c:128:
> + else
> +      wdd->timeout = 2750;
> 
> Thanks,
> 
> Tomer
> 
> On Tue, 3 Mar 2020 at 23:25, Guenter Roeck <linux@roeck-us.net> wrote:
> 
> > On Tue, Mar 03, 2020 at 12:01:14PM +0200, Tomer Maimon wrote:
> > > Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
> >
> > Turns out this problem does not actually exist in the upstream driver
> > (as of v5.6-rc4). You might want to align your code with the upstream
> > kernel.
> >
> > Guenter
> >
> > > ---
> > >  drivers/watchdog/npcm_wdt.c | 19 +++++++++----------
> > >  1 file changed, 9 insertions(+), 10 deletions(-)
> > >
> > > diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c
> > > index 84a728af6664..bd38bf1ee6a1 100644
> > > --- a/drivers/watchdog/npcm_wdt.c
> > > +++ b/drivers/watchdog/npcm_wdt.c
> > > @@ -123,30 +123,29 @@ static int npcm_wdt_stop(struct watchdog_device
> > *wdd)
> > >       return 0;
> > >  }
> > >
> > > -
> > >  static int npcm_wdt_set_timeout(struct watchdog_device *wdd,
> > >                               unsigned int timeout)
> > >  {
> > >       if (timeout < 2)
> > >               wdd->timeout = 1;
> > >       else if (timeout < 3)
> > > -           wdd->timeout = 2;
> > > +             wdd->timeout = 2;
> > >       else if (timeout < 6)
> > > -           wdd->timeout = 5;
> > > +             wdd->timeout = 5;
> > >       else if (timeout < 11)
> > > -           wdd->timeout = 10;
> > > +             wdd->timeout = 10;
> > >       else if (timeout < 22)
> > > -           wdd->timeout = 21;
> > > +             wdd->timeout = 21;
> > >       else if (timeout < 44)
> > > -           wdd->timeout = 43;
> > > +             wdd->timeout = 43;
> > >       else if (timeout < 87)
> > > -           wdd->timeout = 86;
> > > +             wdd->timeout = 86;
> > >       else if (timeout < 173)
> > > -           wdd->timeout = 172;
> > > +             wdd->timeout = 172;
> > >       else if (timeout < 688)
> > > -           wdd->timeout = 687;
> > > +             wdd->timeout = 687;
> > >       else
> > > -           wdd->timeout = 2750;
> > > +             wdd->timeout = 2750;
> > >
> > >       if (watchdog_active(wdd))
> > >               npcm_wdt_start(wdd);
> >

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

* Re: [PATCH v2 1/3] dt-binding: watchdog: add bootstatus reset type documentation
  2020-03-03 10:01 ` [PATCH v2 1/3] dt-binding: watchdog: add bootstatus reset type documentation Tomer Maimon
@ 2020-03-04 17:08   ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2020-03-04 17:08 UTC (permalink / raw)
  To: Tomer Maimon
  Cc: wim, robh+dt, mark.rutland, joel, avifishman70, tali.perry1,
	yuenn, benjaminfair, linux-watchdog, devicetree, linux-kernel,
	openbmc

On Tue, Mar 03, 2020 at 12:01:12PM +0200, Tomer Maimon wrote:
> Add device tree three bootstatus reset types documentation.
> 
> Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
> ---
>  .../bindings/watchdog/nuvoton,npcm-wdt.txt    | 30 +++++++++++++++++++
>  1 file changed, 30 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/watchdog/nuvoton,npcm-wdt.txt b/Documentation/devicetree/bindings/watchdog/nuvoton,npcm-wdt.txt
> index 6d593003c933..65e24a80ee70 100644
> --- a/Documentation/devicetree/bindings/watchdog/nuvoton,npcm-wdt.txt
> +++ b/Documentation/devicetree/bindings/watchdog/nuvoton,npcm-wdt.txt
> @@ -17,6 +17,33 @@ Required clocking property, have to be one of:
>  
>  Optional properties:
>  - timeout-sec : Contains the watchdog timeout in seconds
> +- nuvoton,card-reset-type : "porst|corst|wd0|wd1|wd2|sw1|sw2|sw3|sw4"
> +  Contains the card reset type for checking and indicating
> +  the last card reset status (WDIOF_CARDRESET)
> +
> +  If 'nuvoton,card-reset-type' is not specified the default is porst
> +
> +  Reset types:
> +       - porst: Power reset
> +       - corst: Core reset
> +	   - wdX : Watchdog reset X (X represante 0-2)
> +	   - swX : Software reset X (X represante 1-4)
> +
> +- nuvoton,ext1-reset-type : "porst|corst|wd0|wd1|wd2|sw1|sw2|sw3|sw4"
> +  Contains the external 2 reset type for checking and indicating
> +  the last external 2 reset status (WDIOF_EXTERN1)
> +
> +  If 'nuvoton,card-reset-type' is not specified the default is wd0.
> +
> +  Reset types are the same as in nuvoton,card-reset-type property.
> +
> +- nuvoton,ext2-reset-type : "porst|corst|wd0|wd1|wd2|sw1|sw2|sw3|sw4"
> +  Contains the external 2 reset type for checking and indicating
> +  the last external 2 reset status (WDIOF_EXTERN2)
> +
> +  If 'nuvoton,card-reset-type' is not specified the default is sw1.
> +
> +  Reset types are the same as in nuvoton,card-reset-type property.
>  
>  Example:
>  
> @@ -25,4 +52,7 @@ timer@f000801c {
>      interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>;
>      reg = <0xf000801c 0x4>;
>      clocks = <&clk NPCM7XX_CLK_TIMER>;
> +	nuvoton,card-reset-type = "porst";
> +	nuvoton,ext1-reset-type = "wd1";
> +	nuvoton,ext2-reset-type = "sw2";

This set of properties maps chip reset types to reset types defined
by the Linux watchdog subsystem (ie WDIOF_CARDRESET, WDIOF_EXTERN1,
and WDIOF_EXTERN2). It is neither a hardware description nor a system
configuration.

It is up to Rob to decide, but I personally don't think it is appropriate.

Guenter

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

end of thread, back to index

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-03 10:01 [PATCH v2 0/3] watchdog: npcm: add last bootstatus support Tomer Maimon
2020-03-03 10:01 ` [PATCH v2 1/3] dt-binding: watchdog: add bootstatus reset type documentation Tomer Maimon
2020-03-04 17:08   ` Guenter Roeck
2020-03-03 10:01 ` [PATCH v2 2/3] watchdog: npcm: sets card ext1 and ext2 bootstatus during probe Tomer Maimon
2020-03-03 10:01 ` [PATCH v2 3/3] watchdog: npcm: remove whitespaces Tomer Maimon
2020-03-03 21:25   ` Guenter Roeck
     [not found]     ` <CAP6Zq1gW53NEH7vD9C9GK2sg1pOxeZinA5uMJQQmbntrf=2ySA@mail.gmail.com>
2020-03-04 17:02       ` Guenter Roeck

Linux-Watchdog Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-watchdog/0 linux-watchdog/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-watchdog linux-watchdog/ https://lore.kernel.org/linux-watchdog \
		linux-watchdog@vger.kernel.org
	public-inbox-index linux-watchdog

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-watchdog


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git