aboutsummaryrefslogtreecommitdiff
path: root/tools/kwboot.c
diff options
context:
space:
mode:
authorPali Rohár <pali@kernel.org>2022-01-25 18:13:04 +0100
committerStefan Roese <sr@denx.de>2022-01-31 10:23:38 +0100
commit950ed24d231fce2bf1a9c48748b35944c479aa48 (patch)
tree128dbfc2ea6ba6aa3ee138807f1d6bf34b4392b3 /tools/kwboot.c
parent94c906a0ddde2481a4fd0b743400c191fb451621 (diff)
downloadu-boot-950ed24d231fce2bf1a9c48748b35944c479aa48.zip
u-boot-950ed24d231fce2bf1a9c48748b35944c479aa48.tar.gz
u-boot-950ed24d231fce2bf1a9c48748b35944c479aa48.tar.bz2
tools: kwboot: Do not change received character in kwboot_xm_recv_reply()
Marvell BootROM expects retransmission of previous xmodem packet only in the case when it sends NAK response to the host. Do not change non-xmodem response (possibly UART transfer error) to NAK in kwboot_xm_recv_reply() function. Allow caller to receive original response from device. Change argument 'nak_on_non_xm' to 'stop_on_non_xm'. Instead of changing non-xmodem character to NAK, stop processing on invalid character and return it. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <marek.behun@nic.cz> Reviewed-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'tools/kwboot.c')
-rw-r--r--tools/kwboot.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/tools/kwboot.c b/tools/kwboot.c
index 0b97990..a619a6c 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -875,7 +875,7 @@ kwboot_baud_magic_handle(int fd, char c, int baudrate)
}
static int
-kwboot_xm_recv_reply(int fd, char *c, int nak_on_non_xm,
+kwboot_xm_recv_reply(int fd, char *c, int stop_on_non_xm,
int ignore_nak_reply,
int allow_non_xm, int *non_xm_print,
int baudrate, int *baud_changed)
@@ -931,10 +931,8 @@ kwboot_xm_recv_reply(int fd, char *c, int nak_on_non_xm,
*non_xm_print = 1;
}
} else {
- if (nak_on_non_xm) {
- *c = NAK;
+ if (stop_on_non_xm)
break;
- }
timeout = recv_until - _now();
if (timeout < 0) {
errno = ETIMEDOUT;