Patchwork [U-Boot,10/10] tools: Add support for Dove to kwboot

login
register
mail settings
Submitter Daniel Stodden
Date Dec. 5, 2012, 10:15 p.m.
Message ID <1354745722.7112.352.camel@espiritosanto.int.convergent.io>
Download mbox | patch
Permalink /patch/203980/
State Superseded
Headers show

Comments

Daniel Stodden - Dec. 5, 2012, 10:15 p.m.
On Sun, 2012-12-02 at 20:15 +0100, Luka Perkov wrote:
> Hi Sebastian,
> 
> On Sun, Dec 02, 2012 at 03:36:22PM +0100, Sebastian Hesselbarth wrote:
> > 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@gmail.com>
> > ---
> > Cc: u-boot@lists.denx.de
> > Cc: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
> > Cc: Rabeeh Khoury <rabeeh@solid-run.com>
> > Cc: Albert Aribaud <albert.u.boot@aribaud.net>
> > Cc: Prafulla Wadaskar <prafulla@marvell.com>
> > Cc: Andy Fleming <afleming@gmail.com>
> > Cc: Joe Hershberger <joe.hershberger@gmail.com>
> > Cc: Daniel Stodden <daniel.stodden@gmail.com>
> > Cc: Dieter Kiermaier <dk-arm-linux@gmx.de>
> > ---
> >  tools/Makefile |    2 ++
> >  tools/kwboot.c |   44 ++++++++++++++++++++++++++++++++++++++++----
> >  2 files changed, 42 insertions(+), 4 deletions(-)
> 
> Please update the documentation too (doc/kwboot.1).

Second that.

Hey Sebastian,

since the protocol remains the same, and just doesn't take a boot
message while polling, better to keep the bootmsg_call() intact and just
make the option parsing flip the message type?

The original BootROM had a couple more message, the tool just no
immediate use for that. Eventual options to change message type wasn't
unanticipated. Ok, no message at all was.

Sketchy patch attached for your consideration. Beware, I can't test it
right now.

Also, while I've got nothing against adding a flag for that, I'm partly
wondering whether this took a patch at all -- what's the target behavior
if you keep shooting it with the original boot message?

I would assume it would keep responding with NAKs. But doesn't?

Cheers,
Daniel
Sebastian Hesselbarth - Dec. 6, 2012, 10:59 a.m.
On 12/05/2012 11:15 PM, Daniel Stodden wrote:
> On Sun, 2012-12-02 at 20:15 +0100, Luka Perkov wrote:
>> On Sun, Dec 02, 2012 at 03:36:22PM +0100, Sebastian Hesselbarth wrote:
>>> 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.
> ...
> since the protocol remains the same, and just doesn't take a boot
> message while polling, better to keep the bootmsg_call() intact and just
> make the option parsing flip the message type?
>
> The original BootROM had a couple more message, the tool just no
> immediate use for that. Eventual options to change message type wasn't
> unanticipated. Ok, no message at all was.
>
> Sketchy patch attached for your consideration. Beware, I can't test it
> right now.

Hi Daniel,

I tried your patch and except that you forgot to add 'n' to the getopt
call, it works as expected.

> Also, while I've got nothing against adding a flag for that, I'm partly
> wondering whether this took a patch at all -- what's the target behavior
> if you keep shooting it with the original boot message?
>
> I would assume it would keep responding with NAKs. But doesn't?

I tried original kwboot and it failed, then I checked the DS for the boot
sequence and finally found out, that Dove doesn't support the "force into
UART boot mode" sequence. But your are right, if I reboot Dove into UART
boot mode it makes no difference if you send the sequence or not. It works
on both kwboot modes.

It just doesn't work if you are doing a normal boot of Dove, as it ignores
the sequence sent.

So finally, we have three options:
- leave kwboot as is and hope the user will know about Dove's inability to
use the boot sequence
- add a note to usage() and kwboot that Dove doen't like the sequence
- add an option to kwboot as you are proposing

Sebastian
Daniel Stodden - Dec. 6, 2012, 6:18 p.m.
On Thu, 2012-12-06 at 11:59 +0100, Sebastian Hesselbarth wrote:
> On 12/05/2012 11:15 PM, Daniel Stodden wrote:
> > On Sun, 2012-12-02 at 20:15 +0100, Luka Perkov wrote:
> >> On Sun, Dec 02, 2012 at 03:36:22PM +0100, Sebastian Hesselbarth wrote:
> >>> 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.
> > ...
> > since the protocol remains the same, and just doesn't take a boot
> > message while polling, better to keep the bootmsg_call() intact and just
> > make the option parsing flip the message type?
> >
> > The original BootROM had a couple more message, the tool just no
> > immediate use for that. Eventual options to change message type wasn't
> > unanticipated. Ok, no message at all was.
> >
> > Sketchy patch attached for your consideration. Beware, I can't test it
> > right now.
> 
> Hi Daniel,
> 
> I tried your patch and except that you forgot to add 'n' to the getopt
> call, it works as expected.

