Commit a4773c5559867f8fc6b0c1a7eb8ab36cfd53756f
Committed by
Tom Rini
1 parent
03e6151d5b
Exists in
smarc_8mq_lf_v2020.04
and in
14 other branches
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. Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com> Signed-off-by: Vignesh R <vigneshr@ti.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Showing 1 changed file with 2 additions and 0 deletions Side-by-side Diff
common/xyzModem.c
| ... | ... | @@ -25,6 +25,7 @@ |
| 25 | 25 | #include <xyzModem.h> |
| 26 | 26 | #include <stdarg.h> |
| 27 | 27 | #include <u-boot/crc.h> |
| 28 | +#include <watchdog.h> | |
| 28 | 29 | |
| 29 | 30 | /* Assumption - run xyzModem protocol over the console port */ |
| 30 | 31 | |
| ... | ... | @@ -63,6 +64,7 @@ |
| 63 | 64 | { |
| 64 | 65 | |
| 65 | 66 | ulong now = get_timer(0); |
| 67 | + WATCHDOG_RESET(); | |
| 66 | 68 | while (!tstc ()) |
| 67 | 69 | { |
| 68 | 70 | if (get_timer(now) > xyzModem_CHAR_TIMEOUT) |