nand: atmel: Correct bitflips in erased pages
authorKai Stuhlemmer (ebee Engineering) <kai.stuhlemmer@ebee.de>
Fri, 21 May 2021 08:52:06 +0000 (11:52 +0300)
committerEugen Hristev <eugen.hristev@microchip.com>
Mon, 7 Jun 2021 08:01:40 +0000 (11:01 +0300)
commit32cc2368f816bf21e5e5ffc6070a8abcd8d3e02d
tree698c2d996311494e20b1c7aa0daa9a8309dc526e
parent55661ee0e3cf518e1b89939f00fda50b326d3139
nand: atmel: Correct bitflips in erased pages

Not correcting anything in case of empty ECC data area
is not an appropriate strategy, because an uncorrected bit-flip
in an empty sector may cause upper layers (namely UBI) fail to work
properly. Therefore the approach chosen in Linux kernel and other
u-boot mtd drivers has been adopted, where a heuristic implemented
by nand_check_erased_ecc_chunk() is used in order to detect and
correct empty sectors.

Tested with sama5d3_xplained and sam9x60-ek.

Signed-off-by: Kai Stuhlemmer (ebee Engineering) <kai.stuhlemmer@ebee.de>
Tested-by: Tudor Ambarus <tudor.ambarus@microchip.com>
[ta: reorder if conditions, change commit subject, s/uint8_t/u8.]
Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
drivers/mtd/nand/raw/atmel_nand.c