[][OpenWrt Dev][Fix register usage in mtk-snand driver]
[Description]
Fix the use of ADDRCNT & BYTELEN.
[Release-log]
N/A
Change-Id: I0b871f226e7b52b0e20a3850385f85e679827fb3
Reviewed-on: https://gerrit.mediatek.inc/c/openwrt/feeds/mtk_openwrt_feeds/+/4578214
diff --git a/target/linux/mediatek/files-5.4/drivers/mtd/mtk-snand/mtk-snand.c b/target/linux/mediatek/files-5.4/drivers/mtd/mtk-snand/mtk-snand.c
index 922454d..89abfe0 100644
--- a/target/linux/mediatek/files-5.4/drivers/mtd/mtk-snand/mtk-snand.c
+++ b/target/linux/mediatek/files-5.4/drivers/mtd/mtk-snand/mtk-snand.c
@@ -59,12 +59,13 @@
#define NFI_ADDRCNTR 0x070
#define SEC_CNTR GENMASK(16, 12)
-#define SEC_CNTR_S 12
+#define SEC_CNTR_S 12
+#define NFI_SEC_CNTR(val) (((val) & SEC_CNTR) >> SEC_CNTR_S)
#define NFI_STRADDR 0x080
#define NFI_BYTELEN 0x084
-#define BUS_SEC_CNTR(val) (((val) & SEC_CNTR) >> SEC_CNTR_S)
+#define BUS_SEC_CNTR(val) (((val) & SEC_CNTR) >> SEC_CNTR_S)
#define NFI_FDM0L 0x0a0
#define NFI_FDM0M 0x0a4
@@ -1038,9 +1039,9 @@
goto cleanup;
}
- /* Wait for BUS_SEC_CNTR returning expected value */
- ret = read32_poll_timeout(snf->nfi_base + NFI_BYTELEN, val,
- BUS_SEC_CNTR(val) >= snf->ecc_steps,
+ /* Wait for NFI_SEC_CNTR returning expected value */
+ ret = read32_poll_timeout(snf->nfi_base + NFI_ADDRCNTR, val,
+ NFI_SEC_CNTR(val) >= snf->ecc_steps,
0, SNFI_POLL_INTERVAL);
if (ret) {
snand_log_nfi(snf->pdev,