Dear Magnus Lilja,

In message 
<15c41c2e93fb138829871cd901fc20cda3b433d8.1244572159.git.lilja.mag...@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 <scn1...@yandex.ru>
> Signed-off-by: Magnus Lilja <lilja.mag...@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.

> +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)?

> +}
> +
> +/*
> + * 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 ';'.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
Documentation is like sex: when it is good, it is  very,  very  good;
and when it is bad, it is better than nothing.         - Dick Brandon
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to