diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-03-30 15:45:51 +0900 |
---|---|---|
committer | Boris Brezillon <boris.brezillon@free-electrons.com> | 2017-04-25 14:18:33 +0200 |
commit | d29109be2e8d4a102d8304d7b8bb0d6dfe5e1d27 (patch) | |
tree | cf4ac2900a1cc1bab880259711118228fe882ecf /drivers/mtd/nand/denali.h | |
parent | 20d48595f8857c9b7e0d31d9734ebe18d63faea1 (diff) | |
download | talos-obmc-linux-d29109be2e8d4a102d8304d7b8bb0d6dfe5e1d27.tar.gz talos-obmc-linux-d29109be2e8d4a102d8304d7b8bb0d6dfe5e1d27.zip |
mtd: nand: denali: fix erased page checking
This part is wrong in multiple ways:
[1] is_erased() is called against "buf" twice, so the OOB area is
not checked at all. The second call should check chip->oob_poi.
[2] This code block is nested by double "if (check_erase_page)".
The inner one is redundant.
[3] The ECC_ERROR_ADDRESS register reports which sector(s) had
uncorrectable ECC errors. It is pointless to check the whole page
if only one sector contains errors.
[4] Unfortunately, the Denali ECC correction engine has already
manipulated the data buffer before it decides the bitflips are
uncorrectable. That is, not all of the data are 0xFF after an
erased page is processed by the ECC engine. The current is_erased()
helper could report false-positive ECC errors. Actually, a certain
mount of bitflips are allowed in an erased page. The core framework
provides nand_check_erased_ecc_chunk() that takes the threshold into
account. Let's use this.
This commit reworks the code to solve those problems.
Please note the erased page checking is implemented as a separate
helper function instead of embedding it in the loop in handle_ecc().
The reason is that OOB data are needed for the erased page checking,
but the controller can not start a new transaction until all ECC
error information is read out from the registers.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Diffstat (limited to 'drivers/mtd/nand/denali.h')
0 files changed, 0 insertions, 0 deletions