Browse Source

gigadevice raise error only 8 error status, and not disable ecc.

Change-Id: I89b77564c96ec08657980f060edc90c16dba3d20
Signed-off-by: Chong Qiao <qiaochong@loongson.cn>
master
Chong Qiao 3 years ago
parent
commit
4b998183c5
  1. 1
      include/linux/mtd/spinand.h
  2. 13
      sys/dev/nand/spinand_lld.c

1
include/linux/mtd/spinand.h

@ -81,6 +81,7 @@ struct spinand_info {
struct spi_device *spi;
void *priv;
int gd_ctype;
int writesize;
};
struct nand_state {

13
sys/dev/nand/spinand_lld.c

@ -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);

Loading…
Cancel
Save