Skip to contentSkip to conversation

wdt: nuvoton: add expire function for generic reset

PATCH In review Jim Liu 2 participants 6 messages Sep 13, 2022 – Oct 24, 2022 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

Jim Liu

author
#0 lore raw

PATCH 1/1 wdt: nuvoton: add expire function for generic reset

Add expire_now function for generic sysreset request

---
 drivers/watchdog/npcm_wdt.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/watchdog/npcm_wdt.c +6 -0
index 256020f5d3..e56aa0ebe1 100644
@@ -75,6 +75,11 @@ static int npcm_wdt_reset(struct udevice *dev)
 	return 0;
 }
 
+static int npcm_wdt_expire_now(struct udevice *dev, ulong flags)
+{
+	return npcm_wdt_reset(dev);
+}
+
 static int npcm_wdt_of_to_plat(struct udevice *dev)
 {
 	struct npcm_wdt_priv *priv = dev_get_priv(dev);
@@ -87,6 +92,7 @@ static int npcm_wdt_of_to_plat(struct udevice *dev)
 }
 
 static const struct wdt_ops npcm_wdt_ops = {
+	.expire_now = npcm_wdt_expire_now,
 	.start = npcm_wdt_start,
 	.reset = npcm_wdt_reset,
 	.stop = npcm_wdt_stop,
Signature · 1 line
2.17.1
#1 lore raw
Quoted 12 lines · Jim Liu

Add expire_now function for generic sysreset request

---
  drivers/watchdog/npcm_wdt.c | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/watchdog/npcm_wdt.c +0 -0
index 256020f5d3..e56aa0ebe1 100644

drivers/watchdog/npcm_wdt.c static int npcm_wdt_reset(struct udevice *dev) · line 82

Quoted 8 lines
drivers/watchdog/npcm_wdt.c +5 -0
@@ -75,6 +75,11 @@ static int npcm_wdt_reset(struct udevice *dev)
  	return 0;
  }
 
+static int npcm_wdt_expire_now(struct udevice *dev, ulong flags)
+{
+	return npcm_wdt_reset(dev);
+}
+

Does this really work? You are calling the watchdog reset function here in the expire function, which will just reset / trigger the WDT. I would not expect that this will expire the WDT and result in a CPU / SoC reset.

Thanks,
Stefan

drivers/watchdog/npcm_wdt.c static int npcm_wdt_of_to_plat(struct udevice *dev) · line 98

Quoted 11 lines
drivers/watchdog/npcm_wdt.c +1 -0
  static int npcm_wdt_of_to_plat(struct udevice *dev)
  {
  	struct npcm_wdt_priv *priv = dev_get_priv(dev);
@@ -87,6 +92,7 @@ static int npcm_wdt_of_to_plat(struct udevice *dev)
  }
 
  static const struct wdt_ops npcm_wdt_ops = {
+	.expire_now = npcm_wdt_expire_now,
  	.start = npcm_wdt_start,
  	.reset = npcm_wdt_reset,
  	.stop = npcm_wdt_stop,

Viele Grüße,
Stefan Roese

Signature · 3 lines
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: [email protected]

A message that is not in the archive (sent off-list or not yet received): HK0PR03MB3010D4D530BA9CFAE115173482499@HK0PR03MB3010.apcprd03.prod.outlook.com

author
#3 lore raw

Hi Stefan Roese

Thanks for your review.
Here is my log from uboot master.
And i add the debug log as below:

-----------------------------------------------
U-Boot 2022.10-rc4-00038-ge3fce5e560-dirty (Sep 15 2022 - 09:58:25 +0800)

CPU: NPCM750 A1 @ Model: Nuvoton npcm750 Development Board (Device Tree)
DRAM:  464 MiB
RNG: NPCM RNG module bind OK
OTP: NPCM OTP module bind OK
AES: NPCM AES module bind OK
SHA: NPCM SHA module bind OK
Core:  210 devices, 22 uclasses, devicetree: separate
WDT:   Started watchdog@801C without servicing (60s timeout)
MMC:   sdhci0@f0842000: 0
Loading Environment from SPIFlash... SF: Detected mx66l51235l with
page size 256 Bytes, erase size 64 KiB, total 64 MiB
OK
In:    serial@1000
Out:   serial@1000
Err:   serial@1000
Net:   eth0: eth@f0802000, eth1: eth@f0825000
Hit any key to stop autoboot:  0

U-Boot>reset
resetting ...
jim[wdt_reboot_request]
jim[npcm_wdt_expire_now]
jim[npcm_wdt_reset]

Quoted 3 lines

================================================
BootBlock by Nuvoton Technology Corp. Ver 10.10.17
================================================

BB Basic
Mar 24 2021
12:06:08

Quoted 7 lines
CORSTC         = 0x4fff9f9d
WD0RCR         = 0x4fff9f9d
WD1RCR         = 0x4fff9f9d
WD2RCR         = 0x4fff9f9d
SWRSTC1        = 0x4fff9f9d
SWRSTC2        = 0x4fff9f9d
SWRSTC3        = 0x4fff9f9d

----------------------------------------------------

If you have any suggestions, please provide to me. I will follow to modify it.

Best regards,
Jim

Quoted 58 lines · On Thu, Sep 15, 2022 at 10:23 AM [email protected] <[email protected]> wrote:

-----Original Message-----
From: Stefan Roese <[email protected]>
Sent: Wednesday, September 14, 2022 2:27 PM
To: Jim Liu <[email protected]>; CS20 JJLiu0 <[email protected]>; CS20 YSChu <[email protected]>; CS20 KWLiu <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v1] wdt: nuvoton: add expire function for generic reset

