All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers: watchdog: wdt-uclass.c: add a property u-boot, noautostart
@ 2022-02-10 17:17 Philippe Reynes
  2022-02-26 18:37 ` Simon Glass
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Philippe Reynes @ 2022-02-10 17:17 UTC (permalink / raw)
  To: rasmus.villemoes, sjg; +Cc: u-boot, Philippe Reynes

Since commit 492ee6b8d0e7 ("watchdog: wdt-uclass.c: handle all DM
watchdogs in watchdog_reset()"), all the watchdog are started when
the config WATCHDOG_AUTOSTART.

To avoid a binary choice none/all, a property u-boot,noautostart
may be added in the watchdog node of the u-boot device tree to not
autostart this watchdog.

Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
---
 drivers/watchdog/wdt-uclass.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
index 6d0f473867..dbf556467d 100644
--- a/drivers/watchdog/wdt-uclass.c
+++ b/drivers/watchdog/wdt-uclass.c
@@ -36,6 +36,8 @@ struct wdt_priv {
 	ulong next_reset;
 	/* Whether watchdog_start() has been called on the device. */
 	bool running;
+	/* No autostart */
+	bool noautostart;
 };
 
 static void init_watchdog_dev(struct udevice *dev)
@@ -52,7 +54,7 @@ static void init_watchdog_dev(struct udevice *dev)
 			       dev->name);
 	}
 
-	if (!IS_ENABLED(CONFIG_WATCHDOG_AUTOSTART)) {
+	if (!IS_ENABLED(CONFIG_WATCHDOG_AUTOSTART) || priv->noautostart) {
 		printf("WDT:   Not starting %s\n", dev->name);
 		return;
 	}
@@ -256,16 +258,19 @@ static int wdt_pre_probe(struct udevice *dev)
 	 * indicated by a hw_margin_ms property.
 	 */
 	ulong reset_period = 1000;
+	bool noautostart = false;
 	struct wdt_priv *priv;
 
 	if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
 		timeout = dev_read_u32_default(dev, "timeout-sec", timeout);
 		reset_period = dev_read_u32_default(dev, "hw_margin_ms",
 						    4 * reset_period) / 4;
+		noautostart = dev_read_bool(dev, "u-boot,noautostart");
 	}
 	priv = dev_get_uclass_priv(dev);
 	priv->timeout = timeout;
 	priv->reset_period = reset_period;
+	priv->noautostart = noautostart;
 	/*
 	 * Pretend this device was last reset "long" ago so the first
 	 * watchdog_reset will actually call its ->reset method.
-- 
2.17.1


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

* Re: [PATCH] drivers: watchdog: wdt-uclass.c: add a property u-boot, noautostart
  2022-02-10 17:17 [PATCH] drivers: watchdog: wdt-uclass.c: add a property u-boot, noautostart Philippe Reynes
@ 2022-02-26 18:37 ` Simon Glass
  2022-03-08  8:08 ` Stefan Roese
  2022-03-08  9:09 ` Stefan Roese
  2 siblings, 0 replies; 4+ messages in thread
From: Simon Glass @ 2022-02-26 18:37 UTC (permalink / raw)
  To: Philippe Reynes; +Cc: Rasmus Villemoes, U-Boot Mailing List

