[U-Boot] [PATCH v3 10/10] tools: Add support for Dove to kwboot

Sebastian Hesselbarth sebastian.hesselbarth at gmail.com
Wed Jan 16 20:25:28 CET 2013


On Dove kwboot 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 kwboot.

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 at gmail.com>
Signed-off-by: Daniel Stodden <daniel.stodden at gmail.com>
---
Cc: u-boot at lists.denx.de
Cc: Sebastian Hesselbarth <sebastian.hesselbarth at gmail.com>
Cc: Rabeeh Khoury <rabeeh at solid-run.com>
Cc: Albert Aribaud <albert.u.boot at aribaud.net>
Cc: Prafulla Wadaskar <prafulla at marvell.com>
Cc: Andy Fleming <afleming at gmail.com>
Cc: Joe Hershberger <joe.hershberger at gmail.com>
Cc: Daniel Stodden <daniel.stodden at gmail.com>
Cc: Luka Perkov <luka at openwrt.org>
---
 doc/kwboot.1   |   13 ++++++++++---
 tools/Makefile |    2 ++
 tools/kwboot.c |   25 +++++++++++++++++++------
 3 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/doc/kwboot.1 b/doc/kwboot.1
index 25fe69a..ab4551b 100644
--- a/doc/kwboot.1
+++ b/doc/kwboot.1
@@ -1,17 +1,18 @@
-.TH KWBOOT 1 "2012-05-19"
+.TH KWBOOT 1 "2013-01-16"
 
 .SH NAME
-kwboot \- Boot Marvell Kirkwood SoCs over a serial link.
+kwboot \- Boot Marvell Kirkwood/Dove SoCs over a serial link.
 .SH SYNOPSIS
 .B kwboot
 .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 "\-u"
+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 686840a..4816812 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) += kwboot$(SFX)
 BIN_FILES-$(CONFIG_KIRKWOOD) += kwboot$(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) += kwboot.o
 OBJ_FILES-$(CONFIG_KIRKWOOD) += kwboot.o
 
 # Don't build by default
diff --git a/tools/kwboot.c b/tools/kwboot.c
index e773f01..1e4edb6 100644
--- a/tools/kwboot.c
+++ b/tools/kwboot.c
@@ -37,6 +37,10 @@ static unsigned char kwboot_msg_boot[] = {
 	0xBB, 0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x77
 };
 
+static unsigned char kwboot_msg_none[] = {
+	0x00
+};
+
 #define KWBOOT_MSG_REQ_DELAY	10 /* ms */
 #define KWBOOT_MSG_RSP_TIMEO	50 /* ms */
 
@@ -268,17 +272,21 @@ kwboot_bootmsg(int tty, void *msg)
 	int rc;
 	char c;
 
-	kwboot_printv("Sending boot message. Please reboot the target...");
+	kwboot_printv(msg != kwboot_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 = kwboot_tty_send(tty, msg, 8);
-		if (rc) {
-			usleep(KWBOOT_MSG_REQ_DELAY * 1000);
-			continue;
+		if (msg != kwboot_msg_none) {
+			rc = kwboot_tty_send(tty, msg, 8);
+			if (rc) {
+				usleep(KWBOOT_MSG_REQ_DELAY * 1000);
+				continue;
+			}
 		}
 
 		rc = kwboot_tty_recv(tty, &c, 1, KWBOOT_MSG_RSP_TIMEO);
@@ -607,6 +615,7 @@ kwboot_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)
 	kwboot_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 = kwboot_msg_none;
+			break;
+
 		case 'p':
 			patch = 1;
 			break;
-- 
1.7.10.4



More information about the U-Boot mailing list