Quoted 12 lines · Jim Liu

Add expire_now function for generic sysreset request

---
  drivers/watchdog/npcm_wdt.c | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/watchdog/npcm_wdt.c +0 -0
index 256020f5d3..e56aa0ebe1 100644

drivers/watchdog/npcm_wdt.c static int npcm_wdt_reset(struct udevice *dev) · line 81

Quoted 7 lines
drivers/watchdog/npcm_wdt.c +4 -0
@@ -75,6 +75,11 @@ static int npcm_wdt_reset(struct udevice *dev)
      return 0;
  }
 
+static int npcm_wdt_expire_now(struct udevice *dev, ulong flags) {
+     return npcm_wdt_reset(dev);
+}
+

Does this really work? You are calling the watchdog reset function here in the expire function, which will just reset / trigger the WDT. I would not expect that this will expire the WDT and result in a CPU / SoC reset.

Thanks,
Stefan

Quoted 11 lines
drivers/watchdog/npcm_wdt.c +0 -0
  static int npcm_wdt_of_to_plat(struct udevice *dev)
  {
      struct npcm_wdt_priv *priv = dev_get_priv(dev); @@ -87,6 +92,7 @@

static int npcm_wdt_of_to_plat(struct udevice *dev)
}

static const struct wdt_ops npcm_wdt_ops = {
+ .expire_now = npcm_wdt_expire_now,
.start = npcm_wdt_start,
.reset = npcm_wdt_reset,
.stop = npcm_wdt_stop,

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: [email protected]
________________________________
________________________________
The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.

#4 lore raw

Hi Jim,

Quoted 26 lines · Jim Liu

Hi Stefan Roese

Thanks for your review.
Here is my log from uboot master.
And i add the debug log as below:

-----------------------------------------------
U-Boot 2022.10-rc4-00038-ge3fce5e560-dirty (Sep 15 2022 - 09:58:25 +0800)

CPU: NPCM750 A1 @ Model: Nuvoton npcm750 Development Board (Device Tree)
DRAM:  464 MiB
RNG: NPCM RNG module bind OK
OTP: NPCM OTP module bind OK
AES: NPCM AES module bind OK
SHA: NPCM SHA module bind OK
Core:  210 devices, 22 uclasses, devicetree: separate
WDT:   Started watchdog@801C without servicing (60s timeout)
MMC:   sdhci0@f0842000: 0
Loading Environment from SPIFlash... SF: Detected mx66l51235l with
page size 256 Bytes, erase size 64 KiB, total 64 MiB
OK
In:    serial@1000
Out:   serial@1000
Err:   serial@1000
Net:   eth0: eth@f0802000, eth1: eth@f0825000
Hit any key to stop autoboot:  0
Quoted 5 lines

U-Boot>reset
resetting ...
jim[wdt_reboot_request]
jim[npcm_wdt_expire_now]
jim[npcm_wdt_reset]

Interesting. Thanks for sending this log. And what does "wdt expire" say?

Thanks,
Stefan

Quoted 20 lines
Quoted 3 lines

================================================
BootBlock by Nuvoton Technology Corp. Ver 10.10.17
================================================

BB Basic
Mar 24 2021
12:06:08

Quoted 7 lines
CORSTC         = 0x4fff9f9d
WD0RCR         = 0x4fff9f9d
WD1RCR         = 0x4fff9f9d
WD2RCR         = 0x4fff9f9d
SWRSTC1        = 0x4fff9f9d
SWRSTC2        = 0x4fff9f9d
SWRSTC3        = 0x4fff9f9d

----------------------------------------------------

Quoted 65 lines

If you have any suggestions, please provide to me. I will follow to modify it.

Best regards,
Jim

Quoted 58 lines · On Thu, Sep 15, 2022 at 10:23 AM [email protected] <[email protected]> wrote:

-----Original Message-----
From: Stefan Roese <[email protected]>
Sent: Wednesday, September 14, 2022 2:27 PM
To: Jim Liu <[email protected]>; CS20 JJLiu0 <[email protected]>; CS20 YSChu <[email protected]>; CS20 KWLiu <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v1] wdt: nuvoton: add expire function for generic reset

