Linux-Watchdog Archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] watchdog: sp805: add reset control support
@ 2024-02-21 11:56 Yang Xiwen via B4 Relay
  2024-02-21 11:56 ` [PATCH v3 1/2] watchdog: sp805_wdt: deassert the reset if available Yang Xiwen via B4 Relay
  2024-02-21 11:56 ` [PATCH v3 2/2] dt-bindings: watchdog: arm,sp805: document the reset signal Yang Xiwen via B4 Relay
  0 siblings, 2 replies; 6+ messages in thread
From: Yang Xiwen via B4 Relay @ 2024-02-21 11:56 UTC (permalink / raw
  To: Wim Van Sebroeck, Guenter Roeck, Philipp Zabel, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Viresh Kumar
  Cc: linux-watchdog, linux-kernel, devicetree, Yang Xiwen,
	Krzysztof Kozlowski

Deassert the reset if it's available.

Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
---
Changes in v3:
- move reset to local variable, get reset exclusively (Philipp Zabel)
- Link to v2: https://lore.kernel.org/r/20240220-hisi-wdt-v2-0-63edc4965b4c@outlook.com

Changes in v2:
- commit log: dt-binding->dt-bindings (Krzysztof Kozlowski)
- binding: remove "|", join two lines. (Krzysztof Kozlowski)
- Link to v1: https://lore.kernel.org/r/20240217-hisi-wdt-v1-0-cdb9ddcab968@outlook.com

---
Yang Xiwen (2):
      watchdog: sp805_wdt: deassert the reset if available
      dt-bindings: watchdog: arm,sp805: document the reset signal

 Documentation/devicetree/bindings/watchdog/arm,sp805.yaml | 5 +++++
 drivers/watchdog/sp805_wdt.c                              | 8 ++++++++
 2 files changed, 13 insertions(+)
---
base-commit: 8d3dea210042f54b952b481838c1e7dfc4ec751d
change-id: 20240217-hisi-wdt-3b52971a6591

Best regards,
-- 
Yang Xiwen <forbidden405@outlook.com>


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

* [PATCH v3 1/2] watchdog: sp805_wdt: deassert the reset if available
  2024-02-21 11:56 [PATCH v3 0/2] watchdog: sp805: add reset control support Yang Xiwen via B4 Relay
@ 2024-02-21 11:56 ` Yang Xiwen via B4 Relay
  2024-02-21 12:28   ` Philipp Zabel
  2024-02-21 12:55   ` Guenter Roeck
  2024-02-21 11:56 ` [PATCH v3 2/2] dt-bindings: watchdog: arm,sp805: document the reset signal Yang Xiwen via B4 Relay
  1 sibling, 2 replies; 6+ messages in thread
From: Yang Xiwen via B4 Relay @ 2024-02-21 11:56 UTC (permalink / raw
  To: Wim Van Sebroeck, Guenter Roeck, Philipp Zabel, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Viresh Kumar
  Cc: linux-watchdog, linux-kernel, devicetree, Yang Xiwen

From: Yang Xiwen <forbidden405@outlook.com>

According to the datasheet, the core has an WDOGRESn input signal that
needs to be deasserted before being operational. Implement it in the
driver.

Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
---
 drivers/watchdog/sp805_wdt.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
index 2756ed54ca3d..109e2e37e8f0 100644
--- a/drivers/watchdog/sp805_wdt.c
+++ b/drivers/watchdog/sp805_wdt.c
@@ -25,6 +25,7 @@
 #include <linux/moduleparam.h>
 #include <linux/pm.h>
 #include <linux/property.h>
+#include <linux/reset.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/types.h>
@@ -232,6 +233,7 @@ static int
 sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id)
 {
 	struct sp805_wdt *wdt;
+	struct reset_control *rst;
 	u64 rate = 0;
 	int ret = 0;
 
@@ -264,6 +266,12 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id)
 		return -ENODEV;
 	}
 
+	rst = devm_reset_control_get_optional_exclusive(&adev->dev, NULL);
+	if (IS_ERR(rst))
+		return dev_err_probe(&adev->dev, PTR_ERR(rst), "Can not get reset\n");
+
+	reset_control_deassert(rst);
+
 	wdt->adev = adev;
 	wdt->wdd.info = &wdt_info;
 	wdt->wdd.ops = &wdt_ops;

-- 
2.43.0


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

