Commit 223cf6c3 authored by Yeasah Pell's avatar Yeasah Pell Committed by David Woodhouse

mtd: pxa3xx_nand: add single-bit error corrections reporting

Acked-by: default avatarEric Miao <eric.y.miao@gmail.com>
Signed-off-by: default avatarYeasah Pell <yeasah@comrex.com>
Signed-off-by: default avatarMike Rapoport <mike@compulab.co.il>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 71b7d0d9
...@@ -102,6 +102,7 @@ enum { ...@@ -102,6 +102,7 @@ enum {
ERR_SENDCMD = -2, ERR_SENDCMD = -2,
ERR_DBERR = -3, ERR_DBERR = -3,
ERR_BBERR = -4, ERR_BBERR = -4,
ERR_SBERR = -5,
}; };
enum { enum {
...@@ -564,11 +565,13 @@ static irqreturn_t pxa3xx_nand_irq(int irq, void *devid) ...@@ -564,11 +565,13 @@ static irqreturn_t pxa3xx_nand_irq(int irq, void *devid)
status = nand_readl(info, NDSR); status = nand_readl(info, NDSR);
if (status & (NDSR_RDDREQ | NDSR_DBERR)) { if (status & (NDSR_RDDREQ | NDSR_DBERR | NDSR_SBERR)) {
if (status & NDSR_DBERR) if (status & NDSR_DBERR)
info->retcode = ERR_DBERR; info->retcode = ERR_DBERR;
else if (status & NDSR_SBERR)
info->retcode = ERR_SBERR;
disable_int(info, NDSR_RDDREQ | NDSR_DBERR); disable_int(info, NDSR_RDDREQ | NDSR_DBERR | NDSR_SBERR);
if (info->use_dma) { if (info->use_dma) {
info->state = STATE_DMA_READING; info->state = STATE_DMA_READING;
...@@ -670,7 +673,7 @@ static void pxa3xx_nand_cmdfunc(struct mtd_info *mtd, unsigned command, ...@@ -670,7 +673,7 @@ static void pxa3xx_nand_cmdfunc(struct mtd_info *mtd, unsigned command,
if (prepare_read_prog_cmd(info, cmdset->read1, column, page_addr)) if (prepare_read_prog_cmd(info, cmdset->read1, column, page_addr))
break; break;
pxa3xx_nand_do_cmd(info, NDSR_RDDREQ | NDSR_DBERR); pxa3xx_nand_do_cmd(info, NDSR_RDDREQ | NDSR_DBERR | NDSR_SBERR);
/* We only are OOB, so if the data has error, does not matter */ /* We only are OOB, so if the data has error, does not matter */
if (info->retcode == ERR_DBERR) if (info->retcode == ERR_DBERR)
...@@ -687,7 +690,7 @@ static void pxa3xx_nand_cmdfunc(struct mtd_info *mtd, unsigned command, ...@@ -687,7 +690,7 @@ static void pxa3xx_nand_cmdfunc(struct mtd_info *mtd, unsigned command,
if (prepare_read_prog_cmd(info, cmdset->read1, column, page_addr)) if (prepare_read_prog_cmd(info, cmdset->read1, column, page_addr))
break; break;
pxa3xx_nand_do_cmd(info, NDSR_RDDREQ | NDSR_DBERR); pxa3xx_nand_do_cmd(info, NDSR_RDDREQ | NDSR_DBERR | NDSR_SBERR);
if (info->retcode == ERR_DBERR) { if (info->retcode == ERR_DBERR) {
/* for blank page (all 0xff), HW will calculate its ECC as /* for blank page (all 0xff), HW will calculate its ECC as
...@@ -861,8 +864,12 @@ static int pxa3xx_nand_ecc_correct(struct mtd_info *mtd, ...@@ -861,8 +864,12 @@ static int pxa3xx_nand_ecc_correct(struct mtd_info *mtd,
* consider it as a ecc error which will tell the caller the * consider it as a ecc error which will tell the caller the
* read fail We have distinguish all the errors, but the * read fail We have distinguish all the errors, but the
* nand_read_ecc only check this function return value * nand_read_ecc only check this function return value
*
* Corrected (single-bit) errors must also be noted.
*/ */
if (info->retcode != ERR_NONE) if (info->retcode == ERR_SBERR)
return 1;
else if (info->retcode != ERR_NONE)
return -1; return -1;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment