mtd: nand: gpmi: add proper raw access support
authorBoris BREZILLON <boris.brezillon@free-electrons.com>
Sun, 30 Nov 2014 18:10:29 +0000 (19:10 +0100)
committerBrian Norris <computersforpeace@gmail.com>
Mon, 1 Dec 2014 08:41:50 +0000 (00:41 -0800)
commitda3bc42c1becfde026656df50ad155239d4e1a6b
tree3c316a22370984f58c5a603ee2644809104ee8f3
parent66de54a761831f2e9f31941fa49c94bfcde5f586
mtd: nand: gpmi: add proper raw access support

Several MTD users (either in user or kernel space) expect a valid raw
access support to NAND chip devices.
This is particularly true for testing tools which are often touching the
data stored in a NAND chip in raw mode to artificially generate errors.

The GPMI drivers do not implemenent raw access functions, and thus rely on
default HW_ECC scheme implementation.
The default implementation consider the data and OOB area as properly
separated in their respective NAND section, which is not true for the GPMI
controller.
In this driver/controller some OOB data are stored at the beginning of the
NAND data area (these data are called metadata in the driver), then ECC
bytes are interleaved with data chunk (which is similar to the
HW_ECC_SYNDROME scheme), and eventually the remaining bytes are used as
OOB data.

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Tested-by: Huang Shijie <shijie8@gmail.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/nand/gpmi-nand/gpmi-nand.c
drivers/mtd/nand/gpmi-nand/gpmi-nand.h