devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] wdog: imx7ulp: Enable wdog int_en bit for watchdog any reset
@ 2023-10-10  8:19 Jacky Bai
  2023-10-10  8:19 ` [PATCH 2/3] dt-bindings: watchdog: fsl-imx7ulp-wdt: Add 'fsl,ext-reset-output' Jacky Bai
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Jacky Bai @ 2023-10-10  8:19 UTC (permalink / raw)
  To: wim, linux, robh+dt, krzysztof.kozlowski+dt, shawnguo
  Cc: s.hauer, kernel, festevam, linux-imx, linux-watchdog, devicetree

The wdog INT_EN bit in CS register should be set to '1' to trigger
WDOG_ANY external reset on i.MX93.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/watchdog/imx7ulp_wdt.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/watchdog/imx7ulp_wdt.c b/drivers/watchdog/imx7ulp_wdt.c
index c703586c6e5f..b21d7a74a42d 100644
--- a/drivers/watchdog/imx7ulp_wdt.c
+++ b/drivers/watchdog/imx7ulp_wdt.c
@@ -23,6 +23,7 @@
 #define LPO_CLK_SHIFT		8
 #define WDOG_CS_CLK		(LPO_CLK << LPO_CLK_SHIFT)
 #define WDOG_CS_EN		BIT(7)
+#define WDOG_CS_INT_EN		BIT(6)
 #define WDOG_CS_UPDATE		BIT(5)
 #define WDOG_CS_WAIT		BIT(1)
 #define WDOG_CS_STOP		BIT(0)
@@ -62,6 +63,7 @@ struct imx7ulp_wdt_device {
 	void __iomem *base;
 	struct clk *clk;
 	bool post_rcs_wait;
+	bool ext_reset;
 	const struct imx_wdt_hw_feature *hw;
 };
 
@@ -285,6 +287,9 @@ static int imx7ulp_wdt_init(struct imx7ulp_wdt_device *wdt, unsigned int timeout
 	if (wdt->hw->prescaler_enable)
 		val |= WDOG_CS_PRES;
 
+	if (wdt->ext_reset)
+		val |= WDOG_CS_INT_EN;
+
 	do {
 		ret = _imx7ulp_wdt_init(wdt, timeout, val);
 		toval = readl(wdt->base + WDOG_TOVAL);
@@ -321,6 +326,9 @@ static int imx7ulp_wdt_probe(struct platform_device *pdev)
 		return PTR_ERR(imx7ulp_wdt->clk);
 	}
 
+	/* The WDOG may need to do external reset through dedicated pin */
+	imx7ulp_wdt->ext_reset = of_property_read_bool(dev->of_node, "fsl,ext-reset-output");
+
 	imx7ulp_wdt->post_rcs_wait = true;
 	if (of_device_is_compatible(dev->of_node,
 				    "fsl,imx8ulp-wdt")) {
-- 
2.34.1


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

* [PATCH 2/3] dt-bindings: watchdog: fsl-imx7ulp-wdt: Add 'fsl,ext-reset-output'
  2023-10-10  8:19 [PATCH 1/3] wdog: imx7ulp: Enable wdog int_en bit for watchdog any reset Jacky Bai
@ 2023-10-10  8:19 ` Jacky Bai
  2023-10-10 18:10   ` Rob Herring
  2023-10-11 14:52   ` Guenter Roeck
  2023-10-10  8:19 ` [PATCH 3/3] arm64: dts: imx93: Add the 'fsl,ext-reset-output' property for wdog3 Jacky Bai
  2023-10-11 14:52 ` [PATCH 1/3] wdog: imx7ulp: Enable wdog int_en bit for watchdog any reset Guenter Roeck
  2 siblings, 2 replies; 7+ messages in thread
From: Jacky Bai @ 2023-10-10  8:19 UTC (permalink / raw)
  To: wim, linux, robh+dt, krzysztof.kozlowski+dt, shawnguo
  Cc: s.hauer, kernel, festevam, linux-imx, linux-watchdog, devicetree

