All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5, 1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function
@ 2021-05-24  2:22 Meng.Li
  2021-05-24  2:22 ` [PATCH v5, 2/2] arm: socfpga: socfpga_stratix10: enable wdt command by default Meng.Li
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Meng.Li @ 2021-05-24  2:22 UTC (permalink / raw)
  To: u-boot, chin.liang.see, dinh.nguyen, sjg; +Cc: sr, sean.anderson, meng.li

From: MengLi <meng.li@windriver.com>

In uboot command line environment, watchdog is not able to be
stopped with below commands:
SOCFPGA_STRATIX10 # wdt dev watchdog@ffd00200
SOCFPGA_STRATIX10 # wdt stop
Refer to watchdog driver in linux kernel, it is also need to reset
watchdog after disable it so that the disable action takes effect.

Signed-off-by: Meng Li <Meng.Li@windriver.com>
Reviewed-by: Stefan Roese <sr@denx.de>

---
v5:
fix build issue, and verify this patch with latest upstream u-boot.
v4:
Remove the unauthorized signature.
v3:
Add the resets to designware_wdt_priv and initialize it in probe().
v2:
Change "#if CONFIG_IS_ENABLED(DM_RESET)" into
"if (CONFIG_IS_ENABLED(DM_RESET)) {", and define the variable
into if condition sentence.
---
 drivers/watchdog/designware_wdt.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/watchdog/designware_wdt.c b/drivers/watchdog/designware_wdt.c
index 9e5487168c..afed81e6c6 100644
--- a/drivers/watchdog/designware_wdt.c
+++ b/drivers/watchdog/designware_wdt.c
@@ -22,6 +22,7 @@
 struct designware_wdt_priv {
 	void __iomem	*base;
 	unsigned int	clk_khz;
+	struct reset_ctl_bulk *resets;
 };
 
 /*
@@ -95,6 +96,18 @@ static int designware_wdt_stop(struct udevice *dev)
 	designware_wdt_reset(dev);
 	writel(0, priv->base + DW_WDT_CR);
 
+        if (CONFIG_IS_ENABLED(DM_RESET)) {
+		int ret;
+
+		ret = reset_assert_bulk(priv->resets);
+		if (ret)
+			return ret;
+
+		ret = reset_deassert_bulk(priv->resets);
+		if (ret)
+			return ret;
+	}
+
 	return 0;
 }
 
@@ -143,13 +156,11 @@ static int designware_wdt_probe(struct udevice *dev)
 #endif
 
 	if (CONFIG_IS_ENABLED(DM_RESET)) {
-		struct reset_ctl_bulk resets;
-
-		ret = reset_get_bulk(dev, &resets);
+		ret = reset_get_bulk(dev, priv->resets);
 		if (ret)
 			goto err;
 
-		ret = reset_deassert_bulk(&resets);
+		ret = reset_deassert_bulk(priv->resets);
 		if (ret)
 			goto err;
 	}
-- 
2.17.1


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

* [PATCH v5, 2/2] arm: socfpga: socfpga_stratix10: enable wdt command by default
  2021-05-24  2:22 [PATCH v5, 1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function Meng.Li
@ 2021-05-24  2:22 ` Meng.Li
  2021-07-16 10:17   ` [PATCH v5,2/2] " Stefan Roese
  2021-05-24 16:07 ` [PATCH v5,1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function Sean Anderson
  2021-07-16 10:16 ` Stefan Roese
  2 siblings, 1 reply; 5+ messages in thread
From: Meng.Li @ 2021-05-24  2:22 UTC (permalink / raw)
  To: u-boot, chin.liang.see, dinh.nguyen, sjg; +Cc: sr, sean.anderson, meng.li

From: MengLi <meng.li@windriver.com>

In latest u-boot code, watchdog feature is implemented, so enable
wdt command by default.

Signed-off-by: Meng Li <Meng.Li@windriver.com>

---
v2:
Change the title of this patch
---
 configs/socfpga_stratix10_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/socfpga_stratix10_defconfig b/configs/socfpga_stratix10_defconfig
index da8bf986cd..7c6ee3c001 100644
--- a/configs/socfpga_stratix10_defconfig
+++ b/configs/socfpga_stratix10_defconfig
@@ -39,6 +39,7 @@ CONFIG_CMD_CACHE=y
 CONFIG_CMD_EXT4=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_FS_GENERIC=y
+CONFIG_CMD_WDT=y
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
-- 
2.17.1


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

* Re: [PATCH v5,1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function
  2021-05-24  2:22 [PATCH v5, 1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function Meng.Li
  2021-05-24  2:22 ` [PATCH v5, 2/2] arm: socfpga: socfpga_stratix10: enable wdt command by default Meng.Li
@ 2021-05-24 16:07 ` Sean Anderson
  2021-07-16 10:16 ` Stefan Roese
  2 siblings, 0 replies; 5+ messages in thread
From: Sean Anderson @ 2021-05-24 16:07 UTC (permalink / raw)
  To: Meng.Li, u-boot, chin.liang.see, dinh.nguyen, sjg; +Cc: sr



On 5/23/21 10:22 PM, Meng.Li@windriver.com wrote:
> From: MengLi <meng.li@windriver.com>
> 
> In uboot command line environment, watchdog is not able to be
> stopped with below commands:
> SOCFPGA_STRATIX10 # wdt dev watchdog@ffd00200
> SOCFPGA_STRATIX10 # wdt stop
> Refer to watchdog driver in linux kernel, it is also need to reset
> watchdog after disable it so that the disable action takes effect.
> 
> Signed-off-by: Meng Li <Meng.Li@windriver.com>
> Reviewed-by: Stefan Roese <sr@denx.de>
> 
> ---
> v5:
> fix build issue, and verify this patch with latest upstream u-boot.
> v4:
> Remove the unauthorized signature.
> v3:
> Add the resets to designware_wdt_priv and initialize it in probe().
> v2:
> Change "#if CONFIG_IS_ENABLED(DM_RESET)" into
> "if (CONFIG_IS_ENABLED(DM_RESET)) {", and define the variable
> into if condition sentence.
> ---
>   drivers/watchdog/designware_wdt.c | 19 +++++++++++++++----
>   1 file changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/designware_wdt.c b/drivers/watchdog/designware_wdt.c
> index 9e5487168c..afed81e6c6 100644
> --- a/drivers/watchdog/designware_wdt.c
> +++ b/drivers/watchdog/designware_wdt.c
> @@ -22,6 +22,7 @@
>   struct designware_wdt_priv {
>   	void __iomem	*base;
>   	unsigned int	clk_khz;
> +	struct reset_ctl_bulk *resets;
>   };
>   
>   /*
> @@ -95,6 +96,18 @@ static int designware_wdt_stop(struct udevice *dev)
>   	designware_wdt_reset(dev);
>   	writel(0, priv->base + DW_WDT_CR);
>   
> +        if (CONFIG_IS_ENABLED(DM_RESET)) {
> +		int ret;
> +
> +		ret = reset_assert_bulk(priv->resets);
> +		if (ret)
> +			return ret;
> +
> +		ret = reset_deassert_bulk(priv->resets);
> +		if (ret)
> +			return ret;
> +	}
> +
>   	return 0;
>   }
>   
> @@ -143,13 +156,11 @@ static int designware_wdt_probe(struct udevice *dev)
>   #endif
>   
>   	if (CONFIG_IS_ENABLED(DM_RESET)) {
> -		struct reset_ctl_bulk resets;
> -
> -		ret = reset_get_bulk(dev, &resets);
> +		ret = reset_get_bulk(dev, priv->resets);
>   		if (ret)
>   			goto err;
>   
> -		ret = reset_deassert_bulk(&resets);
> +		ret = reset_deassert_bulk(priv->resets);
>   		if (ret)
>   			goto err;
>   	}
> 

Reviewed-by: Sean Anderson <sean.anderson@seco.com>

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

* Re: [PATCH v5,1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function
  2021-05-24  2:22 [PATCH v5, 1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function Meng.Li
  2021-05-24  2:22 ` [PATCH v5, 2/2] arm: socfpga: socfpga_stratix10: enable wdt command by default Meng.Li
  2021-05-24 16:07 ` [PATCH v5,1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function Sean Anderson
@ 2021-07-16 10:16 ` Stefan Roese
  2 siblings, 0 replies; 5+ messages in thread
From: Stefan Roese @ 2021-07-16 10:16 UTC (permalink / raw)
  To: Meng.Li, u-boot, chin.liang.see, dinh.nguyen, sjg; +Cc: sean.anderson

On 24.05.21 04:22, Meng.Li@windriver.com wrote:
> From: MengLi <meng.li@windriver.com>
> 
> In uboot command line environment, watchdog is not able to be
> stopped with below commands:
> SOCFPGA_STRATIX10 # wdt dev watchdog@ffd00200
> SOCFPGA_STRATIX10 # wdt stop
> Refer to watchdog driver in linux kernel, it is also need to reset
> watchdog after disable it so that the disable action takes effect.
> 
> Signed-off-by: Meng Li <Meng.Li@windriver.com>
> Reviewed-by: Stefan Roese <sr@denx.de>

Applied to u-boot-marvell/master

Thanks,
Stefan

> ---
> v5:
> fix build issue, and verify this patch with latest upstream u-boot.
> v4:
> Remove the unauthorized signature.
> v3:
> Add the resets to designware_wdt_priv and initialize it in probe().
> v2:
> Change "#if CONFIG_IS_ENABLED(DM_RESET)" into
> "if (CONFIG_IS_ENABLED(DM_RESET)) {", and define the variable
> into if condition sentence.
> ---
>   drivers/watchdog/designware_wdt.c | 19 +++++++++++++++----
>   1 file changed, 15 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/watchdog/designware_wdt.c b/drivers/watchdog/designware_wdt.c
> index 9e5487168c..afed81e6c6 100644
> --- a/drivers/watchdog/designware_wdt.c
> +++ b/drivers/watchdog/designware_wdt.c
> @@ -22,6 +22,7 @@
>   struct designware_wdt_priv {
>   	void __iomem	*base;
>   	unsigned int	clk_khz;
> +	struct reset_ctl_bulk *resets;
>   };
>   
>   /*
> @@ -95,6 +96,18 @@ static int designware_wdt_stop(struct udevice *dev)
>   	designware_wdt_reset(dev);
>   	writel(0, priv->base + DW_WDT_CR);
>   
> +        if (CONFIG_IS_ENABLED(DM_RESET)) {
> +		int ret;
> +
> +		ret = reset_assert_bulk(priv->resets);
> +		if (ret)
> +			return ret;
> +
> +		ret = reset_deassert_bulk(priv->resets);
> +		if (ret)
> +			return ret;
> +	}
> +
>   	return 0;
>   }
>   
> @@ -143,13 +156,11 @@ static int designware_wdt_probe(struct udevice *dev)
>   #endif
>   
>   	if (CONFIG_IS_ENABLED(DM_RESET)) {
> -		struct reset_ctl_bulk resets;
> -
> -		ret = reset_get_bulk(dev, &resets);
> +		ret = reset_get_bulk(dev, priv->resets);
>   		if (ret)
>   			goto err;
>   
> -		ret = reset_deassert_bulk(&resets);
> +		ret = reset_deassert_bulk(priv->resets);
>   		if (ret)
>   			goto err;
>   	}
> 


Viele Grüße,
Stefan

-- 
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] 5+ messages in thread

* Re: [PATCH v5,2/2] arm: socfpga: socfpga_stratix10: enable wdt command by default
  2021-05-24  2:22 ` [PATCH v5, 2/2] arm: socfpga: socfpga_stratix10: enable wdt command by default Meng.Li
@ 2021-07-16 10:17   ` Stefan Roese
  0 siblings, 0 replies; 5+ messages in thread
From: Stefan Roese @ 2021-07-16 10:17 UTC (permalink / raw)
  To: Meng.Li, u-boot, chin.liang.see, dinh.nguyen, sjg; +Cc: sean.anderson

On 24.05.21 04:22, Meng.Li@windriver.com wrote:
> From: MengLi <meng.li@windriver.com>
> 
> In latest u-boot code, watchdog feature is implemented, so enable
> wdt command by default.
> 
> Signed-off-by: Meng Li <Meng.Li@windriver.com>

Applied to u-boot-marvell/master

Thanks,
Stefan
> ---
> v2:
> Change the title of this patch
> ---
>   configs/socfpga_stratix10_defconfig | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/configs/socfpga_stratix10_defconfig b/configs/socfpga_stratix10_defconfig
> index da8bf986cd..7c6ee3c001 100644
> --- a/configs/socfpga_stratix10_defconfig
> +++ b/configs/socfpga_stratix10_defconfig
> @@ -39,6 +39,7 @@ CONFIG_CMD_CACHE=y
>   CONFIG_CMD_EXT4=y
>   CONFIG_CMD_FAT=y
>   CONFIG_CMD_FS_GENERIC=y
> +CONFIG_CMD_WDT=y
>   CONFIG_ENV_IS_IN_MMC=y
>   CONFIG_SYS_RELOC_GD_ENV_ADDR=y
>   CONFIG_NET_RANDOM_ETHADDR=y
> 


Viele Grüße,
Stefan

-- 
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] 5+ messages in thread

end of thread, other threads:[~2021-07-16 10:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24  2:22 [PATCH v5, 1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function Meng.Li
2021-05-24  2:22 ` [PATCH v5, 2/2] arm: socfpga: socfpga_stratix10: enable wdt command by default Meng.Li
2021-07-16 10:17   ` [PATCH v5,2/2] " Stefan Roese
2021-05-24 16:07 ` [PATCH v5,1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function Sean Anderson
2021-07-16 10:16 ` 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.