* [PATCH v4, 1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function
@ 2021-05-11 7:35 Meng.Li at windriver.com
2021-05-11 7:35 ` [PATCH v4,2/2] driver: watchdog: enable wdt command by default Meng.Li at windriver.com
2021-05-22 12:08 ` [PATCH v4,1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function Stefan Roese
0 siblings, 2 replies; 4+ messages in thread
From: Meng.Li at windriver.com @ 2021-05-11 7:35 UTC (permalink / raw)
To: u-boot
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 at 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>
---
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 | 31 +++++++++++++++++++++----------
1 file changed, 21 insertions(+), 10 deletions(-)
diff --git a/drivers/watchdog/designware_wdt.c b/drivers/watchdog/designware_wdt.c
index 12f09a7a39..cdf6b5709b 100644
--- a/drivers/watchdog/designware_wdt.c
+++ b/drivers/watchdog/designware_wdt.c
@@ -23,6 +23,7 @@
struct designware_wdt_priv {
void __iomem *base;
unsigned int clk_khz;
+ struct reset_ctl_bulk *resets;
};
/*
@@ -96,6 +97,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 +143,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] 4+ messages in thread* [PATCH v4,2/2] driver: watchdog: enable wdt command by default
2021-05-11 7:35 [PATCH v4, 1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function Meng.Li at windriver.com
@ 2021-05-11 7:35 ` Meng.Li at windriver.com
2021-05-22 12:10 ` Stefan Roese
2021-05-22 12:08 ` [PATCH v4,1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function Stefan Roese
1 sibling, 1 reply; 4+ messages in thread
From: Meng.Li at windriver.com @ 2021-05-11 7:35 UTC (permalink / raw)
To: u-boot
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>
---
configs/socfpga_stratix10_defconfig | 1 +
1 file changed, 1 insertion(+)
diff --git a/configs/socfpga_stratix10_defconfig b/configs/socfpga_stratix10_defconfig
index 02d4ac0dae..0256afe511 100644
--- a/configs/socfpga_stratix10_defconfig
+++ b/configs/socfpga_stratix10_defconfig
@@ -40,6 +40,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] 4+ messages in thread
* Re: [PATCH v4,2/2] driver: watchdog: enable wdt command by default
2021-05-11 7:35 ` [PATCH v4,2/2] driver: watchdog: enable wdt command by default Meng.Li at windriver.com
@ 2021-05-22 12:10 ` Stefan Roese
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2021-05-22 12:10 UTC (permalink / raw)
To: Meng.Li, u-boot, chin.liang.see, dinh.nguyen, sjg; +Cc: sean.anderson
On 11.05.21 09:35, 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>
> ---
> configs/socfpga_stratix10_defconfig | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/configs/socfpga_stratix10_defconfig b/configs/socfpga_stratix10_defconfig
> index 02d4ac0dae..0256afe511 100644
> --- a/configs/socfpga_stratix10_defconfig
> +++ b/configs/socfpga_stratix10_defconfig
> @@ -40,6 +40,7 @@ CONFIG_CMD_CACHE=y
> CONFIG_CMD_EXT4=y
> CONFIG_CMD_FAT=y
> CONFIG_CMD_FS_GENERIC=y
> +CONFIG_CMD_WDT=y
This patch is not really a "watchdog" patch. Please change the commit
subject line to something like this:
arm: socfpga: socfpga_stratix10: Enable watchdog command
Thanks,
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v4,1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function
2021-05-11 7:35 [PATCH v4, 1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function Meng.Li at windriver.com
2021-05-11 7:35 ` [PATCH v4,2/2] driver: watchdog: enable wdt command by default Meng.Li at windriver.com
@ 2021-05-22 12:08 ` Stefan Roese
1 sibling, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2021-05-22 12:08 UTC (permalink / raw)
To: Meng.Li, u-boot, chin.liang.see, dinh.nguyen, sjg; +Cc: sean.anderson
On 11.05.21 09:35, 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>
>
> ---
> 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 | 31 +++++++++++++++++++++----------
> 1 file changed, 21 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/watchdog/designware_wdt.c b/drivers/watchdog/designware_wdt.c
> index 12f09a7a39..cdf6b5709b 100644
> --- a/drivers/watchdog/designware_wdt.c
> +++ b/drivers/watchdog/designware_wdt.c
> @@ -23,6 +23,7 @@
> struct designware_wdt_priv {
> void __iomem *base;
> unsigned int clk_khz;
> + struct reset_ctl_bulk *resets;
> };
>
> /*
> @@ -96,6 +97,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 +143,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);
Please see the double open "(" and the single closing ")" above!
Did you ever at least build-test this? Please send a fixed and also
*tested* v5.
Thanks,
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-22 12:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-11 7:35 [PATCH v4, 1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function Meng.Li at windriver.com
2021-05-11 7:35 ` [PATCH v4,2/2] driver: watchdog: enable wdt command by default Meng.Li at windriver.com
2021-05-22 12:10 ` Stefan Roese
2021-05-22 12:08 ` [PATCH v4,1/2] driver: watchdog: reset watchdog in designware_wdt_stop() function Stefan Roese
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox