public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Re: [PATCH 2/2] NAND on DM355: Add 4-bit ECC support for large page NAND chips
@ 2009-05-07  8:59 vimal singh
  2009-05-07  9:11 ` David Brownell
  0 siblings, 1 reply; 12+ messages in thread
From: vimal singh @ 2009-05-07  8:59 UTC (permalink / raw)
  To: nsnehaprabha
  Cc: davinci-linux-open-source, David Brownell, linux-mtd, tglx, dwmw2,
	akpm

On Thu, May 7, 2009 at 12:46 PM, David Brownell <david-b@pacbell.net> wrote:
> I'm glad to see this patch is so small ... basically, just
> adding a special case for 2K pages, and keeping the core of
> this NAND driver the same.  Not needing to change the 4-bit
> ECC support from the patch I sent earlier seems a good sign.
>
> Two comments though:  (a) the board-dm355-evm.c file isn't
> yet in mainline, so the MTD folk can't take this patch as-is;
> (b) as noted elsewhere, there are still issues with 4K pages
> and the NAND core infrastructure.
>
> This patch is sufficient to support development boards for
> the dm355, dm357, and dm365 ... right?  They all have 2 GByte
> NAND chips, ISTR with 2K pages, and haven't yet had to switch
> to more current parts with 4K pages.
>
>
> On Wednesday 06 May 2009, nsnehaprabha@ti.com wrote:
>> --- a/drivers/mtd/nand/davinci_nand.c
>> +++ b/drivers/mtd/nand/davinci_nand.c
>> @@ -500,6 +500,21 @@ static struct nand_ecclayout hwecc4_small __initconst
>> = { },
>>  };
>>
>> +/* An ECC layout for using 4-bit ECC with large-page (2048bytes) flash,
>> + * storing ten ECC bytes plus the manufacturer's bad block marker byte,
>> + * and not overlapping the default BBT markers.
>> + */
>> +static struct nand_ecclayout hwecc4_2048 __initconst = {
>> +       .eccbytes = 10,
>
> Not ".eccbytes = 40"?  This is 4 chunks, 10 ecc bytes each...
>
>
>> +       .eccpos = { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10,
>> +               11, 12, 13, 14, 15, 24, 25, 26, 27, 28,
>> +               29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
>> +               39, 40, 41, 42, 43, 44, 45, 46, 47, 48, },
>> +       .oobfree = {
>> +               {.offset = 16, .length = 8, },
>> +               {.offset = 49, },
>
> Comments would be good, highlighting (a) byte 5 is reserved,
> it's the manufacturer bad block marker, (b) 8 bytes @16 are
> expected by JFFS2.  Not everyone will "just know" those.
How about leaving bytes '4' and '5' for bad block marker, to support 16-bit
NAND parts too.

---
Regards,
\/ | |\/| /-\ |_

^ permalink raw reply	[flat|nested] 12+ messages in thread
[parent not found: <43965.192.168.10.89.1241763647.squirrel@dbdmail.itg.ti.com>]
[parent not found: <46149.192.168.10.89.1241686786.squirrel@dbdmail.itg.ti.com>]
* [PATCH 2/2] NAND on DM355: Add 4-bit ECC support for large page NAND chips
@ 2009-05-07  2:29 nsnehaprabha
  2009-05-07  7:16 ` David Brownell
  0 siblings, 1 reply; 12+ messages in thread
From: nsnehaprabha @ 2009-05-07  2:29 UTC (permalink / raw)
  To: linux-mtd, davinci-linux-open-source, dwmw2, tglx, akpm; +Cc: Sneha Narnakaje

From: Sneha Narnakaje <nsnehaprabha@ti.com>

This patch adds 4-bit ECC support for large page NAND chips using the new ECC
mode NAND_ECC_HW_OOB_FIRST. The platform data from board-dm355-evm has been
adjusted to use this mode.

The patches have been verified on DM355 device with 2K Micron devices using
mtd-tests and JFFS2. Error correction upto 4-bits has also been verified using
nandwrite/nanddump utilities.

Note: This patch is dependent on '[patch 2.6.30-rc1] NAND: minor davinci
nand cleanup' and '[patch 2.6.30-rc1] NAND: davinci nand, 4-bit ECC for
smallpage' from David Brownell:
http://lists.infradead.org/pipermail/linux-mtd/2009-April/025206.html
http://lists.infradead.org/pipermail/linux-mtd/2009-April/025207.html

