Skip to contentSkip to conversation

xyz-modem: Fix timeout loop waiting with WATCHDOG

PATCH New Lokesh Vutla 3 participants 3 messages Jan 8, 2019 – Jan 16, 2019

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 xyz-modem: Fix timeout loop waiting with WATCHDOG

Commit 2c77c0d6524eb ("xyz-modem: Change getc timeout loop waiting") fixes the loop delay when using a hw watchdog, assuming that watchdog kicking is taken care of by getc(). But the xyzmodem driver tries to do a getc only after confirming that a character is available like below:

	while (!tstc()) {
		till timeout;
	}
	if (tstc())
		*c = getc();

and getc() does a watchdog reset only if it fails to see a character. In this case, getc() always sees a character and never does a watchdog reset. So to make sure that watchdog doesn't get reset while loading the file, do a watchdog reset just before starting the image loading.

---
- This fixes uart boot on am335x-evm.
Changes since v2:
- Updated commit message.

 common/xyzModem.c | 2 ++
 1 file changed, 2 insertions(+)
common/xyzModem.c +2 -0
index e5c65b480a..e85da74a69 100644
@@ -25,6 +25,7 @@
 #include <xyzModem.h>
 #include <stdarg.h>
 #include <u-boot/crc.h>
+#include <watchdog.h>
 
 /* Assumption - run xyzModem protocol over the console port */
 
@@ -63,6 +64,7 @@ CYGACC_COMM_IF_GETC_TIMEOUT (char chan, char *c)
 {
 
   ulong now = get_timer(0);
+  WATCHDOG_RESET();
   while (!tstc ())
     {
       if (get_timer(now) > xyzModem_CHAR_TIMEOUT)
Signature · 1 line
2.19.2
#1 lore raw

PATCH v3 1/1 xyz-modem: Fix timeout loop waiting with WATCHDOG

Quoted 19 lines · Lokesh Vutla

Commit 2c77c0d6524eb ("xyz-modem: Change getc timeout loop waiting") fixes the loop delay when using a hw watchdog, assuming that watchdog kicking is taken care of by getc(). But the xyzmodem driver tries to do a getc only after confirming that a character is available like below:

        while (!tstc()) {
                till timeout;
        }
        if (tstc())
                *c = getc();

and getc() does a watchdog reset only if it fails to see a character. In this case, getc() always sees a character and never does a watchdog reset. So to make sure that watchdog doesn't get reset while loading the file, do a watchdog reset just before starting the image loading.

Quoted 7 lines

---
- This fixes uart boot on am335x-evm.
Changes since v2:
- Updated commit message.

 common/xyzModem.c | 2 ++
 1 file changed, 2 insertions(+)
#2 lore raw

PATCH v3 1/1 xyz-modem: Fix timeout loop waiting with WATCHDOG

In reply to Lokesh Vutla
Quoted 16 lines · Lokesh Vutla

Commit 2c77c0d6524eb ("xyz-modem: Change getc timeout loop waiting") fixes the loop delay when using a hw watchdog, assuming that watchdog kicking is taken care of by getc(). But the xyzmodem driver tries to do a getc only after confirming that a character is available like below:

	while (!tstc()) {
		till timeout;
	}
	if (tstc())
		*c = getc();

and getc() does a watchdog reset only if it fails to see a character. In this case, getc() always sees a character and never does a watchdog reset. So to make sure that watchdog doesn't get reset while loading the file, do a watchdog reset just before starting the image loading.

Quoted 3 lines

Applied to u-boot/master, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190115/10f4d72c/attachment.sig>