mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-12-23 21:22:05 +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:
parent
796fea906e
commit
0ca1d89412
@ -119,7 +119,6 @@ int nand_read_ll(unsigned char *buf, unsigned long start_block512,
|
|||||||
int blocks512)
|
int blocks512)
|
||||||
{
|
{
|
||||||
int i, j;
|
int i, j;
|
||||||
int bad_count = 0;
|
|
||||||
|
|
||||||
/* chip Enable */
|
/* chip Enable */
|
||||||
nand_select();
|
nand_select();
|
||||||
@ -129,11 +128,10 @@ int nand_read_ll(unsigned char *buf, unsigned long start_block512,
|
|||||||
;
|
;
|
||||||
|
|
||||||
while (blocks512 > 0) {
|
while (blocks512 > 0) {
|
||||||
if (s3c2442_nand_is_bad_block(start_block512) ||
|
if (s3c2442_nand_is_bad_block(start_block512)) {
|
||||||
s3c2442_nand_is_bad_block(start_block512 + 4)) {
|
|
||||||
start_block512 += 4;
|
start_block512 += 4;
|
||||||
blocks512 += 4;
|
if (start_block512 >> 2 > BAD_BLOCK_OFFSET)
|
||||||
if (bad_count++ == 4)
|
/* end of NAND */
|
||||||
return -1;
|
return -1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user