{40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55,
56, 57, 58, 59, 60, 61, 62, 63};
-static u_char eccvalid_pos = 4;
static unsigned long chipsize = (256 << 20);
/* check bad block */
/* 0th word in spare area needs be 0xff */
- if (nand_read_oob(oob_buf, block_addr) || (oob_buf[0] & 0xff) != 0xff){
+ if (nand_read_oob((u_char *)oob_buf, block_addr) || (oob_buf[0] & 0xff) != 0xff){
printf("Skipped bad block at 0x%x\n", block_addr);
return 1; /* skip bad block */
}
return 0;
}
-static count = 0;
+
/* read a page with ECC */
static int nand_read_page(u_char *buf, ulong page_addr)
{
u_char ecc_code[ECC_SIZE];
u_char ecc_calc[ECC_STEPS];
u_char oob_buf[OOB_SIZE];
+ int count;
#endif
u16 val;
int cntr;
/* A delay seems to be helping here. needs more investigation */
delay(10000);
len = (bus_width == 16) ? PAGE_SIZE >> 1 : PAGE_SIZE;
- p = buf;
+ p = (void *)buf;
for (cntr = 0; cntr < len; cntr++){
*p++ = READ_NAND(NAND_ADDR);
delay(10);
}
#ifdef ECC_CHECK_ENABLE
- p = oob_buf;
+ p = (void *)oob_buf;
len = (bus_width == 16) ? OOB_SIZE >> 1 : OOB_SIZE;
for (cntr = 0; cntr < len; cntr++){
*p++ = READ_NAND(NAND_ADDR);
delay(10);
}
- count = 0;
NAND_DISABLE_CE(); /* set pin high */
/* Pick the ECC bytes out of the oob data */
*/
static int nand_read_oob(u_char *buf, ulong page_addr)
{
- u16 val;
int cntr;
int len;
#else
u_char *p;
#endif
- p = buf;
+ p = (void *)buf;
len = (bus_width == 16) ? OOB_SIZE >> 1 : OOB_SIZE;
NAND_ENABLE_CE(); /* set pin low */