[openwrt/openwrt] kernel: nmbm: add mediatek,bmt-mtd-overridden-oobsize property
LEDE Commits
lede-commits at lists.infradead.org
Sun Feb 9 14:21:16 PST 2025
hauke pushed a commit to openwrt/openwrt.git, branch openwrt-24.10:
https://git.openwrt.org/37cc725b1aee994f86cd54f5a7fe10eb20a1eaf0
commit 37cc725b1aee994f86cd54f5a7fe10eb20a1eaf0
Author: Mikhail Zhilkin <csharper2005 at gmail.com>
AuthorDate: Tue Feb 4 15:55:08 2025 +0000
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 at gmail.com>
Link: https://github.com/openwrt/openwrt/pull/17549
Signed-off-by: Robert Marko <robimarko at gmail.com>
(cherry picked from commit e585ae70d4f2a563b3b0e430e15ee19ad25caeb5)
Signed-off-by: Mikhail Zhilkin <csharper2005 at gmail.com>
Link: https://github.com/openwrt/openwrt/pull/17898
Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
target/linux/generic/files/drivers/mtd/nand/mtk_bmt.c | 9 +++++++++
1 file changed, 9 insertions(+)
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;
More information about the lede-commits
mailing list