aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2022-03-10 11:45:00 +0100
committerFelix Fietkau <nbd@nbd.name>2022-10-10 18:14:26 +0200
commit33457ebf0beb353664333498a63ac73212c9304f (patch)
tree9704e45d6c5101ac895db1df533dd326fe6d0616
parentcc8326443d4e02dfddb7595cbdd4001020fd64cb (diff)
downloadupstream-33457ebf0beb353664333498a63ac73212c9304f.tar.gz
upstream-33457ebf0beb353664333498a63ac73212c9304f.tar.bz2
upstream-33457ebf0beb353664333498a63ac73212c9304f.zip
ramips: enable support for mtk_bmt in the nand flash driver
Signed-off-by: Felix Fietkau <nbd@nbd.name> (cherry-picked from commit 4947623d6c801365a60f383217c187e3d9dae953)
-rw-r--r--target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c b/target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c
index b9c2dfb911..c298bdd541 100644
--- a/target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c
+++ b/target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c
@@ -18,6 +18,7 @@
#include <linux/mtd/mtd.h>
#include <linux/mtd/rawnand.h>
#include <linux/mtd/partitions.h>
+#include <linux/mtd/mtk_bmt.h>
#include <linux/platform_device.h>
#include <asm/addrspace.h>
@@ -1254,9 +1255,12 @@ static int mt7621_nfc_init_chip(struct mt7621_nfc *nfc)
if (ret)
return ret;
+ mtk_bmt_attach(mtd);
+
ret = mtd_device_register(mtd, NULL, 0);
if (ret) {
dev_err(nfc->dev, "Failed to register MTD: %d\n", ret);
+ mtk_bmt_detach(mtd);
nand_cleanup(nand);
return ret;
}
@@ -1328,6 +1332,7 @@ static int mt7621_nfc_remove(struct platform_device *pdev)
struct nand_chip *nand = &nfc->nand;
struct mtd_info *mtd = nand_to_mtd(nand);
+ mtk_bmt_detach(mtd);
mtd_device_unregister(mtd);
nand_cleanup(nand);
clk_disable_unprepare(nfc->nfi_clk);