mtd: nand: omap: ecc.correct: omap_elm_correct_data: fix programmed-page bit-flip...
authorPekon Gupta <pekon@ti.com>
Tue, 18 Mar 2014 13:26:46 +0000 (18:56 +0530)
committerBrian Norris <computersforpeace@gmail.com>
Thu, 20 Mar 2014 08:47:59 +0000 (01:47 -0700)
commit13fbe0641ef4132cac936ac352194d2fe9ddf824
treea2fe1d0f604d953f291ed29dd068bb7101dde256
parentb08e1f632c79e9e75bf2ae58107df27d0e35b459
mtd: nand: omap: ecc.correct: omap_elm_correct_data: fix programmed-page bit-flip correction logic

This patch updates following checks when bit-flips are detected by ELM:

 - Do not evaluate bit-flips when un-correctable bit-flips is reported by ELM,
   because as per [1] when ELM reports an un-correctable bit-flips,
   'number of error' field in its ELM_LOCATION_STATUS register is also invalid.

 - Return with error-code '-EBADMSG' on detection of un-correctable bit-flip.

 - Return with error-code '-EBADMSG' when bit-flips position is outside current
   Sector and OOB area.

[1] ELM IP spec Table-25 ELM_LOCATION_STATUS Register.
    ELM_LOCATION_STATUS[8] = ECC_CORRECTABLE: Error location process exit status
        0x0: ECC error location process failed.
             Number of errors and error locations are invalid.
        0x1: all errors were successfully located.
             Number of errors and error locations are valid.

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