From 90f60ffa754e468c4862d24cccde4bfc6da8e791 Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Wed, 7 Jan 2015 18:39:57 +0100 Subject: mtd: vf610_nfc: allow bitflips in an empty page Allow bit flips in a empty page up to half of the recoverable bits (strength / 2). Some flash show bit flips in empty pages which are larger then the corrected bit count according to the ECC controller. It is not yet clear how to solve this correctly, discussion is ongoing: http://thread.gmane.org/gmane.linux.ports.arm.kernel/295424 Since we habe a 24-bit correction, this allows up to 12 bit flips on a empty page before reporting it as page with ECC errors. --- drivers/mtd/nand/vf610_nfc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/nand/vf610_nfc.c b/drivers/mtd/nand/vf610_nfc.c index 1af314f87d..baf9084f1e 100644 --- a/drivers/mtd/nand/vf610_nfc.c +++ b/drivers/mtd/nand/vf610_nfc.c @@ -521,7 +521,7 @@ static inline int vf610_nfc_correct_data(struct mtd_info *mtd, u_char *dat) flip = count_written_bits(dat, nfc->chip.ecc.size, ecc_count); /* ECC failed. */ - if (flip > ecc_count) { + if (flip > ecc_count && flip > (nfc->chip.ecc.strength / 2)) { nfc->page = -1; return -1; } -- cgit v1.2.3