|
|
@ -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,13 +440,12 @@ 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) { |
|
|
|
dev_err(&info->spi->dev, "ecc error, page=%d\n", |
|
|
|
page_id); |
|
|
|
ret = spinand_disable_ecc(info->spi); |
|
|
|
memset(rbuf,0,len); |
|
|
|
return 0; |
|
|
|
} |
|
|
|
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); |
|
|
|
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; |
|
|
|
} |
|
|
|
|
|
|
@ -530,7 +532,7 @@ static int spinand_program_execute(struct spi_device *spi_nand, int page_id) |
|
|
|
* Poll to wait for the tPROG time to finish the transaction. |
|
|
|
*/ |
|
|
|
static int spinand_program_page(struct spinand_info *info, |
|
|
|
int page_id, u16 offset, u16 len, u8 *buf) |
|
|
|
int page_id, u16 offset, u16 len, u8 *buf) |
|
|
|
{ |
|
|
|
int retval; |
|
|
|
u8 status = 0; |
|
|
@ -811,7 +813,7 @@ static void spinand_cmdfunc(struct mtd_info *mtd, unsigned int command, |
|
|
|
/* PAGEPROG reuses all of the setup from SEQIN and adds the length */ |
|
|
|
case NAND_CMD_PAGEPROG: |
|
|
|
spinand_program_page(info, state->row, state->col, |
|
|
|
state->buf_ptr, state->buf); |
|
|
|
state->buf_ptr, state->buf); |
|
|
|
break; |
|
|
|
case NAND_CMD_STATUS: |
|
|
|
spinand_get_otp(info->spi, state->buf); |
|
|
@ -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); |
|
|
|