mbox series

[v3,0/2] watchdog: sp805: add reset control support

Message ID 20240221-hisi-wdt-v3-0-9642613dc2e6@outlook.com
Headers show
Series watchdog: sp805: add reset control support | expand

Message

Yang Xiwen via B4 Relay Feb. 21, 2024, 11:56 a.m. UTC
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,

Comments

Philipp Zabel Feb. 21, 2024, 12:28 p.m. UTC | #1
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
Guenter Roeck Feb. 21, 2024, 12:55 p.m. UTC | #2
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
>