mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
To: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>,
	barebox@lists.infradead.org,
	Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Subject: [PATCH 2/5] scripts: kwboot: add support for Marvell Dove
Date: Sun, 12 May 2013 15:09:03 +0200	[thread overview]
Message-ID: <1368364146-6024-3-git-send-email-sebastian.hesselbarth@gmail.com> (raw)
In-Reply-To: <1368364146-6024-1-git-send-email-sebastian.hesselbarth@gmail.com>

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>
---
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Cc: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
Cc: barebox@lists.infradead.org
---
 scripts/kwboot.c |   31 ++++++++++++++++++++++---------
 1 file changed, 22 insertions(+), 9 deletions(-)

diff --git a/scripts/kwboot.c b/scripts/kwboot.c
index afc8493..33c94b3 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");
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2013-05-12 13:09 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-12 13:09 [PATCH 0/5] Initial support for Marvell Dove SoCs Sebastian Hesselbarth
2013-05-12 13:09 ` [PATCH 1/5] scripts: kwbimage: add references to Marvell Dove SoC Sebastian Hesselbarth
2013-05-12 13:09 ` Sebastian Hesselbarth [this message]
2013-05-12 16:48   ` [PATCH 2/5] scripts: kwboot: add support for Marvell Dove Thomas Petazzoni
2013-05-12 13:09 ` [PATCH 3/5] arm: initial support for Marvell Dove SoCs Sebastian Hesselbarth
2013-05-12 16:49   ` Thomas Petazzoni
2013-05-12 16:51     ` Sebastian Hesselbarth
2013-05-12 17:19       ` Thomas Petazzoni
2013-05-12 17:26         ` Sebastian Hesselbarth
2013-05-13  7:58   ` Sascha Hauer
2013-05-13  9:17     ` Sebastian Hesselbarth
2013-05-13 10:57       ` Sascha Hauer
2013-05-13 13:06         ` Sebastian Hesselbarth
2013-05-13 14:11           ` Sascha Hauer
2013-05-13 14:23           ` Thomas Petazzoni
2013-05-13 15:14             ` Sebastian Hesselbarth
2013-05-13 16:12             ` Sebastian Hesselbarth
2013-05-13 16:21               ` Thomas Petazzoni
2013-05-13 16:30                 ` Sebastian Hesselbarth
2013-05-13 16:34                   ` Thomas Petazzoni
2013-05-13 16:48                     ` Sebastian Hesselbarth
2013-05-13 17:14                       ` Thomas Petazzoni
2013-05-13 17:42                         ` Sebastian Hesselbarth
2013-05-15  5:55       ` Sascha Hauer
2013-05-15  6:20         ` Sebastian Hesselbarth
2013-05-15  6:39           ` Sascha Hauer
2013-05-15  6:48             ` Sebastian Hesselbarth
2013-05-15  7:29           ` Thomas Petazzoni
2013-05-15  8:03             ` Lucas Stach
2013-05-15  8:11               ` Thomas Petazzoni
2013-05-15  7:26         ` Thomas Petazzoni
2013-05-15  8:11           ` Sascha Hauer
2013-05-15  8:19             ` Thomas Petazzoni
2013-05-12 13:09 ` [PATCH 4/5] arm: add basic support for SolidRun CuBox Sebastian Hesselbarth
2013-05-12 20:28   ` [PATCH v2 " Sebastian Hesselbarth
2013-05-12 13:09 ` [PATCH 5/5] arm: mach-mvebu: rename Armada 370/XP core code Sebastian Hesselbarth
2013-05-12 16:50   ` Thomas Petazzoni
2013-05-12 16:53     ` Sebastian Hesselbarth
2013-05-12 20:29   ` [PATCH v2 " Sebastian Hesselbarth

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1368364146-6024-3-git-send-email-sebastian.hesselbarth@gmail.com \
    --to=sebastian.hesselbarth@gmail.com \
    --cc=barebox@lists.infradead.org \
    --cc=ezequiel.garcia@free-electrons.com \
    --cc=thomas.petazzoni@free-electrons.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox