Re: [PATCH u-boot-marvell 00/13] Yet another kwboot improvements

Pali Rohár
2021-10-27T15:29:38Z

On Wednesday 27 October 2021 17:27:41 Stefan Roese wrote:
> On 27.10.21 16:10, Pali Rohár wrote:
>
> <snip>
>
> > > Perfect! So it really looks like that issue is in the code which resets
> > > baudrate back to the value 115200.
> > >
> > > I have there another diff which removes usage of the stack in code which
> > > resets baudrate back to default value:
> > >
> > > diff --git a/tools/kwboot.c b/tools/kwboot.c
> > > index b56c9a0c8104..8f0e50501398 100644
> > > --- a/tools/kwboot.c
> > > +++ b/tools/kwboot.c
> > > @@ -1444,6 +1444,11 @@ _inject_baudrate_change_code(void *img, size_t *size, int pre,
> > > memcpy(code, kwboot_baud_code, codesz - 8);
> > > *(uint32_t *)(code + codesz - 8) = cpu_to_le32(old_baud);
> > > *(uint32_t *)(code + codesz - 4) = cpu_to_le32(new_baud);
> > > +
> > > + if (!pre) {
> >
> > Ou, there is a mistake, it should be "if (pre) {"
> >
> > > + *(uint32_t *)code = cpu_to_le32(0xe1a00000); /* arm nop */
> > > + *(uint32_t *)(code + codesz - 4*7) = cpu_to_le32(0xe12fff1e); /* bx lr */
> > > + }
> > > }
> > > static int
> > >
> > > Could you try to apply this change instead of my previous one?
>
> Tested with this corrected patch:
>
> 97 %
> [......................................................................]
> 99 % [................... ]
> Done
> Finishing transfer
> Waiting 2s for baudrate change magic
>
> Changing baudrate back to 115200 Bd
>
> [Type Ctrl-\ + c to quit]
>
>
> U-Boot 2021.10-00916-gc6142e537e88-dirty (Oct 27 2021 - 17:23:24 +0200)
>
> SoC: MV78260-B0 at 1333 MHz
> I2C: ready
> DRAM: 2 GiB (667 MHz, 64-bit, ECC not enabled)
> Loading Environment from SPIFlash... SF: Detected m25p128 with page size 256
> Bytes, erase size 256 KiB, total 16 MiB
> OK
> Model: Marvell Armada XP theadorable
> ...
>
> Perfect. This works on Armada XP. :)

Nice! Therefore I will prepare proper patch for removing stack usage.

> Still I see no speed change. But this is a different story...
>
> Thanks,
> Stefan