From: Lokesh Vutla Date: Tue, 8 Jan 2019 13:58:35 +0000 (+0530) Subject: xyz-modem: Fix timeout loop waiting with WATCHDOG X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=a4773c5559867f8fc6b0c1a7eb8ab36cfd53756f;p=project%2Fbcm63xx%2Fu-boot.git 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 Signed-off-by: Vignesh R Reviewed-by: Simon Glass --- diff --git a/common/xyzModem.c b/common/xyzModem.c index e5c65b480a..e85da74a69 100644 --- a/common/xyzModem.c +++ b/common/xyzModem.c @@ -25,6 +25,7 @@ #include #include #include +#include /* 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)