[PATCH v2] wdt: nuvoton: fix reset/expire function error

fix npcm845 watchdog halt for reset function and expire function. reset function is restart wdt.
Signed-off-by: Jim Liu JJLIU0@nuvoton.com
Changes for v2: - add commit message - fix no empty line problem - remove dts --- drivers/watchdog/npcm_wdt.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c index e56aa0ebe1..22d7fc45dd 100644 --- a/drivers/watchdog/npcm_wdt.c +++ b/drivers/watchdog/npcm_wdt.c @@ -70,14 +70,21 @@ static int npcm_wdt_reset(struct udevice *dev) { struct npcm_wdt_priv *priv = dev_get_priv(dev);
- writel(NPCM_WTR | NPCM_WTRE | NPCM_WTE, priv->regs); + u32 val; + + val = readl(priv->regs); + writel(val | NPCM_WTR, priv->regs);
return 0; }
static int npcm_wdt_expire_now(struct udevice *dev, ulong flags) { - return npcm_wdt_reset(dev); + struct npcm_wdt_priv *priv = dev_get_priv(dev); + + writel(NPCM_WTR | NPCM_WTRE | NPCM_WTE, priv->regs); + + return 0; }
static int npcm_wdt_of_to_plat(struct udevice *dev)

On 10/3/23 10:40, Jim Liu wrote:
fix npcm845 watchdog halt for reset function and expire function. reset function is restart wdt.
Please start sentences with an uppercase word.
Signed-off-by: Jim Liu JJLIU0@nuvoton.com
Changes for v2: - add commit message - fix no empty line problem - remove dts
drivers/watchdog/npcm_wdt.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/watchdog/npcm_wdt.c b/drivers/watchdog/npcm_wdt.c index e56aa0ebe1..22d7fc45dd 100644 --- a/drivers/watchdog/npcm_wdt.c +++ b/drivers/watchdog/npcm_wdt.c @@ -70,14 +70,21 @@ static int npcm_wdt_reset(struct udevice *dev) { struct npcm_wdt_priv *priv = dev_get_priv(dev);
- writel(NPCM_WTR | NPCM_WTRE | NPCM_WTE, priv->regs);
- u32 val;
Now you have an empty line before this variable declaration line. Please remove the empty line in v3.
Thanks, Stefan
val = readl(priv->regs);
writel(val | NPCM_WTR, priv->regs);
return 0; }
static int npcm_wdt_expire_now(struct udevice *dev, ulong flags) {
- return npcm_wdt_reset(dev);
struct npcm_wdt_priv *priv = dev_get_priv(dev);
writel(NPCM_WTR | NPCM_WTRE | NPCM_WTE, priv->regs);
return 0; }
static int npcm_wdt_of_to_plat(struct udevice *dev)
Viele Grüße, Stefan Roese
participants (2)
-
Jim Liu
-
Stefan Roese