On Thu, 10 Feb 2022 at 10:18, Philippe Reynes
<philippe.reynes@softathome.com> wrote:
>
> Since commit 492ee6b8d0e7 ("watchdog: wdt-uclass.c: handle all DM
> watchdogs in watchdog_reset()"), all the watchdog are started when
> the config WATCHDOG_AUTOSTART.
>
> To avoid a binary choice none/all, a property u-boot,noautostart
> may be added in the watchdog node of the u-boot device tree to not
> autostart this watchdog.
>
> Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>
> ---
>  drivers/watchdog/wdt-uclass.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

But please add to the binding file in U-Boot

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

* Re: [PATCH] drivers: watchdog: wdt-uclass.c: add a property u-boot, noautostart
  2022-02-10 17:17 [PATCH] drivers: watchdog: wdt-uclass.c: add a property u-boot, noautostart Philippe Reynes
  2022-02-26 18:37 ` Simon Glass
@ 2022-03-08  8:08 ` Stefan Roese
  2022-03-08  9:09 ` Stefan Roese
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2022-03-08  8:08 UTC (permalink / raw)
  To: Philippe Reynes, rasmus.villemoes, sjg; +Cc: u-boot

On 2/10/22 18:17, Philippe Reynes wrote:
> Since commit 492ee6b8d0e7 ("watchdog: wdt-uclass.c: handle all DM
> watchdogs in watchdog_reset()"), all the watchdog are started when
> the config WATCHDOG_AUTOSTART.
> 
> To avoid a binary choice none/all, a property u-boot,noautostart
> may be added in the watchdog node of the u-boot device tree to not
> autostart this watchdog.
> 
> Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

Reviewed-by: Stefan Roese <sr@denx.de>

Thanks,
Stefan

> ---
>   drivers/watchdog/wdt-uclass.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
> index 6d0f473867..dbf556467d 100644
> --- a/drivers/watchdog/wdt-uclass.c
> +++ b/drivers/watchdog/wdt-uclass.c
> @@ -36,6 +36,8 @@ struct wdt_priv {
>   	ulong next_reset;
>   	/* Whether watchdog_start() has been called on the device. */
>   	bool running;
> +	/* No autostart */
> +	bool noautostart;
>   };
>   
>   static void init_watchdog_dev(struct udevice *dev)
> @@ -52,7 +54,7 @@ static void init_watchdog_dev(struct udevice *dev)
>   			       dev->name);
>   	}
>   
> -	if (!IS_ENABLED(CONFIG_WATCHDOG_AUTOSTART)) {
> +	if (!IS_ENABLED(CONFIG_WATCHDOG_AUTOSTART) || priv->noautostart) {
>   		printf("WDT:   Not starting %s\n", dev->name);
>   		return;
>   	}
> @@ -256,16 +258,19 @@ static int wdt_pre_probe(struct udevice *dev)
>   	 * indicated by a hw_margin_ms property.
>   	 */
>   	ulong reset_period = 1000;
> +	bool noautostart = false;
>   	struct wdt_priv *priv;
>   
>   	if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
>   		timeout = dev_read_u32_default(dev, "timeout-sec", timeout);
>   		reset_period = dev_read_u32_default(dev, "hw_margin_ms",
>   						    4 * reset_period) / 4;
> +		noautostart = dev_read_bool(dev, "u-boot,noautostart");
>   	}
>   	priv = dev_get_uclass_priv(dev);
>   	priv->timeout = timeout;
>   	priv->reset_period = reset_period;
> +	priv->noautostart = noautostart;
>   	/*
>   	 * Pretend this device was last reset "long" ago so the first
>   	 * watchdog_reset will actually call its ->reset method.

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

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

* Re: [PATCH] drivers: watchdog: wdt-uclass.c: add a property u-boot, noautostart
  2022-02-10 17:17 [PATCH] drivers: watchdog: wdt-uclass.c: add a property u-boot, noautostart Philippe Reynes
  2022-02-26 18:37 ` Simon Glass
  2022-03-08  8:08 ` Stefan Roese
@ 2022-03-08  9:09 ` Stefan Roese
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2022-03-08  9:09 UTC (permalink / raw)
  To: Philippe Reynes, rasmus.villemoes, sjg; +Cc: u-boot

On 2/10/22 18:17, Philippe Reynes wrote:
> Since commit 492ee6b8d0e7 ("watchdog: wdt-uclass.c: handle all DM
> watchdogs in watchdog_reset()"), all the watchdog are started when
> the config WATCHDOG_AUTOSTART.
> 
> To avoid a binary choice none/all, a property u-boot,noautostart
> may be added in the watchdog node of the u-boot device tree to not
> autostart this watchdog.
> 
> Signed-off-by: Philippe Reynes <philippe.reynes@softathome.com>

Applied to u-boot-watchdog/master

Thanks,
Stefan

> ---
>   drivers/watchdog/wdt-uclass.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/watchdog/wdt-uclass.c b/drivers/watchdog/wdt-uclass.c
> index 6d0f473867..dbf556467d 100644
> --- a/drivers/watchdog/wdt-uclass.c
> +++ b/drivers/watchdog/wdt-uclass.c
> @@ -36,6 +36,8 @@ struct wdt_priv {
>   	ulong next_reset;
>   	/* Whether watchdog_start() has been called on the device. */
>   	bool running;
> +	/* No autostart */
> +	bool noautostart;
>   };
>   
>   static void init_watchdog_dev(struct udevice *dev)
> @@ -52,7 +54,7 @@ static void init_watchdog_dev(struct udevice *dev)
>   			       dev->name);
>   	}
>   
> -	if (!IS_ENABLED(CONFIG_WATCHDOG_AUTOSTART)) {
> +	if (!IS_ENABLED(CONFIG_WATCHDOG_AUTOSTART) || priv->noautostart) {
>   		printf("WDT:   Not starting %s\n", dev->name);
>   		return;
>   	}
> @@ -256,16 +258,19 @@ static int wdt_pre_probe(struct udevice *dev)
>   	 * indicated by a hw_margin_ms property.
>   	 */
>   	ulong reset_period = 1000;
> +	bool noautostart = false;
>   	struct wdt_priv *priv;
>   
>   	if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) {
>   		timeout = dev_read_u32_default(dev, "timeout-sec", timeout);
>   		reset_period = dev_read_u32_default(dev, "hw_margin_ms",
>   						    4 * reset_period) / 4;
> +		noautostart = dev_read_bool(dev, "u-boot,noautostart");
>   	}
>   	priv = dev_get_uclass_priv(dev);
>   	priv->timeout = timeout;
>   	priv->reset_period = reset_period;
> +	priv->noautostart = noautostart;
>   	/*
>   	 * Pretend this device was last reset "long" ago so the first
>   	 * watchdog_reset will actually call its ->reset method.

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

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

end of thread, other threads:[~2022-03-08  9:09 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10 17:17 [PATCH] drivers: watchdog: wdt-uclass.c: add a property u-boot, noautostart Philippe Reynes
2022-02-26 18:37 ` Simon Glass
2022-03-08  8:08 ` Stefan Roese
2022-03-08  9:09 ` Stefan Roese

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.