mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Christian Hemp <c.hemp@phytec.de>
Cc: barebox@lists.infradead.org, Stefan Lengfeld <s.lengfeld@phytec.de>
Subject: Re: [PATCH 2/2] mtd: nand: nand_mxs: Fix readtotal calculation
Date: Fri, 21 Oct 2016 09:18:08 +0200	[thread overview]
Message-ID: <20161021071808.ygaw53zjn3x5ns6f@pengutronix.de> (raw)
In-Reply-To: <1476970807-43811-2-git-send-email-c.hemp@phytec.de>

On Thu, Oct 20, 2016 at 03:40:07PM +0200, Christian Hemp wrote:
> The calculation of readtotal must be bit alligend. If not the bch core
> finds bit flips in every page, because readtotal is too small.
> This bug was mostly introduced since commit "51061a9 mtd: nand: nand_mxs:
> Add subpage read support".

Is this somehow related to:

http://lists.infradead.org/pipermail/linux-mtd/2016-June/068243.html

Or is this another topic?

Sascha

> 
> Tested with:
> nand: NAND device: Manufacturer ID: 0x01, Chip ID: 0xd3 (AMD/Spansion
> S34ML08G2), 1024MiB, page size: 2048, OOB size: 128
> 
> nand: NAND device: Manufacturer ID: 0x2c, Chip ID: 0xdc (Micron
> MT29F4G08ABADAWP), 512MiB, page size: 2048, OOB size: 64
> 
> nand: NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung NAND
> 1GiB 3,3V 8-bit), 1024MiB, page size: 2048, OOB size: 64
> 
> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
> Signed-off-by: Stefan Lengfeld <s.lengfeld@phytec.de>
> ---
>  drivers/mtd/nand/nand_mxs.c | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mtd/nand/nand_mxs.c b/drivers/mtd/nand/nand_mxs.c
> index fe955e8..cba0bee 100644
> --- a/drivers/mtd/nand/nand_mxs.c
> +++ b/drivers/mtd/nand/nand_mxs.c
> @@ -728,15 +728,15 @@ static int __mxs_nand_ecc_read_page(struct mtd_info *mtd, struct nand_chip *nand
>  	uint32_t corrected = 0, failed = 0;
>  	uint8_t	*status;
>  	unsigned int  max_bitflips = 0;
> -	int i, ret, readtotal, nchunks, eccstrength, ecc_parity_size;
> +	int i, ret, readtotal, nchunks, eccstrength;
>  
>  	eccstrength = mxs_nand_get_ecc_strength(mtd->writesize, mtd->oobsize);
>  
>  	readlen = roundup(readlen, MXS_NAND_CHUNK_DATA_CHUNK_SIZE);
>  	nchunks = mxs_nand_ecc_chunk_cnt(readlen);
> -	ecc_parity_size = 13 * eccstrength / 8;
> -	readtotal = MXS_NAND_METADATA_SIZE +
> -		(MXS_NAND_CHUNK_DATA_CHUNK_SIZE + ecc_parity_size) * nchunks;
> +	readtotal =  MXS_NAND_METADATA_SIZE;
> +	readtotal += MXS_NAND_CHUNK_DATA_CHUNK_SIZE * nchunks;
> +	readtotal += DIV_ROUND_UP(13 * eccstrength * nchunks, 8);
>  
>  	mxs_nand_config_bch(mtd, readtotal);
>  
> -- 
> 1.9.1
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2016-10-21  7:18 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-20 13:40 [PATCH 1/2] nand: imx6: Changed default NAND clock Christian Hemp
2016-10-20 13:40 ` [PATCH 2/2] mtd: nand: nand_mxs: Fix readtotal calculation Christian Hemp
2016-10-21  7:18   ` Sascha Hauer [this message]
2016-10-24  8:51     ` Stefan Lengfeld
2016-10-21  7:11 ` [PATCH 1/2] nand: imx6: Changed default NAND clock Sascha Hauer
2016-10-24  9:20   ` Stefan Lengfeld
2016-10-25  6:21 ` Sascha Hauer

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=20161021071808.ygaw53zjn3x5ns6f@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=c.hemp@phytec.de \
    --cc=s.lengfeld@phytec.de \
    /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