[PATCH v3 3/5] mtd: nand: add generic READ RETRY support

Brian Norris computersforpeace at gmail.com
Mon Jan 13 03:04:00 EST 2014


On Tue, Jan 07, 2014 at 02:17:34PM +0800, Huang Shijie wrote:
> On Fri, Jan 03, 2014 at 04:37:06PM -0800, Brian Norris wrote:
> > @@ -1514,8 +1535,27 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
> >  					nand_wait_ready(mtd);
> >  			}
> >  
> > -			if (mtd->ecc_stats.failed - ecc_failures)
> > -				ecc_fail = true;
> > +			if (mtd->ecc_stats.failed - ecc_failures) {
> > +				if (retry_mode + 1 <= chip->read_retries) {
> > +					retry_mode++;
> > +					pr_debug("ECC error; performing READ RETRY %d\n",
> > +							retry_mode);
> 
> you can move this pr_debug into the nand_set_read_retry().

OK.

> > +
> > +					ret = nand_set_read_retry(mtd,
> > +							retry_mode);
> > +					if (ret < 0)
> > +						break;
> > diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
> > index 029fe5948dc4..ef70505dade1 100644
> > --- a/include/linux/mtd/nand.h
> > +++ b/include/linux/mtd/nand.h
> > @@ -472,6 +472,8 @@ struct nand_buffers {
> >   *			commands to the chip.
> >   * @waitfunc:		[REPLACEABLE] hardwarespecific function for wait on
> >   *			ready.
> > + * @set_read_retry:	[FLASHSPECIFIC] flash (vendor) specific function for
> > + *			setting the read-retry mode. Mostly needed for MLC NAND.
> 
> why not use the name "read_retry"?
> i think it is more clear.

It's not actually performing any "read" or a "retry"; the function is
just configuring the device for a retry. So I don't think read_retry is
correct. For my name, I was abbreviating "set read retry mode". How do
you like "setup_read_retry" or "set_read_retry_mode"?

Brian



More information about the linux-mtd mailing list