From 142963e9d5f694dd8dfa2d44172bd3ee8933deab Mon Sep 17 00:00:00 2001 From: Markus Pargmann Date: Mon, 21 Dec 2015 15:42:00 +0100 Subject: mtd: nand: Add erased page bitflip check helper functions This adds the bitflip check helper functions from the kernel. They are used to check for bitflips in erased pages and correct them in the buffer so that UBI can work with it. Unfortunately most nand controllers do not have ECC for erased pages and don't do this on their own. Signed-off-by: Markus Pargmann Signed-off-by: Sascha Hauer --- include/linux/mtd/nand.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/linux/mtd/nand.h') diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index f126cd9fbf..83d664e7ee 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h @@ -46,6 +46,11 @@ extern int nand_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len); /* unlocks specified locked blocks */ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); +extern int nand_check_erased_ecc_chunk(void *data, int datalen, + void *ecc, int ecclen, + void *extraoob, int extraooblen, + int bitflips_threshold); + /* The maximum number of NAND chips in an array */ #define NAND_MAX_CHIPS 8 -- cgit v1.2.3