Quoted 12 lines · Jim Liu

Add expire_now function for generic sysreset request

---
   drivers/watchdog/npcm_wdt.c | 6 ++++++
   1 file changed, 6 insertions(+)
drivers/watchdog/npcm_wdt.c +0 -0
index 256020f5d3..e56aa0ebe1 100644

drivers/watchdog/npcm_wdt.c static int npcm_wdt_reset(struct udevice *dev) · line 81

Quoted 7 lines
drivers/watchdog/npcm_wdt.c +4 -0
@@ -75,6 +75,11 @@ static int npcm_wdt_reset(struct udevice *dev)
       return 0;
   }
 
+static int npcm_wdt_expire_now(struct udevice *dev, ulong flags) {
+     return npcm_wdt_reset(dev);
+}
+

Does this really work? You are calling the watchdog reset function here in the expire function, which will just reset / trigger the WDT. I would not expect that this will expire the WDT and result in a CPU / SoC reset.

Thanks,
Stefan

Quoted 11 lines
drivers/watchdog/npcm_wdt.c +0 -0
   static int npcm_wdt_of_to_plat(struct udevice *dev)
   {
       struct npcm_wdt_priv *priv = dev_get_priv(dev); @@ -87,6 +92,7 @@

static int npcm_wdt_of_to_plat(struct udevice *dev)
}

   static const struct wdt_ops npcm_wdt_ops = {

+ .expire_now = npcm_wdt_expire_now,
.start = npcm_wdt_start,
.reset = npcm_wdt_reset,
.stop = npcm_wdt_stop,

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: [email protected]
________________________________
________________________________
The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.

Viele Grüße,
Stefan Roese

Signature · 3 lines
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: [email protected]
author
#5 lore raw

Hi Stefan Roese

Thanks for the quick reply.
sorry for the topic naming.
my mean is i add a npcm_wdt_expire_now function to support sysreset .

Best regards,
Jim

Quoted 135 lines · Stefan Roese

Hi Jim,

Quoted 26 lines · Jim Liu

Hi Stefan Roese

Thanks for your review.
Here is my log from uboot master.
And i add the debug log as below:

-----------------------------------------------
U-Boot 2022.10-rc4-00038-ge3fce5e560-dirty (Sep 15 2022 - 09:58:25 +0800)

CPU: NPCM750 A1 @ Model: Nuvoton npcm750 Development Board (Device Tree)
DRAM:  464 MiB
RNG: NPCM RNG module bind OK
OTP: NPCM OTP module bind OK
AES: NPCM AES module bind OK
SHA: NPCM SHA module bind OK
Core:  210 devices, 22 uclasses, devicetree: separate
WDT:   Started watchdog@801C without servicing (60s timeout)
MMC:   sdhci0@f0842000: 0
Loading Environment from SPIFlash... SF: Detected mx66l51235l with
page size 256 Bytes, erase size 64 KiB, total 64 MiB
OK
In:    serial@1000
Out:   serial@1000
Err:   serial@1000
Net:   eth0: eth@f0802000, eth1: eth@f0825000
Hit any key to stop autoboot:  0
Quoted 5 lines

U-Boot>reset
resetting ...
jim[wdt_reboot_request]
jim[npcm_wdt_expire_now]
jim[npcm_wdt_reset]

Interesting. Thanks for sending this log. And what does "wdt expire" say?

Thanks,
Stefan

Quoted 20 lines
Quoted 3 lines

================================================
BootBlock by Nuvoton Technology Corp. Ver 10.10.17
================================================

BB Basic
Mar 24 2021
12:06:08

Quoted 7 lines
CORSTC         = 0x4fff9f9d
WD0RCR         = 0x4fff9f9d
WD1RCR         = 0x4fff9f9d
WD2RCR         = 0x4fff9f9d
SWRSTC1        = 0x4fff9f9d
SWRSTC2        = 0x4fff9f9d
SWRSTC3        = 0x4fff9f9d

----------------------------------------------------

Quoted 65 lines

If you have any suggestions, please provide to me. I will follow to modify it.

Best regards,
Jim

Quoted 58 lines · On Thu, Sep 15, 2022 at 10:23 AM [email protected] <[email protected]> wrote:

-----Original Message-----
From: Stefan Roese <[email protected]>
Sent: Wednesday, September 14, 2022 2:27 PM
To: Jim Liu <[email protected]>; CS20 JJLiu0 <[email protected]>; CS20 YSChu <[email protected]>; CS20 KWLiu <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH v1] wdt: nuvoton: add expire function for generic reset

