[][OpenWrt Dev][Add empty page bitflips detection and fix for mtk-snand driver]

[Description]
Add support for mtk-snand driver to detect and fix bitflips of empty pages

Also, change to ecc strength of mtd layer to ecc strength of a sector,
and report max bitflips of sectors within a page.

[Release-log]
N/A

Change-Id: I0cb71808076ab809bdbbe98b59859394c79c59f9
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/4520684
diff --git a/target/linux/mediatek/files-5.4/drivers/mtd/mtk-snand/mtk-snand-def.h b/target/linux/mediatek/files-5.4/drivers/mtd/mtk-snand/mtk-snand-def.h
index 95c4bb3..1a93d93 100644
--- a/target/linux/mediatek/files-5.4/drivers/mtd/mtk-snand/mtk-snand-def.h
+++ b/target/linux/mediatek/files-5.4/drivers/mtd/mtk-snand/mtk-snand-def.h
@@ -174,6 +174,7 @@
 
 	uint8_t *page_cache;	/* Used by read/write page */
 	uint8_t *buf_cache;	/* Used by block bad/markbad & auto_oob */
+	int *sect_bf;		/* Used by ECC correction */
 };
 
 enum mtk_snand_log_category {
@@ -192,7 +193,8 @@
 int mtk_snand_ecc_decoder_start(struct mtk_snand *snf);
 void mtk_snand_ecc_decoder_stop(struct mtk_snand *snf);
 int mtk_ecc_wait_decoder_done(struct mtk_snand *snf);
-int mtk_ecc_check_decode_error(struct mtk_snand *snf, uint32_t page);
+int mtk_ecc_check_decode_error(struct mtk_snand *snf);
+int mtk_ecc_fixup_empty_sector(struct mtk_snand *snf, uint32_t sect);
 
 int mtk_snand_mac_io(struct mtk_snand *snf, const uint8_t *out, uint32_t outlen,
 		     uint8_t *in, uint32_t inlen);