1
0
mirror of git://projects.qi-hardware.com/xburst-tools.git synced 2024-12-23 17:59:32 +02:00

Bad magic when booting from NAND

Qi fails to boot from NAND. Qi booting from SD goes fine. Booting NAND
from NOR works as well.

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.

This patch fixes the bug.

Signed-off-by: Dmitry Kurochkin <dmitry.kurochkin@gmail.com>
This commit is contained in:
Dmitry Kurochkin 2009-04-10 00:14:49 +04:00 committed by Nelson Castillo
parent 796fea906e
commit 0ca1d89412

View File

@ -119,7 +119,6 @@ int nand_read_ll(unsigned char *buf, unsigned long start_block512,
int blocks512)
{
int i, j;
int bad_count = 0;
/* chip Enable */
nand_select();
@ -129,11 +128,10 @@ int nand_read_ll(unsigned char *buf, unsigned long start_block512,
;
while (blocks512 > 0) {
if (s3c2442_nand_is_bad_block(start_block512) ||
s3c2442_nand_is_bad_block(start_block512 + 4)) {
if (s3c2442_nand_is_bad_block(start_block512)) {
start_block512 += 4;
blocks512 += 4;
if (bad_count++ == 4)
if (start_block512 >> 2 > BAD_BLOCK_OFFSET)
/* end of NAND */
return -1;
continue;
}