The wdog may generate wdog_any external reset if the int_en bit is
configured, so add a property for this purpose in dt-binding doc.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
---
 .../devicetree/bindings/watchdog/fsl-imx7ulp-wdt.yaml        | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/watchdog/fsl-imx7ulp-wdt.yaml b/Documentation/devicetree/bindings/watchdog/fsl-imx7ulp-wdt.yaml
index 4b7ed1355701..9c50766bf690 100644
--- a/Documentation/devicetree/bindings/watchdog/fsl-imx7ulp-wdt.yaml
+++ b/Documentation/devicetree/bindings/watchdog/fsl-imx7ulp-wdt.yaml
@@ -30,6 +30,11 @@ properties:
   clocks:
     maxItems: 1
 
+  fsl,ext-reset-output:
+    description:
+      When set, wdog can generate external reset from the wdog_any pin.
+    type: boolean
+
 required:
   - compatible
   - interrupts
-- 
2.34.1


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

* [PATCH 3/3] arm64: dts: imx93: Add the 'fsl,ext-reset-output' property for wdog3
  2023-10-10  8:19 [PATCH 1/3] wdog: imx7ulp: Enable wdog int_en bit for watchdog any reset Jacky Bai
  2023-10-10  8:19 ` [PATCH 2/3] dt-bindings: watchdog: fsl-imx7ulp-wdt: Add 'fsl,ext-reset-output' Jacky Bai
@ 2023-10-10  8:19 ` Jacky Bai
  2023-11-26  9:11   ` Shawn Guo
  2023-10-11 14:52 ` [PATCH 1/3] wdog: imx7ulp: Enable wdog int_en bit for watchdog any reset Guenter Roeck
  2 siblings, 1 reply; 7+ messages in thread
From: Jacky Bai @ 2023-10-10  8:19 UTC (permalink / raw)
  To: wim, linux, robh+dt, krzysztof.kozlowski+dt, shawnguo
  Cc: s.hauer, kernel, festevam, linux-imx, linux-watchdog, devicetree

Add 'fsl,ext-reset-output' property for wdog3 to let it to trigger
external reset through wdog_any pin.

Signed-off-by: Jacky Bai <ping.bai@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
---
 arch/arm64/boot/dts/freescale/imx93.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm64/boot/dts/freescale/imx93.dtsi b/arch/arm64/boot/dts/freescale/imx93.dtsi
index f20dd18e0b65..bb40a022601d 100644
--- a/arch/arm64/boot/dts/freescale/imx93.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx93.dtsi
@@ -562,6 +562,7 @@ wdog3: watchdog@42490000 {
 				interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
 				clocks = <&clk IMX93_CLK_WDOG3_GATE>;
 				timeout-sec = <40>;
+				fsl,ext-reset-output;
 				status = "disabled";
 			};
 
-- 
2.34.1


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

* Re: [PATCH 2/3] dt-bindings: watchdog: fsl-imx7ulp-wdt: Add 'fsl,ext-reset-output'
  2023-10-10  8:19 ` [PATCH 2/3] dt-bindings: watchdog: fsl-imx7ulp-wdt: Add 'fsl,ext-reset-output' Jacky Bai
@ 2023-10-10 18:10   ` Rob Herring
  2023-10-11 14:52   ` Guenter Roeck
  1 sibling, 0 replies; 7+ messages in thread
From: Rob Herring @ 2023-10-10 18:10 UTC (permalink / raw)
  To: Jacky Bai
  Cc: devicetree, linux-watchdog, wim, robh+dt, krzysztof.kozlowski+dt,
	s.hauer, festevam, kernel, linux-imx, linux, shawnguo


On Tue, 10 Oct 2023 16:19:08 +0800, Jacky Bai wrote:
> The wdog may generate wdog_any external reset if the int_en bit is
> configured, so add a property for this purpose in dt-binding doc.
> 
> Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>
> ---
>  .../devicetree/bindings/watchdog/fsl-imx7ulp-wdt.yaml        | 5 +++++
>  1 file changed, 5 insertions(+)
> 

Acked-by: Rob Herring <robh@kernel.org>


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

* Re: [PATCH 1/3] wdog: imx7ulp: Enable wdog int_en bit for watchdog any reset
  2023-10-10  8:19 [PATCH 1/3] wdog: imx7ulp: Enable wdog int_en bit for watchdog any reset Jacky Bai
  2023-10-10  8:19 ` [PATCH 2/3] dt-bindings: watchdog: fsl-imx7ulp-wdt: Add 'fsl,ext-reset-output' Jacky Bai
  2023-10-10  8:19 ` [PATCH 3/3] arm64: dts: imx93: Add the 'fsl,ext-reset-output' property for wdog3 Jacky Bai
@ 2023-10-11 14:52 ` Guenter Roeck
  2 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2023-10-11 14:52 UTC (permalink / raw)
  To: Jacky Bai
  Cc: wim, robh+dt, krzysztof.kozlowski+dt, shawnguo, s.hauer, kernel,
	festevam, linux-imx, linux-watchdog, devicetree

