mtd: txx9ndfmc: limit transfer bytes to 512 (ECC provides 6 bytes max)
authorRalf Rösch <ralf.roesch@rw-gmbh.de>
Thu, 30 Dec 2010 09:30:11 +0000 (10:30 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Thu, 6 Jan 2011 15:29:12 +0000 (15:29 +0000)
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@rw-gmbh.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Acked-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/mtd/nand/txx9ndfmc.c

index 054a41c0ef4afab8843811fea32b5fca428c7095..ca270a4881a47c2acf42e7bf6a6270a332c59060 100644 (file)
@@ -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);
        }