summaryrefslogtreecommitdiff
path: root/tools/kwboot.c
diff options
context:
space:
mode:
authorJon Nettleton <jon@solid-run.com>2018-08-13 18:24:38 +0300
committerStefan Roese <sr@denx.de>2018-09-19 08:59:26 +0200
commit9ca6fae9d0588bccba681c4f7ab1926bc32bdbcc (patch)
treeebabba4e602ba04c09e220a9414f49000f2a9eea /tools/kwboot.c
parent881e8478c14000614ea4b9306503c9483c4f9129 (diff)
downloadu-boot-9ca6fae9d0588bccba681c4f7ab1926bc32bdbcc.tar.gz
u-boot-9ca6fae9d0588bccba681c4f7ab1926bc32bdbcc.tar.bz2
u-boot-9ca6fae9d0588bccba681c4f7ab1926bc32bdbcc.zip
tools: kwboot: Make kwboot more robust on a38x
This patch accomplishes 2 things to make the kwboot procedure on the a38x more reliable. 1) We fill the tty with 1K of the magic bootparam. This helps with the timing of where the microcode picks up in the read of the line to ensure we actually catch the break to go into recovery mode 2) Before starting the xmodem transfer we sleep for 2 seconds and then flush the line. This allows all the magic bootparam to be flushed from the line and makes the xmodem transfer reliable and removes the Bad message failures. Signed-off-by: Jon Nettleton <jon@solid-run.com> Signed-off-by: Baruch Siach <baruch@tkos.co.il> Reviewed-by: Chris Packham <judge.packham@gmail.com> Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'tools/kwboot.c')
-rw-r--r--tools/kwboot.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/tools/kwboot.c b/tools/kwboot.c
index 50ae2b4b77..4be094c9c8 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -286,6 +286,7 @@ kwboot_bootmsg(int tty, void *msg)
{
int rc;
char c;
+ int count;
if (msg == NULL)
kwboot_printv("Please reboot the target into UART boot mode...");
@@ -297,10 +298,12 @@ kwboot_bootmsg(int tty, void *msg)
if (rc)
break;
- rc = kwboot_tty_send(tty, msg, 8);
- if (rc) {
- usleep(msg_req_delay * 1000);
- continue;
+ for (count = 0; count < 128; count++) {
+ rc = kwboot_tty_send(tty, msg, 8);
+ if (rc) {
+ usleep(msg_req_delay * 1000);
+ continue;
+ }
}
rc = kwboot_tty_recv(tty, &c, 1, msg_rsp_timeo);
@@ -426,6 +429,9 @@ kwboot_xmodem(int tty, const void *_data, size_t size)
kwboot_printv("Sending boot image...\n");
+ sleep(2); /* flush isn't effective without it */
+ tcflush(tty, TCIOFLUSH);
+
do {
struct kwboot_block block;
int n;