public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* mxc nand i.mx35: no OOB with HW_ECC
@ 2009-11-03 15:25 John Ogness
  2009-11-11  7:22 ` Artem Bityutskiy
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: John Ogness @ 2009-11-03 15:25 UTC (permalink / raw)
  To: linux-mtd; +Cc: s.hauer

Hi,

I spent a while trying to figure out why JFFS2 was getting hardware ECC
errors on an i.MX35 NANDFC with 2K pages. The problem also existed when
using nandwrite together with the -n and -o options.

The problem is that for page sizes larger than 512 bytes, the i.MX35
NANDFC can only write the page and oob data together. When writing the
page and oob data, the ECC hardware also writes the ECC codes for
it. This is ok if the filesystem driver or userspace application
understands that only one write per page+oob is allowed.

But jffs2 and "nandwrite -n -o" assume that they can write the oob data
and the page data separately. With the recently posted mxc_nand.c
driver, this results in the NANDFC writing the ECC codes to flash
twice... with different values. This means the ECC codes that end up on
the flash chip are garbage.

When reading the page back, the ECC hardware uses the garbage ECC codes
to "fix" the data, which results in corrupted data.

ubifs does not touch the oob data, which is probably why nobody cares
about (or has noticed?) this issue.

As someone who is relatively new to the MTD layer, I don't have any
suggestions about how this should be fixed.

A quick tweak to fs/jffs2/wbuf.c:jffs2_nand_flash_setup() will allow
JFFS2 to run without available oob data. Maybe there should be an
official option to allow this.

John Ogness

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

end of thread, other threads:[~2009-11-12 10:28 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-03 15:25 mxc nand i.mx35: no OOB with HW_ECC John Ogness
2009-11-11  7:22 ` Artem Bityutskiy
2009-11-11  9:04   ` John Ogness
2009-11-12  9:35 ` Sascha Hauer
2009-11-12 10:28 ` Sascha Hauer

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