* [PATCH v3 2/2] dt-bindings: watchdog: arm,sp805: document the reset signal
  2024-02-21 11:56 [PATCH v3 0/2] watchdog: sp805: add reset control support Yang Xiwen via B4 Relay
  2024-02-21 11:56 ` [PATCH v3 1/2] watchdog: sp805_wdt: deassert the reset if available Yang Xiwen via B4 Relay
@ 2024-02-21 11:56 ` Yang Xiwen via B4 Relay
  2024-02-21 12:55   ` Guenter Roeck
  1 sibling, 1 reply; 6+ messages in thread
From: Yang Xiwen via B4 Relay @ 2024-02-21 11:56 UTC (permalink / raw
  To: Wim Van Sebroeck, Guenter Roeck, Philipp Zabel, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Viresh Kumar
  Cc: linux-watchdog, linux-kernel, devicetree, Yang Xiwen,
	Krzysztof Kozlowski

From: Yang Xiwen <forbidden405@outlook.com>

The reset signal needs to be deasserted before operation of sp805
module. Document in the binding.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
---
 Documentation/devicetree/bindings/watchdog/arm,sp805.yaml | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/Documentation/devicetree/bindings/watchdog/arm,sp805.yaml b/Documentation/devicetree/bindings/watchdog/arm,sp805.yaml
index 7aea255b301b..bd7c09ed1938 100644
--- a/Documentation/devicetree/bindings/watchdog/arm,sp805.yaml
+++ b/Documentation/devicetree/bindings/watchdog/arm,sp805.yaml
@@ -50,6 +50,10 @@ properties:
       - const: wdog_clk
       - const: apb_pclk
 
+  resets:
+    maxItems: 1
+    description: WDOGRESn input reset signal for sp805 module.
+
 required:
   - compatible
   - reg
@@ -67,4 +71,5 @@ examples:
         interrupts = <GIC_SPI 406 IRQ_TYPE_LEVEL_HIGH>;
         clocks = <&wdt_clk>, <&apb_pclk>;
         clock-names = "wdog_clk", "apb_pclk";
+        resets = <&wdt_rst>;
     };

-- 
2.43.0


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

* Re: [PATCH v3 1/2] watchdog: sp805_wdt: deassert the reset if available
  2024-02-21 11:56 ` [PATCH v3 1/2] watchdog: sp805_wdt: deassert the reset if available Yang Xiwen via B4 Relay
@ 2024-02-21 12:28   ` Philipp Zabel
  2024-02-21 12:55   ` Guenter Roeck
  1 sibling, 0 replies; 6+ messages in thread
From: Philipp Zabel @ 2024-02-21 12:28 UTC (permalink / raw
  To: forbidden405, Wim Van Sebroeck, Guenter Roeck, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Viresh Kumar
  Cc: linux-watchdog, linux-kernel, devicetree

On Mi, 2024-02-21 at 19:56 +0800, Yang Xiwen via B4 Relay wrote:
> From: Yang Xiwen <forbidden405@outlook.com>
> 
> According to the datasheet, the core has an WDOGRESn input signal that
> needs to be deasserted before being operational. Implement it in the
> driver.
> 
> Signed-off-by: Yang Xiwen <forbidden405@outlook.com>

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp

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

* Re: [PATCH v3 1/2] watchdog: sp805_wdt: deassert the reset if available
  2024-02-21 11:56 ` [PATCH v3 1/2] watchdog: sp805_wdt: deassert the reset if available Yang Xiwen via B4 Relay
  2024-02-21 12:28   ` Philipp Zabel
@ 2024-02-21 12:55   ` Guenter Roeck
  1 sibling, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2024-02-21 12:55 UTC (permalink / raw
  To: forbidden405
  Cc: Wim Van Sebroeck, Philipp Zabel, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Viresh Kumar, linux-watchdog, linux-kernel,
	devicetree

On Wed, Feb 21, 2024 at 07:56:41PM +0800, Yang Xiwen via B4 Relay wrote:
> From: Yang Xiwen <forbidden405@outlook.com>
> 
> According to the datasheet, the core has an WDOGRESn input signal that
> needs to be deasserted before being operational. Implement it in the
> driver.
> 
> Signed-off-by: Yang Xiwen <forbidden405@outlook.com>

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

> ---
>  drivers/watchdog/sp805_wdt.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/watchdog/sp805_wdt.c b/drivers/watchdog/sp805_wdt.c
> index 2756ed54ca3d..109e2e37e8f0 100644
> --- a/drivers/watchdog/sp805_wdt.c
> +++ b/drivers/watchdog/sp805_wdt.c
> @@ -25,6 +25,7 @@
>  #include <linux/moduleparam.h>
>  #include <linux/pm.h>
>  #include <linux/property.h>
> +#include <linux/reset.h>
>  #include <linux/slab.h>
>  #include <linux/spinlock.h>
>  #include <linux/types.h>
> @@ -232,6 +233,7 @@ static int
>  sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id)
>  {
>  	struct sp805_wdt *wdt;
> +	struct reset_control *rst;
>  	u64 rate = 0;
>  	int ret = 0;
>  
> @@ -264,6 +266,12 @@ sp805_wdt_probe(struct amba_device *adev, const struct amba_id *id)
>  		return -ENODEV;
>  	}
>  
> +	rst = devm_reset_control_get_optional_exclusive(&adev->dev, NULL);
> +	if (IS_ERR(rst))
> +		return dev_err_probe(&adev->dev, PTR_ERR(rst), "Can not get reset\n");
> +
> +	reset_control_deassert(rst);
> +
>  	wdt->adev = adev;
>  	wdt->wdd.info = &wdt_info;
>  	wdt->wdd.ops = &wdt_ops;
> 
> -- 
> 2.43.0
> 

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

* Re: [PATCH v3 2/2] dt-bindings: watchdog: arm,sp805: document the reset signal
  2024-02-21 11:56 ` [PATCH v3 2/2] dt-bindings: watchdog: arm,sp805: document the reset signal Yang Xiwen via B4 Relay
@ 2024-02-21 12:55   ` Guenter Roeck
  0 siblings, 0 replies; 6+ messages in thread
From: Guenter Roeck @ 2024-02-21 12:55 UTC (permalink / raw
  To: forbidden405
  Cc: Wim Van Sebroeck, Philipp Zabel, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Viresh Kumar, linux-watchdog, linux-kernel,
	devicetree, Krzysztof Kozlowski

On Wed, Feb 21, 2024 at 07:56:42PM +0800, Yang Xiwen via B4 Relay wrote:
> From: Yang Xiwen <forbidden405@outlook.com>
> 
> The reset signal needs to be deasserted before operation of sp805
> module. Document in the binding.
> 
> Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Signed-off-by: Yang Xiwen <forbidden405@outlook.com>

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

> ---
>  Documentation/devicetree/bindings/watchdog/arm,sp805.yaml | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/watchdog/arm,sp805.yaml b/Documentation/devicetree/bindings/watchdog/arm,sp805.yaml
> index 7aea255b301b..bd7c09ed1938 100644
> --- a/Documentation/devicetree/bindings/watchdog/arm,sp805.yaml
> +++ b/Documentation/devicetree/bindings/watchdog/arm,sp805.yaml
> @@ -50,6 +50,10 @@ properties:
>        - const: wdog_clk
>        - const: apb_pclk
>  
> +  resets:
> +    maxItems: 1
> +    description: WDOGRESn input reset signal for sp805 module.
> +
>  required:
>    - compatible
>    - reg
> @@ -67,4 +71,5 @@ examples:
>          interrupts = <GIC_SPI 406 IRQ_TYPE_LEVEL_HIGH>;
>          clocks = <&wdt_clk>, <&apb_pclk>;
>          clock-names = "wdog_clk", "apb_pclk";
> +        resets = <&wdt_rst>;
>      };
> 
> -- 
> 2.43.0
> 

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

end of thread, other threads:[~2024-02-21 12:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-21 11:56 [PATCH v3 0/2] watchdog: sp805: add reset control support Yang Xiwen via B4 Relay
2024-02-21 11:56 ` [PATCH v3 1/2] watchdog: sp805_wdt: deassert the reset if available Yang Xiwen via B4 Relay
2024-02-21 12:28   ` Philipp Zabel
2024-02-21 12:55   ` Guenter Roeck
2024-02-21 11:56 ` [PATCH v3 2/2] dt-bindings: watchdog: arm,sp805: document the reset signal Yang Xiwen via B4 Relay
2024-02-21 12:55   ` 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 read-only IMAP folder(s) and NNTP newsgroup(s).