mtd: nand: omap: ecc.correct: omap_elm_correct_data: fix erased-page detection for...
authorPekon Gupta <pekon@ti.com>
Tue, 18 Mar 2014 13:26:44 +0000 (18:56 +0530)
committerBrian Norris <computersforpeace@gmail.com>
Thu, 20 Mar 2014 08:47:59 +0000 (01:47 -0700)
commit78f43c53835076f342133e6d2d6e577d6ae06480
treeb1f341daf0d712969d8a77d7aa222dd27efb5575
parentde0a4d69e6758bfa5792e7c723a9220eb5be5a32
mtd: nand: omap: ecc.correct: omap_elm_correct_data: fix erased-page detection for BCHx_HW ECC schemes

As erased-pages do not have ECC stored in their OOB area, so they need to be
seperated out from programmed-pages, before doing BCH ECC correction.

In current implementation of omap_elm_correct_data() which does ECC correction
for BCHx ECC schemes, this erased-pages are detected based on specific marker
byte (reserved as 0x00) in ecc-layout.
However, this approach has some limitation like;
 1) All ecc-scheme layouts do not have such Reserved byte marker to
    differentiate between erased-page v/s programmed-page. Thus this is a
    customized solution.
 2) Reserved marker byte can itself be subjected to bit-flips causing
    erased-page to be misunderstood as programmed-page.

This patch removes dependency on any marker byte in ecc-layout, instead it
compares calc_ecc[] with pattern of ECC-of-all(0xff). This implicitely
means that both 'data + oob == all(0xff).

Signed-off-by: Pekon Gupta <pekon@ti.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/nand/omap2.c