Quoted 12 lines · Jim Liu

Add expire_now function for generic sysreset request

---
   drivers/watchdog/npcm_wdt.c | 6 ++++++
   1 file changed, 6 insertions(+)
drivers/watchdog/npcm_wdt.c +0 -0
index 256020f5d3..e56aa0ebe1 100644

drivers/watchdog/npcm_wdt.c static int npcm_wdt_reset(struct udevice *dev) · line 81

Quoted 7 lines
drivers/watchdog/npcm_wdt.c +4 -0
@@ -75,6 +75,11 @@ static int npcm_wdt_reset(struct udevice *dev)
       return 0;
   }
 
+static int npcm_wdt_expire_now(struct udevice *dev, ulong flags) {
+     return npcm_wdt_reset(dev);
+}
+

Does this really work? You are calling the watchdog reset function here in the expire function, which will just reset / trigger the WDT. I would not expect that this will expire the WDT and result in a CPU / SoC reset.

Thanks,
Stefan

Quoted 11 lines
drivers/watchdog/npcm_wdt.c +0 -0
   static int npcm_wdt_of_to_plat(struct udevice *dev)
   {
       struct npcm_wdt_priv *priv = dev_get_priv(dev); @@ -87,6 +92,7 @@

static int npcm_wdt_of_to_plat(struct udevice *dev)
}

   static const struct wdt_ops npcm_wdt_ops = {

+ .expire_now = npcm_wdt_expire_now,
.start = npcm_wdt_start,
.reset = npcm_wdt_reset,
.stop = npcm_wdt_stop,

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: [email protected]
________________________________
________________________________
The privileged confidential information contained in this email is intended for use only by the addressees as indicated by the original sender of this email. If you are not the addressee indicated in this email or are not responsible for delivery of the email to such a person, please kindly reply to the sender indicating this fact and delete all copies of it from your computer and network server immediately. Your cooperation is highly appreciated. It is advised that any unauthorized use of confidential information of Nuvoton is strictly prohibited; and any information in this email irrelevant to the official business of Nuvoton shall be deemed as neither given nor endorsed by Nuvoton.

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: [email protected]

#6 lore raw
In reply to Jim Liu
Quoted 3 lines · Jim Liu

Add expire_now function for generic sysreset request

Applied to u-boot-watchdog/master

Thanks,
Stefan

Quoted 21 lines
---
  drivers/watchdog/npcm_wdt.c | 6 ++++++
  1 file changed, 6 insertions(+)
drivers/watchdog/npcm_wdt.c +5 -0
index 256020f5d3..e56aa0ebe1 100644
@@ -75,6 +75,11 @@ static int npcm_wdt_reset(struct udevice *dev)
  	return 0;
  }
 
+static int npcm_wdt_expire_now(struct udevice *dev, ulong flags)
+{
+	return npcm_wdt_reset(dev);
+}
+
  static int npcm_wdt_of_to_plat(struct udevice *dev)
  {
  	struct npcm_wdt_priv *priv = dev_get_priv(dev);

drivers/watchdog/npcm_wdt.c static int npcm_wdt_of_to_plat(struct udevice *dev) · line 98

Quoted 7 lines
drivers/watchdog/npcm_wdt.c +1 -0
@@ -87,6 +92,7 @@ static int npcm_wdt_of_to_plat(struct udevice *dev)
  }
 
  static const struct wdt_ops npcm_wdt_ops = {
+	.expire_now = npcm_wdt_expire_now,
  	.start = npcm_wdt_start,
  	.reset = npcm_wdt_reset,
  	.stop = npcm_wdt_stop,

Viele Grüße,
Stefan Roese

Signature · 3 lines
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: [email protected]