RE: [PATCH 2/2] NAND on DM355: Add 4-bit ECC support for large page NAND chips

Narnakaje, Snehaprabha
2009-05-08T00:03:57Z

> -----Original Message-----
> From: Troy Kisky [mailto:troy.kisky@boundarydevices.com]
> Sent: Thursday, May 07, 2009 6:37 PM
> To: David Brownell
> Cc: Narnakaje, Snehaprabha; dwmw2@infradead.org; davinci-linux-open-
> source@linux.davincidsp.com; linux-mtd@lists.infradead.org;
> tglx@linutronix.de; akpm@linux-foundation.org
> Subject: Re: [PATCH 2/2] NAND on DM355: Add 4-bit ECC support for large
> page NAND chips
>
> >>>> +static struct nand_ecclayout hwecc4_2048 __initconst = {
> >>>> + .eccbytes = 10,
> >>> Not ".eccbytes = 40"? This is 4 chunks, 10 ecc bytes each...
> >> No, .eccbytes is for each chips->ecc.steps.
> >
> > So it's the same as ecc.bytes, which is not exported to userspace.
> >
> >
> >> And all nand read/write
> >> APIs, we handle ecc.steps (for loop). There is chips->ecc.total that
> >> is initialized as (chips->ecc.steps * chips->ecc.bytes).
> >>
> >> It is strange that .eccbytes is for each chunk, while eccpos[] and
> >> .oobfree[] have to handle/cover all chunks.
>
> No, eccbytes should equal ecc.total

Thanks Troy and Dave.

Yes, it should indeed be 40 --> total size. eccbytes in the nand_ecclayout is different from chip->ecc.bytes. We do set the chip->ecc.bytes to 10 which is for each trunk.

I will change this and test it.

>
>
> i.e. from nand_base.c
>
> static struct nand_ecclayout nand_oob_64 = {
> .eccbytes = 24,
> .eccpos = {
> 40, 41, 42, 43, 44, 45, 46, 47,
> 48, 49, 50, 51, 52, 53, 54, 55,
> 56, 57, 58, 59, 60, 61, 62, 63},
> .oobfree = {
> {.offset = 2,
> .length = 38}}
> };
> Troy
>
>