[U-Boot] [PATCH v3 2/6] MX31: Add NAND SPL for i.MX31.
Magnus Lilja
lilja.magnus at gmail.com
Wed Jun 10 18:21:44 CEST 2009
Wolfang,
2009/6/9 Wolfgang Denk <wd at denx.de>:
> Dear Magnus Lilja,
>
> In message <15c41c2e93fb138829871cd901fc20cda3b433d8.1244572159.git.lilja.magnus at gmail.com> you wrote:
>> This patch adds the NAND SPL framework needed to boot i.MX31 boards
>> from NAND.
>>
>> It has been tested on a i.MX31 PDK board with large page NAND. Small
>> page NANDs should work as well, but this has not been tested.
>>
>> Note: The i.MX31 NFC uses a non-standard layout for large page NANDs,
>> whether this is compatible with a particular setup depends on how
>> the NAND device is programmed by the flash programmer (e.g. JTAG
>> debugger).
>>
>> The patch is based on the work by Maxim Artamonov.
>>
>> Signed-off-by: Maxim Artamonov <scn1874 at yandex.ru>
>> Signed-off-by: Magnus Lilja <lilja.magnus at gmail.com>
> ...
>> +static int is_badblock(int pagenumber)
>> +{
>> + int page = pagenumber;
>> + int maxpagecheck = CONFIG_SYS_NAND_PAGE_SIZE == 0x800 ? 2 : 1;
>> + u32 badblock;
>> + u32 *src;
>> +
>> + // todo shall we check both or only one of them?
>
> Please do not use C++ comments.
Thought I had searched for all // and todo's but obviously missed one, thanks.
>
>> +void nand_boot(void)
>> +{
>> + __attribute__((noreturn)) void (*uboot)(void);
>> +
>> + nfc = (void *)NFC_BASE_ADDR;
>> +
>> + /*
>> + * CONFIG_SYS_NAND_U_BOOT_OFFS and CONFIG_SYS_NAND_U_BOOT_SIZE must
>> + * be aligned to full pages
>> + */
>> + if (!nand_load(CONFIG_SYS_NAND_U_BOOT_OFFS, CONFIG_SYS_NAND_U_BOOT_SIZE,
>> + (uchar *)CONFIG_SYS_NAND_U_BOOT_DST)) {
>> + /* Copy from NAND successful, start U-boot */
>> + uboot = (void *)CONFIG_SYS_NAND_U_BOOT_START;
>> + uboot();
>> + } else {
>> + /* Unrecoverable error when copying from NAND */
>> + while (1) {
>> + /* Loop forever */
>> + }
>
> No braces needed for single line constructs. And why don't you simply
> call hang() here (which might be doing additional things on some
> boards. like flashing some LED or so)?
I'll call hang().
>> +}
>> +
>> +/*
>> + * Called from start.S in case of an exception.
>> + */
>> +void hang(void)
>> +{
>> + while (1) {
>> + /* Loop forever */
>> + }
>
> No braces needed for single line constructs. And I think some (older)
> compilers might complain about a missing ';'.
OK, will fix.
Thanks, Magnus
More information about the U-Boot
mailing list