public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Baruch Siach <baruch@tkos.co.il>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] tools: kwboot: Make kwboot more robust on a38x
Date: Thu, 16 Aug 2018 11:38:45 +0300	[thread overview]
Message-ID: <87ftzeogdm.fsf@tkos.co.il> (raw)
In-Reply-To: <CAFOYHZBpyC0H-hmmb7+u_o0gaP9ChCEN1szp7uCUh8i84j5ADg@mail.gmail.com>

Hi Chris,

Chris Packham writes:
> On Tue, Aug 14, 2018 at 3:25 AM Baruch Siach <baruch@tkos.co.il> wrote:
>> From: Jon Nettleton <jon@solid-run.com>
>>
>> This patch accomplishes 2 things to make the kwboot procedure
>> on the a38x more reliable.
>>
>> 1)  We fill the tty with 1K of the magic bootparam.  This helps
>> with the timing of where the microcode picks up in the read of
>> the line to ensure we actually catch the break to go into recovery
>> mode
>>
>> 2)  Before starting the xmodem transfer we sleep for 2 seconds
>> and then flush the line.  This allows all the magic bootparam
>> to be flushed from the line and makes the xmodem transfer reliable
>> and removes the Bad message failures.
>>
>> Signed-off-by: Jon Nettleton <jon@solid-run.com>
>> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
>> ---
>
> Reviewed-by: Chris Packham <judge.packham@gmail.com>

Thanks.

> Lately I haven't had much luck with using kwboot on a38x. I seem to be
> able to get the spl to boot from uart (even better now thanks to this
> patch) but the next stage still loads from SPI. I haven't been brave
> enough to blank a board to see if that changes behaviour. Are your
> experiences any different? I'm wondering if there is something we need
> to do in the SPL to figure out that we need to load the next stage via
> xmodem.

It works for me here on the Clearfog.

The code that determines the seconds stage load device is in
arch/arm/mach-mvebu/spl.c:get_boot_device(). Does the code there get it
right? What do you read from CONFIG_BOOTROM_ERR_REG?

baruch

>>  tools/kwboot.c | 14 ++++++++++----
>>  1 file changed, 10 insertions(+), 4 deletions(-)
>>
>> diff --git a/tools/kwboot.c b/tools/kwboot.c
>> index 50ae2b4b77b1..4be094c9c8d8 100644
>> --- a/tools/kwboot.c
>> +++ b/tools/kwboot.c
>> @@ -286,6 +286,7 @@ kwboot_bootmsg(int tty, void *msg)
>>  {
>>         int rc;
>>         char c;
>> +       int count;
>>
>>         if (msg == NULL)
>>                 kwboot_printv("Please reboot the target into UART boot mode...");
>> @@ -297,10 +298,12 @@ kwboot_bootmsg(int tty, void *msg)
>>                 if (rc)
>>                         break;
>>
>> -               rc = kwboot_tty_send(tty, msg, 8);
>> -               if (rc) {
>> -                       usleep(msg_req_delay * 1000);
>> -                       continue;
>> +               for (count = 0; count < 128; count++) {
>> +                       rc = kwboot_tty_send(tty, msg, 8);
>> +                       if (rc) {
>> +                               usleep(msg_req_delay * 1000);
>> +                               continue;
>> +                       }
>>                 }
>>
>>                 rc = kwboot_tty_recv(tty, &c, 1, msg_rsp_timeo);
>> @@ -426,6 +429,9 @@ kwboot_xmodem(int tty, const void *_data, size_t size)
>>
>>         kwboot_printv("Sending boot image...\n");
>>
>> +       sleep(2); /* flush isn't effective without it */
>> +       tcflush(tty, TCIOFLUSH);
>> +
>>         do {
>>                 struct kwboot_block block;
>>                 int n;

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

  reply	other threads:[~2018-08-16  8:38 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-13 15:24 [U-Boot] [PATCH] tools: kwboot: Make kwboot more robust on a38x Baruch Siach
2018-08-16  7:59 ` Chris Packham
2018-08-16  8:38   ` Baruch Siach [this message]
2018-08-16 23:01     ` Chris Packham
2018-08-16 23:06       ` Chris Packham
2018-08-16 23:22         ` Chris Packham
2018-08-17  8:10           ` Jon Nettleton
2018-08-17  8:58             ` Chris Packham
2018-08-19  8:10               ` Jon Nettleton
2018-08-16  9:45   ` Willy Tarreau
2018-09-19 12:13 ` Stefan Roese

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=87ftzeogdm.fsf@tkos.co.il \
    --to=baruch@tkos.co.il \
    --cc=u-boot@lists.denx.de \
    /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