public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Aaron Sierra <asierra@xes-inc.com>
To: Boris Brezillon <boris.brezillon@free-electrons.com>
Cc: linux-mtd@lists.infradead.org,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>,
	Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Subject: Re: [PATCH 1/2] nand_base: SOFT_BCH: Request strength over bytes
Date: Wed, 14 Jan 2015 13:08:58 -0600 (CST)	[thread overview]
Message-ID: <1570213860.118219.1421262538951.JavaMail.zimbra@xes-inc.com> (raw)
In-Reply-To: <20150114103449.331342ba@bbrezillon>

----- Original Message -----
> From: "Boris Brezillon" <boris.brezillon@free-electrons.com>
> Sent: Wednesday, January 14, 2015 3:34:49 AM
> 
> Hi Aaron,
> 
> On Mon, 12 Jan 2015 18:35:55 -0600 (CST)
> Aaron Sierra <asierra@xes-inc.com> wrote:
> 
> > Previously, we requested that drivers pass ecc.size and ecc.bytes when
> > using NAND_ECC_SOFT_BCH. However, a driver is likely to only know the ECC
> > strength required for its NAND, so each driver would need to perform a
> > strength-to-bytes calculation.
> > 
> > Avoid duplicating this calculation in each driver by asking drivers to
> > pass ecc.size and ecc.strength so that the strength-to-bytes calculation
> > need only be implemented once.
> > 
> > This reverts/generalizes this commit:
> >     mtd: nand: Base BCH ECC bytes on required strength
> 
> Apart from the nit below, you can add my:
> 
> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> 
> > 
> > Signed-off-by: Aaron Sierra <asierra@xes-inc.com>
> > ---
> >  drivers/mtd/nand/nand_base.c  | 21 +++++++++++++++------
> >  drivers/mtd/nand/sunxi_nand.c |  2 --
> >  2 files changed, 15 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
> > index 41585df..993612c 100644
> > --- a/drivers/mtd/nand/nand_base.c
> > +++ b/drivers/mtd/nand/nand_base.c
> > @@ -4028,22 +4028,31 @@ int nand_scan_tail(struct mtd_info *mtd)
> >  		ecc->read_oob = nand_read_oob_std;
> >  		ecc->write_oob = nand_write_oob_std;
> >  		/*
> > -		 * Board driver should supply ecc.size and ecc.bytes values to
> > -		 * select how many bits are correctable; see nand_bch_init()
> > -		 * for details. Otherwise, default to 4 bits for large page
> > -		 * devices.
> > +		 * Board driver should supply ecc.size and ecc.strength values
> > +		 * to select how many bits are correctable. Otherwise, default
> > +		 * to 4 bits for large page devices.
> >  		 */
> >  		if (!ecc->size && (mtd->oobsize >= 64)) {
> >  			ecc->size = 512;
> > -			ecc->bytes = DIV_ROUND_UP(13 * ecc->strength, 8);
> > +			ecc->strength = 4;
> >  		}
> > +
> > +		/*
> > +		 * We previously recommended drivers pass ecc.size and
> > +		 * ecc.bytes. Continue to support drivers that do.
> > +		 * See nand_bch_init() for details.
> > +		 */
> > +		if (ecc->bytes && !ecc->strength)
> > +			ecc->strength = ecc->bytes * 8 / fls(8 * ecc->size);
> 
> How about fixing all NAND_ECC_SOFT_BCH users (AFAICT the only remaining
> one is nandsim, since you fixed sunxi_nand) instead of keeping this
> backward compat code.

Boris,
Yes, nandsim was the only other that I found. I will submit an update that
does not include this backward compatibility code, thanks.

-Aaron

> 
> Best Regards,
> 
> Boris

  reply	other threads:[~2015-01-14 19:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <2021171878.109755.1421108768347.JavaMail.zimbra@xes-inc.com>
2015-01-13  0:35 ` [PATCH 1/2] nand_base: SOFT_BCH: Request strength over bytes Aaron Sierra
2015-01-14  9:34   ` Boris Brezillon
2015-01-14 19:08     ` Aaron Sierra [this message]
2015-01-14 23:41     ` [PATCH 1/2 v2] " Aaron Sierra
2015-01-29 16:46       ` Aaron Sierra
2015-02-02  5:12         ` Brian Norris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1570213860.118219.1421262538951.JavaMail.zimbra@xes-inc.com \
    --to=asierra@xes-inc.com \
    --cc=boris.brezillon@free-electrons.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=ezequiel@vanguardiasur.com.ar \
    --cc=linux-mtd@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox