[U-Boot] [PATCH 2/2 v4] tools: add support for Dove to kwboot

From: Sebastian Hesselbarth sebastian.hesselbarth@gmail.com
On Dove mvboot can also be used to boot an u-boot image into RAM. In contrast to Kirkwood, Dove does not support the UART boot mode sequence but requires the UART boot mode to be selected through strap pins. The SolidRun CuBox has a push button to allow uart boot mode but fails on the boot sequence sent by mvboot.
This patch adds another cmdline option to allow to send a boot image without the boot sequence and adds support for Dove.
Signed-off-by: Sebastian Hesselbarth sebastian.hesselbarth@gmail.com Signed-off-by: Daniel Stodden daniel.stodden@gmail.com Signed-off-by: Luka Perkov luka@openwrt.org Cc: Prafulla Wadaskar prafulla@marvell.com Cc: Rabeeh Khoury rabeeh@solid-run.com ---
changes from v1 to v2:
* update documentation
changes from v2 to v3:
* none
changes from v3 to v4:
* move to separate patch series * fix wrong flag in the man page * document Dove support in the header of mvboot.c
doc/mvboot.1 | 13 ++++++++++--- tools/Makefile | 2 ++ tools/mvboot.c | 27 ++++++++++++++++++++------- 3 files changed, 32 insertions(+), 10 deletions(-)
diff --git a/doc/mvboot.1 b/doc/mvboot.1 index 563d0e5..0978351 100644 --- a/doc/mvboot.1 +++ b/doc/mvboot.1 @@ -1,17 +1,18 @@ -.TH MVBOOT 1 "2012-05-19" +.TH MVBOOT 1 "2013-02-12"
.SH NAME -mvboot - Boot Marvell Kirkwood SoCs over a serial link. +mvboot - Boot Marvell Kirkwood/Dove SoCs over a serial link. .SH SYNOPSIS .B mvboot .RB [ "-b \fIimage\fP" ] +.RB [ "-n" ] .RB [ "-p" ] .RB [ "-t" ] .RB [ "-B \fIbaudrate\fP" ] .RB \fITTY\fP .SH "DESCRIPTION"
-The \fBmkimage\fP program boots boards based on Marvell's Kirkwood +The \fBmkimage\fP program boots boards based on Marvell's Kirkwood/Dove platform over their integrated UART. Boot image files will typically contain a second stage boot loader, such as U-Boot. The image file must conform to Marvell's BootROM firmware image format @@ -68,6 +69,12 @@ If standard I/O streams connect to a console, this mode will terminate after receiving 'ctrl-\' followed by 'c' from console input.
.TP +.BI "-n" +Disables the UART boot mode sequence for platforms that do not support +it (e.g. Dove). Usually, the UART boot mode must be selected by pressing +a push button on power-up. + +.TP .BI "-B \fIbaudrate\fP" Adjust the baud rate on \fITTY\fP. Default rate is 115200.
diff --git a/tools/Makefile b/tools/Makefile index adfb643..db4def5 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -72,6 +72,7 @@ BIN_FILES-$(CONFIG_SMDK5250) += mksmdk5250spl$(SFX) BIN_FILES-$(CONFIG_MX28) += mxsboot$(SFX) BIN_FILES-$(CONFIG_NETCONSOLE) += ncb$(SFX) BIN_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1$(SFX) +BIN_FILES-$(CONFIG_DOVE) += mvboot$(SFX) BIN_FILES-$(CONFIG_KIRKWOOD) += mvboot$(SFX)
# Source files which exist outside the tools directory @@ -103,6 +104,7 @@ OBJ_FILES-$(CONFIG_NETCONSOLE) += ncb.o NOPED_OBJ_FILES-y += os_support.o OBJ_FILES-$(CONFIG_SHA1_CHECK_UB_IMG) += ubsha1.o NOPED_OBJ_FILES-y += ublimage.o +OBJ_FILES-$(CONFIG_DOVE) += mvboot.o OBJ_FILES-$(CONFIG_KIRKWOOD) += mvboot.o
# Don't build by default diff --git a/tools/mvboot.c b/tools/mvboot.c index 94fb0dd..ea12f58 100644 --- a/tools/mvboot.c +++ b/tools/mvboot.c @@ -1,5 +1,5 @@ /* - * Boot a Marvell Kirkwood SoC, with Xmodem over UART0. + * Boot a Marvell Kirkwood and Dove SoCs, with Xmodem over UART0. * * (c) 2012 Daniel Stodden daniel.stodden@gmail.com * @@ -37,6 +37,10 @@ static unsigned char mvboot_msg_boot[] = { 0xBB, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77 };
+static unsigned char mvboot_msg_none[] = { + 0x00 +}; + #define MVBOOT_MSG_REQ_DELAY 10 /* ms */ #define MVBOOT_MSG_RSP_TIMEO 50 /* ms */
@@ -268,17 +272,21 @@ mvboot_bootmsg(int tty, void *msg) int rc; char c;
- mvboot_printv("Sending boot message. Please reboot the target..."); + mvboot_printv(msg != mvboot_msg_none + ? "Sending boot message. Please reboot the target..." + : "Sensing target. Please reboot target into UART mode...");
do { rc = tcflush(tty, TCIOFLUSH); if (rc) break;
- rc = mvboot_tty_send(tty, msg, 8); - if (rc) { - usleep(MVBOOT_MSG_REQ_DELAY * 1000); - continue; + if (msg != mvboot_msg_none) { + rc = mvboot_tty_send(tty, msg, 8); + if (rc) { + usleep(MVBOOT_MSG_REQ_DELAY * 1000); + continue; + } }
rc = mvboot_tty_recv(tty, &c, 1, MVBOOT_MSG_RSP_TIMEO); @@ -607,6 +615,7 @@ mvboot_usage(FILE *stream, char *progname) fprintf(stream, " -b <image>: boot <image>\n"); fprintf(stream, " -p: patch <image> to type 0x69 (uart boot)\n"); fprintf(stream, "\n"); + fprintf(stream, " -n: don't send boot message\n"); fprintf(stream, " -t: mini terminal\n"); fprintf(stream, "\n"); fprintf(stream, " -B <baud>: set baud rate\n"); @@ -636,7 +645,7 @@ main(int argc, char **argv) mvboot_verbose = isatty(STDOUT_FILENO);
do { - int c = getopt(argc, argv, "hb:ptB:"); + int c = getopt(argc, argv, "hb:nptB:"); if (c < 0) break;
@@ -646,6 +655,10 @@ main(int argc, char **argv) imgpath = optarg; break;
+ case 'n': + bootmsg = mvboot_msg_none; + break; + case 'p': patch = 1; break;
participants (1)
-
Luka Perkov