mtd: txx9ndfmc: limit transfer bytes to 512 (ECC provides 6 bytes max)

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Thu Jan 6 10:59:04 EST 2011


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=24ac9a94f9e21ea71d877b0c80867d625b68bec2
Commit:     24ac9a94f9e21ea71d877b0c80867d625b68bec2
Parent:     e8953b7395089b917f30d0909f845664d5fafa4e
Author:     Ralf Rösch <ralf.roesch at rw-gmbh.de>
AuthorDate: Thu Dec 30 10:30:11 2010 +0100
Committer:  David Woodhouse <David.Woodhouse at intel.com>
CommitDate: Thu Jan 6 15:29:12 2011 +0000

    mtd: txx9ndfmc: limit transfer bytes to 512 (ECC provides 6 bytes max)
    
    See commit: c0cbfd0e81d879a950ba6f0df3f75ea30c5ab16e
    Using __nand_correct_data() helper function, this driver can read 512
    byte (with 6 byte ECC) at a time.
    
    This is correct, but not more:
    With NAND chips providing page sizes > 512 Bytes
    chip->ecc.bytes are calculated > 6 in txx9ndfmc_nand_scan.
    According the data sheet there are (only) 6 bytes ECC available.
    
    After applying the patch a Hynix 512M*8 with 2KiB page size could be
    successfully formatted and used with an ubifs file system.
    
    Signed-off-by: Ralf Roesch <ralf.roesch at rw-gmbh.de>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.com>
    Acked-by: Atsushi Nemoto <anemo at mba.ocn.ne.jp>
    Signed-off-by: David Woodhouse <David.Woodhouse at intel.com>
---
 drivers/mtd/nand/txx9ndfmc.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/nand/txx9ndfmc.c b/drivers/mtd/nand/txx9ndfmc.c
index 054a41c..ca270a4 100644
--- a/drivers/mtd/nand/txx9ndfmc.c
+++ b/drivers/mtd/nand/txx9ndfmc.c
@@ -277,8 +277,9 @@ static int txx9ndfmc_nand_scan(struct mtd_info *mtd)
 	ret = nand_scan_ident(mtd, 1, NULL);
 	if (!ret) {
 		if (mtd->writesize >= 512) {
-			chip->ecc.size = mtd->writesize;
-			chip->ecc.bytes = 3 * (mtd->writesize / 256);
+			/* Hardware ECC 6 byte ECC per 512 Byte data */
+			chip->ecc.size = 512;
+			chip->ecc.bytes = 6;
 		}
 		ret = nand_scan_tail(mtd);
 	}



More information about the linux-mtd-cvs mailing list