All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: mtd: nand: fsl_ifc: fix handing of bit flips in erased pages
@ 2017-05-25 23:33 Darwin Dingel
  2017-05-29  8:48 ` Boris Brezillon
  2017-05-31 20:49 ` Pavel Machek
  0 siblings, 2 replies; 8+ messages in thread
From: Darwin Dingel @ 2017-05-25 23:33 UTC (permalink / raw)
  To: Pavel Machek, Boris Brezillon
  Cc: richard, dwmw2, computersforpeace, marek.vasut, cyrille.pitchen,
	linux-mtd, linux-kernel, mark.marshall, b44839, prabhakar

Hi,

We are also having the same problem where the IFC (nand flash) was 
reporting ECC uncorrectable errors on single bitflips with erased pages. 
Applying this patch with some minor modifications seems to solve our 
issue. We are still doing more testing but recent results looks promising.

Our kernel is 4.4.6 so we have to modify it a bit to fit the old ECC 
layout structure. We just have a few comments about the patch:

 > -				if (!is_blank(mtd, bufnum))
 > -					ctrl->nand_stat |=
 > -						IFC_NAND_EVTER_STAT_ECCER;
 > -				break;
 > +				ctrl->nand_stat |= IFC_NAND_EVTER_STAT_ECCER;

Added 'error = 0' after setting the flag since no error was actually 
corrected.

 > -	if (ctrl->nand_stat & IFC_NAND_EVTER_STAT_ECCER)
 > -		dev_err(priv->dev, "NAND Flash ECC Uncorrectable Error\n");
 > -
 >  	if (ctrl->nand_stat != IFC_NAND_EVTER_STAT_OPC)
 >  		mtd->ecc_stats.failed++;
 > +
 > +	if (ctrl->nand_stat & IFC_NAND_EVTER_STAT_ECCER) {
 > +		int res;
 > +
 > +		if (!oob_required)
 > +			fsl_ifc_read_buf(mtd, chip->oob_poi, mtd->oobsize);
 > +
 > +		res = check_erased_page(chip, buf);
 > +		return res;
 > +	}

We have to do the check IFC_NAND_EVTER_STAT_ECCER first because the 
condition (ctrl->nand_stat != IFC_NAND_EVTER_STAT_OPC) will never be 
true since IFC always sets IFC_NAND_EVTER_STAT_ECCER on empty pages. 
Incrementing failed stats first before doing check_erased_page() makes 
nand_read() report ECC error all time.

Our exact modification was:
	if (ctrl->nand_stat & IFC_NAND_EVTER_STAT_ECCER) {
		if (!oob_required)
			fsl_ifc_read_buf(mtd, chip->oob_poi, mtd->oobsize);

		return check_erased_page(chip, buf);
	}

	if (ctrl->nand_stat != IFC_NAND_EVTER_STAT_OPC)
		mtd->ecc_stats.failed++;

Because check_erased_page() will be updating the failed stat anyway.


Cheers,
Darwin

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2017-06-13  8:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-25 23:33 mtd: nand: fsl_ifc: fix handing of bit flips in erased pages Darwin Dingel
2017-05-29  8:48 ` Boris Brezillon
2017-05-31 22:18   ` Pavel Machek
2017-05-31 20:49 ` Pavel Machek
2017-05-31 21:52   ` Darwin Dingel
2017-05-31 22:15     ` Pavel Machek
2017-06-07 21:59       ` Darwin Dingel
2017-06-13  8:24         ` Pavel Machek

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.