Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@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>

authored by

Ralf Rösch and committed by
David Woodhouse
24ac9a94 e8953b73

+3 -2
+3 -2
drivers/mtd/nand/txx9ndfmc.c
··· 277 277 ret = nand_scan_ident(mtd, 1, NULL); 278 278 if (!ret) { 279 279 if (mtd->writesize >= 512) { 280 - chip->ecc.size = mtd->writesize; 281 - chip->ecc.bytes = 3 * (mtd->writesize / 256); 280 + /* Hardware ECC 6 byte ECC per 512 Byte data */ 281 + chip->ecc.size = 512; 282 + chip->ecc.bytes = 6; 282 283 } 283 284 ret = nand_scan_tail(mtd); 284 285 }