Thanks, mission accomplished :)

> > Also, while I've got nothing against adding a flag for that, I'm partly
> > wondering whether this took a patch at all -- what's the target behavior
> > if you keep shooting it with the original boot message?
> >
> > I would assume it would keep responding with NAKs. But doesn't?
> 
> I tried original kwboot and it failed, then I checked the DS for the boot
> sequence and finally found out, that Dove doesn't support the "force into
> UART boot mode" sequence. But your are right, if I reboot Dove into UART
> boot mode it makes no difference if you send the sequence or not. It works
> on both kwboot modes.
> 
> It just doesn't work if you are doing a normal boot of Dove, as it ignores
> the sequence sent.
> 
> So finally, we have three options:
> - leave kwboot as is and hope the user will know about Dove's inability to
> use the boot sequence
> - add a note to usage() and kwboot that Dove doen't like the sequence
> - add an option to kwboot as you are proposing

Okay, here's a deal.

We've got a bit of a backward compatibility problem anyway. Dave Purdy
was so kind to write up a summary of popular devices known working and
not working. That's mainly a matter of firmware revisions. [1]

 - Let's add a message selector, -m <foo> or so.

   Kirkwood specs list two types, let's make those -mdebug and -muart.

   If we add -m debug, maybe that even results in someone on the web
   being ultimately able to explain wth debug mode does :)

   Default is -m uart, that's what's going on right now.

 - We add -mnone for pin-selected uart boot mode.

 - Maybe a slightly less specific printv message.

 - But most importantly, we add a COMPATIBILITY section to the manpage,
   and explain the difference between core revisions there.

We could drop the none case. But then again, if the target isn't reset
yet, then not scribbling into getties and stuff where it's avoidable
might be preferred by those who can. So why not.

Could you try to read us the boot firmware revision you're running? It's
described under the link below. Not sure if it works on your platform
though.

Daniel

[1] http://forum.doozan.com/read.php?3,7852
Sebastian Hesselbarth - Dec. 6, 2012, 8:18 p.m.
On 12/06/2012 07:18 PM, Daniel Stodden wrote:
> On Thu, 2012-12-06 at 11:59 +0100, Sebastian Hesselbarth wrote:
>> So finally, we have three options:
>> - leave kwboot as is and hope the user will know about Dove's inability to
>> use the boot sequence
>> - add a note to usage() and kwboot that Dove doen't like the sequence
>> - add an option to kwboot as you are proposing
>
> Okay, here's a deal.
>
> We've got a bit of a backward compatibility problem anyway. Dave Purdy
> was so kind to write up a summary of popular devices known working and
> not working. That's mainly a matter of firmware revisions. [1]
>
>   - Let's add a message selector, -m<foo>  or so.
>
>     Kirkwood specs list two types, let's make those -mdebug and -muart.
>
>     If we add -m debug, maybe that even results in someone on the web
>     being ultimately able to explain wth debug mode does :)
>
>     Default is -m uart, that's what's going on right now.
>
>   - We add -mnone for pin-selected uart boot mode.
>
>   - Maybe a slightly less specific printv message.
>
>   - But most importantly, we add a COMPATIBILITY section to the manpage,
>     and explain the difference between core revisions there.
>
> We could drop the none case. But then again, if the target isn't reset
> yet, then not scribbling into getties and stuff where it's avoidable
> might be preferred by those who can. So why not.
>
> Could you try to read us the boot firmware revision you're running? It's
> described under the link below. Not sure if it works on your platform
> though.

Daniel,

I did a little testing with kwboot and boot sequence.

First, BootROM version of my Dove is 2.33. The BootROM version address is a
little different what is given on the webpage (ffff003c instead of ff00003c).

CuBox>> md ffff003c 1
ffff003c: 00000233    3...

Dove does not support UART boot sequences. It has to be selected by reset
strapping, i.e. if there is no push button as on the cubox it will be
difficult for most of the users ;)

I also tested the above on the Mirabox (Armada 370) and except that the BootROM
there, prints out some message after reset it works if I first call kwboot with
-b and then with -n or delay xmodem call by a second.

BootROM version on Armada 370 is 1.08 and the version register address is very
different. It resets if I try to read ff00003c or ffff003c and I have neither
a DS nor the u-boot source available.

Finally, I tested kwboot on 88F6282 (aka Armada 300) and there BootROM version
is 1.21 (on ff00003c) and it does work as with Kirkwood (i.e. send boot sequence).

I think, for the patch set, that I will remove patch 10 from it and leave the
required modifications up to you?

Sebastian

Patch

diff --git a/tools/kwboot.c b/tools/kwboot.c
index e773f01..f598dc1 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);
@@ -646,6 +654,10 @@  main(int argc, char **argv)
 			imgpath = optarg;
 			break;
 
+		case 'n':
+			bootmsg = kwboot_msg_none;
+			break;
+
 		case 'p':
 			patch = 1;
 			break;