If your SoC has a NAND Flash Controller and PMECC, then the recommended setup for NAND booting is to provide the NAND Flash parameters and ECC requirements by a specific header written at the beginning of the first page of the NAND Flash.
The AT91Bootstrap image would immediately follow this NAND parameter header (at offset +0xD0).
This header of NAND and PMECC parameters is simply 208 (0xD0) bytes consisting of a 32-bit word repeated 52 times.
Refer to the SoC datasheet for the encoding of the parameters.
For the following Atmel boards the word values are:
Code: Select all
AT91SAM9x5-EK 0xC0C00405
AT91SAM9N12-EK 0xC0C00405
SAMA5D2-XULT 0xC???????
SAMA5D2-PTC-EK 0xC1E04E07 (this value from SAM-BA doesn't correlate with Micron datasheet)
SAMA5D3x-EK 0xC0902405
SAMA5D3-XPLD 0xC0902405
SAMA5D4-EK 0xC1E04E07
SAMA5D4-XULT 0xC1E04E07
These values are board specific (i.e. the pairing of SoC and NAND), rather than SoC specific.
If your board uses a different NAND chip than the Atmel board, then the NAND parameter header value may well be different.
The following U-Boot commands would build/install the NAND parameter header and AT91Bootstrap image in the NAND flash of a SAMA5D4-XULT:
Code: Select all
U-Boot> mw.b 20000000 ff 40000
U-Boot> mw.l 20000000 c1e04e07 34
U-Boot> tftpboot 200000d0 boot.bin
U-Boot> nand erase 0 40000
U-Boot> nand write 20000000 0 40000
Regards