[Qi] bad magic when booting from NAND

Dmitry Kurochkin dmitry.kurochkin at gmail.com
Thu Apr 9 22:14:49 CEST 2009


I have found the problem. The error was because we check if the
current block is bad or the next one is bad. And skip the current
block even if only the next one is bad. This way we skip good block
before a bad one.

Attached is a patch to fix it. Besides I have removed 4 bad block
count limit. Instead I check if we read till the end of nand. Or at
least this is what this code supposed to do:

if (start_block512 >> 2 > BAD_BLOCK_OFFSET)
    /* end of NAND */
    return -1;

I am not sure this is the best and/or correct way to do the stop check.

A similar check for bad block ahead the current one was added to
u-boot in commit 4ec60973cf2e028de905f6ea1f81ef99ca60d834 by Michael:

    Change the skip bad block. Avoid false positives by only checking
    the beginning of a block and check the second page

Qi code does the same thing. But it seems to be wrong at least in my case.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: nand_bad_block.patch
Type: text/x-diff
Size: 813 bytes
Desc: not available
Url : http://lists.openmoko.org/pipermail/openmoko-kernel/attachments/20090410/47ed039a/attachment.patch 

More information about the openmoko-kernel mailing list