9
0
Fork 0

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>
This commit is contained in:
Sebastian Hesselbarth 2013-05-12 15:09:03 +02:00 committed by Sascha Hauer
parent 2f4fcf1569
commit 87f486c7f1
1 changed files with 22 additions and 9 deletions

View File

@ -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> * (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; int rc;
ssize_t n; ssize_t n;
if (!buf)
return 0;
rc = -1; rc = -1;
do { do {
@ -264,7 +268,10 @@ kwboot_bootmsg(int tty, void *msg)
int rc; int rc;
char c; 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 { do {
rc = tcflush(tty, TCIOFLUSH); rc = tcflush(tty, TCIOFLUSH);
@ -580,10 +587,13 @@ static void
kwboot_usage(FILE *stream, char *progname) kwboot_usage(FILE *stream, char *progname)
{ {
fprintf(stream, fprintf(stream,
"Usage: %s [-d | -b <image>] [ -p ] [ -t ] " "Usage: %s [-d | -b <image> | -D <image> ] [ -t ] [-B <baud> ] <TTY>\n",
"[-B <baud> ] <TTY>\n", progname); progname);
fprintf(stream, "\n"); 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, " -d: enter debug mode\n");
fprintf(stream, "\n"); fprintf(stream, "\n");
fprintf(stream, " -t: mini terminal\n"); fprintf(stream, " -t: mini terminal\n");
@ -616,7 +626,7 @@ main(int argc, char **argv)
kwboot_verbose = isatty(STDOUT_FILENO); kwboot_verbose = isatty(STDOUT_FILENO);
do { do {
int c = getopt(argc, argv, "hb:dptB:"); int c = getopt(argc, argv, "hb:dtB:D:");
if (c < 0) if (c < 0)
break; break;
@ -626,6 +636,11 @@ main(int argc, char **argv)
imgpath = optarg; imgpath = optarg;
break; break;
case 'D':
bootmsg = NULL;
imgpath = optarg;
break;
case 'd': case 'd':
debugmsg = kwboot_msg_debug; debugmsg = kwboot_msg_debug;
break; break;
@ -675,9 +690,7 @@ main(int argc, char **argv)
perror("debugmsg"); perror("debugmsg");
goto out; goto out;
} }
} } else {
if (bootmsg) {
rc = kwboot_bootmsg(tty, bootmsg); rc = kwboot_bootmsg(tty, bootmsg);
if (rc) { if (rc) {
perror("bootmsg"); perror("bootmsg");