diff options
author | Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com> | 2013-05-12 15:09:03 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2013-05-14 07:10:13 +0200 |
commit | 87f486c7f1878cdd9de45c4e7962e3009092d270 (patch) | |
tree | 2adfa1e8c03623abb107a928bd60f3fc2d2d2a30 | |
parent | 2f4fcf15696d56d80a0cf5d52824d9ba06295c03 (diff) | |
download | barebox-87f486c7f1878cdd9de45c4e7962e3009092d270.tar.gz barebox-87f486c7f1878cdd9de45c4e7962e3009092d270.tar.xz |
scripts: kwboot: add support for Marvell Dove
Marvell Dove SoC also has an UART bootmode to upload payload after
powerup. In contrast to Kirkwood and Armada 370/XP, Dove does not
respond to a special sequence sent on UART0 but requires to be
booted into UART bootmode by bootstraps. This is usually done by
pressing a push button that will set bootstraps accordingly.
This patch adds a new option, documentation and corresponding prompts
to support the above requirements. Also a left-over option ('-p')
is removed.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Acked-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | scripts/kwboot.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/scripts/kwboot.c b/scripts/kwboot.c index afc849316d..33c94b3a8b 100644 --- a/scripts/kwboot.c +++ b/scripts/kwboot.c @@ -1,5 +1,6 @@ /* - * Boot a Marvell Kirkwood SoC, with Xmodem over UART0. + * Boot a Marvell SoC, with Xmodem over UART0. + * supports Kirkwood, Dove, Armada 370, Armada XP * * (c) 2012 Daniel Stodden <daniel.stodden@gmail.com> * @@ -180,6 +181,9 @@ kwboot_tty_send(int fd, const void *buf, size_t len) int rc; ssize_t n; + if (!buf) + return 0; + rc = -1; do { @@ -264,7 +268,10 @@ kwboot_bootmsg(int tty, void *msg) int rc; char c; - kwboot_printv("Sending boot message. Please reboot the target..."); + if (msg == NULL) + kwboot_printv("Please reboot the target into UART boot mode..."); + else + kwboot_printv("Sending boot message. Please reboot the target..."); do { rc = tcflush(tty, TCIOFLUSH); @@ -580,10 +587,13 @@ static void kwboot_usage(FILE *stream, char *progname) { fprintf(stream, - "Usage: %s [-d | -b <image>] [ -p ] [ -t ] " - "[-B <baud> ] <TTY>\n", progname); + "Usage: %s [-d | -b <image> | -D <image> ] [ -t ] [-B <baud> ] <TTY>\n", + progname); fprintf(stream, "\n"); - fprintf(stream, " -b <image>: boot <image>\n"); + fprintf(stream, + " -b <image>: boot <image> with preamble (Kirkwood, Armada 370/XP)\n"); + fprintf(stream, + " -D <image>: boot <image> without preamble (Dove)\n"); fprintf(stream, " -d: enter debug mode\n"); fprintf(stream, "\n"); fprintf(stream, " -t: mini terminal\n"); @@ -616,7 +626,7 @@ main(int argc, char **argv) kwboot_verbose = isatty(STDOUT_FILENO); do { - int c = getopt(argc, argv, "hb:dptB:"); + int c = getopt(argc, argv, "hb:dtB:D:"); if (c < 0) break; @@ -626,6 +636,11 @@ main(int argc, char **argv) imgpath = optarg; break; + case 'D': + bootmsg = NULL; + imgpath = optarg; + break; + case 'd': debugmsg = kwboot_msg_debug; break; @@ -675,9 +690,7 @@ main(int argc, char **argv) perror("debugmsg"); goto out; } - } - - if (bootmsg) { + } else { rc = kwboot_bootmsg(tty, bootmsg); if (rc) { perror("bootmsg"); |