Skip to contentSkip to conversation

watchdog petting during autoboot delay

PATCH New Nicolas Ferre 2 participants 7 messages May 26, 2010 – Jun 13, 2010 Arm/Microchip (AT91) SoC support

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 watchdog petting during autoboot delay

Watchdog resets were experienced during autoboot delay. Petting the watchdog during abortboot() function solve the issue.

---
 common/main.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
common/main.c +2 -0
index f7e7c1c..ea040aa 100644
@@ -159,6 +159,7 @@ static __inline__ int abortboot(int bootdelay)
 	 * when catch up.
 	 */
 	do {
+		WATCHDOG_RESET();	/* Trigger watchdog, if needed */
 		if (tstc()) {
 			if (presskey_len < presskey_max) {
 				presskey [presskey_len ++] = getc();
@@ -251,6 +252,7 @@ static __inline__ int abortboot(int bootdelay)
 # endif
 				break;
 			}
+			WATCHDOG_RESET();	/* Trigger watchdog, if needed */
 			udelay(10000);
 		}
 
Signature · 1 line
1.5.6.5
#1 lore raw

PATCH 1/1 watchdog petting during autoboot delay

Quoted 11 lines · On Wednesday 26 May 2010 06:34:49 Nicolas Ferre wrote:
common/main.c +1 -0
@@ -159,6 +159,7 @@ static __inline__ int abortboot(int bootdelay)
 	 * when catch up.
 	 */
 	do {
+		WATCHDOG_RESET();	/* Trigger watchdog, if needed */
 		if (tstc()) {
 			if (presskey_len < presskey_max) {
 				presskey [presskey_len ++] = getc();

common/main.c static __inline__ int abortboot(int bootdelay) · line 257

Quoted 6 lines
common/main.c +1 -0
@@ -251,6 +252,7 @@ static __inline__ int abortboot(int bootdelay)
 # endif
 				break;
 			}
+			WATCHDOG_RESET();	/* Trigger watchdog, if needed */
 			udelay(10000);
 		}

if your udelay() implementation isnt calling WATCHDOG_RESET(), it is broken. yes, this is undocumented, but search the mailing archives for examples.

i believe the same goes for serial devices and their tstc() function. -mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20100526/b8888d0f/attachment.pgp

#2 lore raw

PATCH 1/1 watchdog petting during autoboot delay

Le 26/05/2010 20:13, Mike Frysinger :

Quoted 13 lines · On Wednesday 26 May 2010 06:34:49 Nicolas Ferre wrote:
Quoted 12 lines
common/main.c +1 -0
@@ -159,6 +159,7 @@ static __inline__ int abortboot(int bootdelay)
 	 * when catch up.
 	 */
 	do {
+		WATCHDOG_RESET();	/* Trigger watchdog, if needed */
 		if (tstc()) {
 			if (presskey_len < presskey_max) {
 				presskey [presskey_len ++] = getc();
@@ -251,6 +252,7 @@ static __inline__ int abortboot(int bootdelay)
 # endif
Quoted 8 lines

common/main.c static __inline__ int abortboot(int bootdelay) · line 257

Quoted 5 lines
common/main.c +1 -0
 				break;
 			}
+			WATCHDOG_RESET();	/* Trigger watchdog, if needed */
 			udelay(10000);
 		}

if your udelay() implementation isnt calling WATCHDOG_RESET(), it is broken. yes, this is undocumented, but search the mailing archives for examples.

Yes, for sure, udelay() is calling WATCHDOG_RESET().

Quoted 1 line

i believe the same goes for serial devices and their tstc() function.

True, this is where the problem resides. I will try to modify the atmel_serial tstc() function.

Best regards,

Signature · 1 line
Nicolas Ferre
#3 lore raw

PATCH 1/1 watchdog petting during autoboot delay

In reply to Mike Frysinger

Le 26/05/2010 20:13, Mike Frysinger :

Quoted 22 lines · On Wednesday 26 May 2010 06:34:49 Nicolas Ferre wrote:
Quoted 11 lines
common/main.c +1 -0
@@ -159,6 +159,7 @@ static __inline__ int abortboot(int bootdelay)
 	 * when catch up.
 	 */
 	do {
+		WATCHDOG_RESET();	/* Trigger watchdog, if needed */
 		if (tstc()) {
 			if (presskey_len < presskey_max) {
 				presskey [presskey_len ++] = getc();

common/main.c static __inline__ int abortboot(int bootdelay) · line 257

Quoted 6 lines
common/main.c +1 -0
@@ -251,6 +252,7 @@ static __inline__ int abortboot(int bootdelay)
 # endif
 				break;
 			}
+			WATCHDOG_RESET();	/* Trigger watchdog, if needed */
 			udelay(10000);
 		}

if your udelay() implementation isnt calling WATCHDOG_RESET(), it is broken. yes, this is undocumented, but search the mailing archives for examples.

Quoted 1 line

i believe the same goes for serial devices and their tstc() function.

Well, after more checking, it seems that resetting the watchdog in tstc function is not so common: only serial_pl01x.c is doing it. So I guess that my first addition may be needed for other chips...

Best regards,

Signature · 1 line
Nicolas Ferre
#4 lore raw

PATCH 1/1 watchdog petting during autoboot delay

Quoted 23 lines · Nicolas Ferre

Le 26/05/2010 20:13, Mike Frysinger :

Quoted 22 lines · On Wednesday 26 May 2010 06:34:49 Nicolas Ferre wrote:
Quoted 11 lines
common/main.c +0 -0
@@ -159,6 +159,7 @@ static __inline__ int abortboot(int bootdelay)

? ? ? * when catch up.
? ? ? */
? ? ?do {
+ ? ? ? ? ? ?WATCHDOG_RESET(); ? ? ? /* Trigger watchdog, if needed */ ? ? ? ? ? ? ?if (tstc()) {
? ? ? ? ? ? ? ? ? ? ?if (presskey_len < presskey_max) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?presskey [presskey_len ++] = getc();

common/main.c +0 -0
@@ -251,6 +252,7 @@ static __inline__ int abortboot(int bootdelay)
Quoted 6 lines

?# endif
? ? ? ? ? ? ? ? ? ? ? ? ? ? ?break;
? ? ? ? ? ? ? ? ? ? ?}
+ ? ? ? ? ? ? ? ? ? ?WATCHDOG_RESET(); ? ? ? /* Trigger watchdog, if needed */ ? ? ? ? ? ? ? ? ? ? ?udelay(10000);
? ? ? ? ? ? ?}

if your udelay() implementation isnt calling WATCHDOG_RESET(), it is broken. yes, this is undocumented, but search the mailing archives for examples.

Quoted 5 lines
Quoted 1 line

i believe the same goes for serial devices and their tstc() function.

Well, after more checking, it seems that resetting the watchdog in tstc function is not so common: only serial_pl01x.c is doing it. So I guess that my first addition may be needed for other chips...

i think you're looking at the multi-serial drivers and not the cpu-serial drivers ? i.e. cpu/*/serial.c and such vs drivers/serial/* ?

the former category tends to be more trend setting than the latter. -mike

#5 lore raw

PATCH 1/1 serial: atmel_usart: insert watchdog petting during putc() and tstc()

Watchdog resets were experienced during autoboot delay. Petting the watchdog during putc() and tstc() functions solve the issue.

---
 drivers/serial/atmel_usart.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
drivers/serial/atmel_usart.c +3 -1
index cad3412..fcaee5d 100644
@@ -80,7 +80,8 @@ void serial_putc(char c)
 	if (c == '\n')
 		serial_putc('\r');
 
-	while (!(usart3_readl(CSR) & USART3_BIT(TXRDY))) ;
+	while (!(usart3_readl(CSR) & USART3_BIT(TXRDY)))
+		 WATCHDOG_RESET();
 	usart3_writel(THR, c);
 }
 
@@ -99,5 +100,6 @@ int serial_getc(void)
 
 int serial_tstc(void)
 {
+	WATCHDOG_RESET();
 	return (usart3_readl(CSR) & USART3_BIT(RXRDY)) != 0;
 }
Signature · 1 line
1.5.6.5
#6 lore raw

PATCH 1/1 serial: atmel_usart: insert watchdog petting during putc() and tstc()

drivers/serial/atmel_usart.c void serial_putc(char c) · line 86

Quoted 11 lines · Nicolas Ferre
drivers/serial/atmel_usart.c +2 -1
@@ -80,7 +80,8 @@ void serial_putc(char c)
 ? ? ? ?if (c == '\n')
 ? ? ? ? ? ? ? ?serial_putc('\r');
 
- ? ? ? while (!(usart3_readl(CSR) & USART3_BIT(TXRDY))) ;
+ ? ? ? while (!(usart3_readl(CSR) & USART3_BIT(TXRDY)))
+ ? ? ? ? ? ? ? ?WATCHDOG_RESET();
 ? ? ? ?usart3_writel(THR, c);
 ?}

i think you'd want to call it before the while() loop, but not in it ... -mike