summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikhail Zhilkin2025-02-04 15:55:08 +0000
committerRobert Marko2025-02-07 08:04:35 +0000
commite585ae70d4f2a563b3b0e430e15ee19ad25caeb5 (patch)
tree7ed6da9e84bf0ab2d9172fef72a3a95b3c6aa0fa
parent98d7f4202fe9861fcdc64d694aecf6945bbc7de8 (diff)
downloadopenwrt-e585ae70d4f2a563b3b0e430e15ee19ad25caeb5.tar.gz
kernel: nmbm: add mediatek,bmt-mtd-overridden-oobsize property
This commit adds new "mediatek,bmt-mtd-overridden-oobsize" property. The property helps avoid "NMBM configuration mismatch" error if mtd "OOB size" is not equal to the "spare size" which is stored in the nmbm signature. Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com> Link: https://github.com/openwrt/openwrt/pull/17549 Signed-off-by: Robert Marko <robimarko@gmail.com>
-rw-r--r--target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c b/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c
index bcff7d6ac8..063adb50fb 100644
--- a/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c
+++ b/target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c
@@ -407,6 +407,7 @@ int mtk_bmt_attach(struct mtd_info *mtd)
{
struct device_node *np;
int ret = 0;
+ u32 overridden_oobsize = 0;
if (bmtd.mtd)
return -ENOSPC;
@@ -431,6 +432,14 @@ int mtk_bmt_attach(struct mtd_info *mtd)
bmtd.mtd = mtd;
mtk_bmt_replace_ops(mtd);
+ if (!of_property_read_u32(np, "mediatek,bmt-mtd-overridden-oobsize",
+ &overridden_oobsize))
+ if (overridden_oobsize < bmtd.mtd->oobsize) {
+ bmtd.mtd->oobsize = overridden_oobsize;
+ pr_info("NMBM: mtd OOB size has been overridden to %luB\n",
+ (long unsigned int)bmtd.mtd->oobsize);
+ }
+
bmtd.blk_size = mtd->erasesize;
bmtd.blk_shift = ffs(bmtd.blk_size) - 1;
bmtd.pg_size = mtd->writesize;