On Tue, Oct 10, 2023 at 04:19:07PM +0800, Jacky Bai wrote:
> The wdog INT_EN bit in CS register should be set to '1' to trigger
> WDOG_ANY external reset on i.MX93.
> 
> Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>

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

> ---
>  drivers/watchdog/imx7ulp_wdt.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/watchdog/imx7ulp_wdt.c b/drivers/watchdog/imx7ulp_wdt.c
> index c703586c6e5f..b21d7a74a42d 100644
> --- a/drivers/watchdog/imx7ulp_wdt.c
> +++ b/drivers/watchdog/imx7ulp_wdt.c
> @@ -23,6 +23,7 @@
>  #define LPO_CLK_SHIFT		8
>  #define WDOG_CS_CLK		(LPO_CLK << LPO_CLK_SHIFT)
>  #define WDOG_CS_EN		BIT(7)
> +#define WDOG_CS_INT_EN		BIT(6)
>  #define WDOG_CS_UPDATE		BIT(5)
>  #define WDOG_CS_WAIT		BIT(1)
>  #define WDOG_CS_STOP		BIT(0)
> @@ -62,6 +63,7 @@ struct imx7ulp_wdt_device {
>  	void __iomem *base;
>  	struct clk *clk;
>  	bool post_rcs_wait;
> +	bool ext_reset;
>  	const struct imx_wdt_hw_feature *hw;
>  };
>  
> @@ -285,6 +287,9 @@ static int imx7ulp_wdt_init(struct imx7ulp_wdt_device *wdt, unsigned int timeout
>  	if (wdt->hw->prescaler_enable)
>  		val |= WDOG_CS_PRES;
>  
> +	if (wdt->ext_reset)
> +		val |= WDOG_CS_INT_EN;
> +
>  	do {
>  		ret = _imx7ulp_wdt_init(wdt, timeout, val);
>  		toval = readl(wdt->base + WDOG_TOVAL);
> @@ -321,6 +326,9 @@ static int imx7ulp_wdt_probe(struct platform_device *pdev)
>  		return PTR_ERR(imx7ulp_wdt->clk);
>  	}
>  
> +	/* The WDOG may need to do external reset through dedicated pin */
> +	imx7ulp_wdt->ext_reset = of_property_read_bool(dev->of_node, "fsl,ext-reset-output");
> +
>  	imx7ulp_wdt->post_rcs_wait = true;
>  	if (of_device_is_compatible(dev->of_node,
>  				    "fsl,imx8ulp-wdt")) {
> -- 
> 2.34.1
> 

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

* Re: [PATCH 2/3] dt-bindings: watchdog: fsl-imx7ulp-wdt: Add 'fsl,ext-reset-output'
  2023-10-10  8:19 ` [PATCH 2/3] dt-bindings: watchdog: fsl-imx7ulp-wdt: Add 'fsl,ext-reset-output' Jacky Bai
  2023-10-10 18:10   ` Rob Herring
@ 2023-10-11 14:52   ` Guenter Roeck
  1 sibling, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2023-10-11 14:52 UTC (permalink / raw)
  To: Jacky Bai
  Cc: wim, robh+dt, krzysztof.kozlowski+dt, shawnguo, s.hauer, kernel,
	festevam, linux-imx, linux-watchdog, devicetree

On Tue, Oct 10, 2023 at 04:19:08PM +0800, Jacky Bai wrote:
> The wdog may generate wdog_any external reset if the int_en bit is
> configured, so add a property for this purpose in dt-binding doc.
> 
> Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>

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

> ---
>  .../devicetree/bindings/watchdog/fsl-imx7ulp-wdt.yaml        | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/watchdog/fsl-imx7ulp-wdt.yaml b/Documentation/devicetree/bindings/watchdog/fsl-imx7ulp-wdt.yaml
> index 4b7ed1355701..9c50766bf690 100644
> --- a/Documentation/devicetree/bindings/watchdog/fsl-imx7ulp-wdt.yaml
> +++ b/Documentation/devicetree/bindings/watchdog/fsl-imx7ulp-wdt.yaml
> @@ -30,6 +30,11 @@ properties:
>    clocks:
>      maxItems: 1
>  
> +  fsl,ext-reset-output:
> +    description:
> +      When set, wdog can generate external reset from the wdog_any pin.
> +    type: boolean
> +
>  required:
>    - compatible
>    - interrupts
> -- 
> 2.34.1
> 

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

* Re: [PATCH 3/3] arm64: dts: imx93: Add the 'fsl,ext-reset-output' property for wdog3
  2023-10-10  8:19 ` [PATCH 3/3] arm64: dts: imx93: Add the 'fsl,ext-reset-output' property for wdog3 Jacky Bai
@ 2023-11-26  9:11   ` Shawn Guo
  0 siblings, 0 replies; 7+ messages in thread
From: Shawn Guo @ 2023-11-26  9:11 UTC (permalink / raw)
  To: Jacky Bai
  Cc: wim, linux, robh+dt, krzysztof.kozlowski+dt, s.hauer, kernel,
	festevam, linux-imx, linux-watchdog, devicetree

On Tue, Oct 10, 2023 at 04:19:09PM +0800, Jacky Bai wrote:
> Add 'fsl,ext-reset-output' property for wdog3 to let it to trigger
> external reset through wdog_any pin.
> 
> Signed-off-by: Jacky Bai <ping.bai@nxp.com>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>
> ---
>  arch/arm64/boot/dts/freescale/imx93.dtsi | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/arch/arm64/boot/dts/freescale/imx93.dtsi b/arch/arm64/boot/dts/freescale/imx93.dtsi
> index f20dd18e0b65..bb40a022601d 100644
> --- a/arch/arm64/boot/dts/freescale/imx93.dtsi
> +++ b/arch/arm64/boot/dts/freescale/imx93.dtsi
> @@ -562,6 +562,7 @@ wdog3: watchdog@42490000 {
>  				interrupts = <GIC_SPI 79 IRQ_TYPE_LEVEL_HIGH>;
>  				clocks = <&clk IMX93_CLK_WDOG3_GATE>;
>  				timeout-sec = <40>;
> +				fsl,ext-reset-output;

Shouldn't this be a board level setting?

Shawn

>  				status = "disabled";
>  			};
>  
> -- 
> 2.34.1
> 

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

end of thread, other threads:[~2023-11-26  9:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-10  8:19 [PATCH 1/3] wdog: imx7ulp: Enable wdog int_en bit for watchdog any reset Jacky Bai
2023-10-10  8:19 ` [PATCH 2/3] dt-bindings: watchdog: fsl-imx7ulp-wdt: Add 'fsl,ext-reset-output' Jacky Bai
2023-10-10 18:10   ` Rob Herring
2023-10-11 14:52   ` Guenter Roeck
2023-10-10  8:19 ` [PATCH 3/3] arm64: dts: imx93: Add the 'fsl,ext-reset-output' property for wdog3 Jacky Bai
2023-11-26  9:11   ` Shawn Guo
2023-10-11 14:52 ` [PATCH 1/3] wdog: imx7ulp: Enable wdog int_en bit for watchdog any reset Guenter Roeck

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