Signed-off-by: Sneha Narnakaje <nsnehaprabha@ti.com>
---
 arch/arm/mach-davinci/board-dm355-evm.c |    3 ++-
 drivers/mtd/nand/davinci_nand.c         |   22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+), 1 deletions(-)

diff --git a/arch/arm/mach-davinci/board-dm355-evm.c b/arch/arm/mach-davinci/board-dm355-evm.c
index f32e3d8..39c5a4e 100644
--- a/arch/arm/mach-davinci/board-dm355-evm.c
+++ b/arch/arm/mach-davinci/board-dm355-evm.c
@@ -85,8 +85,9 @@ static struct davinci_nand_pdata davinci_nand_data = {
 	.mask_chipsel		= BIT(14),
 	.parts			= davinci_nand_partitions,
 	.nr_parts		= ARRAY_SIZE(davinci_nand_partitions),
-	.ecc_mode		= NAND_ECC_HW_SYNDROME,
+	.ecc_mode		= NAND_ECC_HW,
 	.options		= NAND_USE_FLASH_BBT,
+	.ecc_bits		= 4,
 };
 
 static struct resource davinci_nand_resources[] = {
diff --git a/drivers/mtd/nand/davinci_nand.c b/drivers/mtd/nand/davinci_nand.c
index 006843a..f84bc16 100644
--- a/drivers/mtd/nand/davinci_nand.c
+++ b/drivers/mtd/nand/davinci_nand.c
@@ -500,6 +500,21 @@ static struct nand_ecclayout hwecc4_small __initconst = {
 	},
 };
 
+/* An ECC layout for using 4-bit ECC with large-page (2048bytes) flash,
+ * storing ten ECC bytes plus the manufacturer's bad block marker byte,
+ * and not overlapping the default BBT markers.
+ */
+static struct nand_ecclayout hwecc4_2048 __initconst = {
+	.eccbytes = 10,
+	.eccpos = { 0, 1, 2, 3, 4, 6, 7, 8, 9, 10,
+		11, 12, 13, 14, 15, 24, 25, 26, 27, 28,
+		29, 30, 31, 32, 33, 34, 35, 36, 37, 38,
+		39, 40, 41, 42, 43, 44, 45, 46, 47, 48, },
+	.oobfree = {
+		{.offset = 16, .length = 8, },
+		{.offset = 49, },
+	},
+};
 
 static int __init nand_davinci_probe(struct platform_device *pdev)
 {
@@ -690,6 +705,13 @@ static int __init nand_davinci_probe(struct platform_device *pdev)
 				info->mtd.oobsize - 16;
 			goto syndrome_done;
 		}
+		if (chunks == 4) {
+			info->ecclayout = hwecc4_2048;
+			info->ecclayout.oobfree[1].length =
+				info->mtd.oobsize - 49;
+			info->chip.ecc.mode = NAND_ECC_HW_OOB_FIRST;
+			goto syndrome_done;
+		}
 
 		/* For large page chips we'll be wanting to use a
 		 * not-yet-implemented mode that reads OOB data
-- 
1.6.0.4

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

end of thread, other threads:[~2009-05-09  4:25 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-07  8:59 [PATCH 2/2] NAND on DM355: Add 4-bit ECC support for large page NAND chips vimal singh
2009-05-07  9:11 ` David Brownell
     [not found] <43965.192.168.10.89.1241763647.squirrel@dbdmail.itg.ti.com>
2009-05-09  4:24 ` vimal singh
     [not found] <46149.192.168.10.89.1241686786.squirrel@dbdmail.itg.ti.com>
2009-05-07  9:50 ` vimal singh
2009-05-07 16:54   ` David Brownell
  -- strict thread matches above, loose matches on Subject: below --
2009-05-07  2:29 nsnehaprabha
2009-05-07  7:16 ` David Brownell
2009-05-07 14:13   ` Narnakaje, Snehaprabha
2009-05-07 17:11     ` David Brownell
2009-05-07 18:02       ` Narnakaje, Snehaprabha
2009-05-07 22:37       ` Troy Kisky
2009-05-08  0:03         ` Narnakaje, Snehaprabha

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox