|
|
@ -418,7 +418,7 @@ static int spinand_read_page(struct spinand_info *info, int page_id, |
|
|
|
u16 offset, u16 len, u8 *rbuf) |
|
|
|
{ |
|
|
|
int ret; |
|
|
|
u8 status = 0; |
|
|
|
u8 status = 0, eccerror = 0; |
|
|
|
|
|
|
|
#ifdef NOUSED_MTD_SPINAND_ONDIEECC |
|
|
|
if (enable_read_hw_ecc) { |
|
|
@ -440,12 +440,11 @@ static int spinand_read_page(struct spinand_info *info, int page_id, |
|
|
|
} |
|
|
|
|
|
|
|
if ((status & STATUS_OIP_MASK) == STATUS_READY) { |
|
|
|
if ((status & STATUS_ECC_MASK) == STATUS_ECC_ERROR) { |
|
|
|
if ((info->gd_ctype && (status & 0x70) == 0x70) || |
|
|
|
(!info->gd_ctype && (status & 0xc0) == 0x80)) { |
|
|
|
dev_err(&info->spi->dev, "ecc error, page=%d\n", |
|
|
|
page_id); |
|
|
|
ret = spinand_disable_ecc(info->spi); |
|
|
|
memset(rbuf,0,len); |
|
|
|
return 0; |
|
|
|
eccerror = 1; |
|
|
|
} |
|
|
|
break; |
|
|
|
} |
|
|
@ -461,6 +460,9 @@ static int spinand_read_page(struct spinand_info *info, int page_id, |
|
|
|
enable_read_hw_ecc = 0; |
|
|
|
} |
|
|
|
#endif |
|
|
|
if (eccerror && offset <= info->writesize && offset + len > info->writesize) { |
|
|
|
rbuf[info->writesize - offset] = 0; |
|
|
|
} |
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
@ -924,6 +926,7 @@ int spinand_probe(struct spi_device *spi_nand) |
|
|
|
ret = nand_scan_ident(mtd, 1); |
|
|
|
if (ret) |
|
|
|
return -ENOMEM; |
|
|
|
info->writesize = mtd->writesize; |
|
|
|
|
|
|
|
if(info->gd_ctype == 1) { |
|
|
|
spinand_driver_strength(info->spi); |
|
|
|