[PATCH 0/3] mtd: nand: atmel: legacy: fix boot on USB-A9G20

Sam Ravnborg sam at ravnborg.org
Tue Mar 21 12:02:34 PDT 2023

Hi Wolfram.

On Tue, Mar 21, 2023 at 06:20:45PM +0100, Wolfram Sang wrote:
> Hi Sascha!
> > Nice to hear from you here ;)
> Yeah, it has been only 10 years... :)
> > I have no idea how the SDRAM setup is done on the USB-A9G20. There seems
> > to be SDRAM setup code for the USB-A9263, but not for the USB-A9G20. Is
> > there some AT91Bootstrap required?
> Yes. There is a bootstrap required: https://github.com/linux4sam/at91bootstrap
> However, an old version is needed. I am still fighting the details.
> I accidently erased it, so my journey for unbricking the device began.
> at91bootstrap, openocd, barebox - they all once supported A9G20, but
> nowadays all of them were broken. Well, I fixed openocd and barebox
> mostly so far, the bootstrap is still the missing piece.

You may be hit by the newer gcc optimize the delays in
the sdram init code in at91bootstrap.

This code:
	/* Step#4 The minimum pause of 200 us is provided to precede any single toggle */
        for (i = 0; i < 1000; i++) ;
Are optimized away with newer gcc's.
You can find it repeated several times in the init code.

I think this was the only part what broke at91bootstrap for me.
It was Ahmad, IIRC, that told me about it - so not my finding.

> Super interesting about the A9263 setup code. I missed it so far. Does
> that mean that barebox can replace the at91bootstrap?
Yes. The patch series I pointed at generates a bare variant that I
successfully used to boot my board direct from ROMBOOT.
It is a direct replacement for at91bootstrap and loads barebox as the
next step bootloader.
I really like the way it is all integrated and how the two barebox
variants are built in one go.


> > Anyway, what's really missing is DT support. I scribbled a patch to get
> > you started in case you are motivated. Basically it's: Compile in the
> Motivated? No way ;) Obliged? More so. But first, I want to unbrick my
> device. First make it work, then make it beautiful.
> That being said, the two patches from this series are okay? I'd think
> they are still needed for other legacy systems even if I convert A9G20
> to DT in some ages.
> Thanks for your help!
>    Wolfram

More information about the barebox mailing list