Browse Source

ramips: enable support for mtk_bmt in the nand flash driver

Signed-off-by: Felix Fietkau <[email protected]>
Felix Fietkau 3 years ago
parent
commit
4947623d6c
1 changed files with 5 additions and 0 deletions
  1. 5 0
      target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c

+ 5 - 0
target/linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c

@@ -18,6 +18,7 @@
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/rawnand.h>
 #include <linux/mtd/rawnand.h>
 #include <linux/mtd/partitions.h>
 #include <linux/mtd/partitions.h>
+#include <linux/mtd/mtk_bmt.h>
 #include <linux/platform_device.h>
 #include <linux/platform_device.h>
 #include <asm/addrspace.h>
 #include <asm/addrspace.h>
 
 
@@ -1254,9 +1255,12 @@ static int mt7621_nfc_init_chip(struct mt7621_nfc *nfc)
 	if (ret)
 	if (ret)
 		return ret;
 		return ret;
 
 
+	mtk_bmt_attach(mtd);
+
 	ret = mtd_device_register(mtd, NULL, 0);
 	ret = mtd_device_register(mtd, NULL, 0);
 	if (ret) {
 	if (ret) {
 		dev_err(nfc->dev, "Failed to register MTD: %d\n", ret);
 		dev_err(nfc->dev, "Failed to register MTD: %d\n", ret);
+		mtk_bmt_detach(mtd);
 		nand_cleanup(nand);
 		nand_cleanup(nand);
 		return ret;
 		return ret;
 	}
 	}
@@ -1328,6 +1332,7 @@ static int mt7621_nfc_remove(struct platform_device *pdev)
 	struct nand_chip *nand = &nfc->nand;
 	struct nand_chip *nand = &nfc->nand;
 	struct mtd_info *mtd = nand_to_mtd(nand);
 	struct mtd_info *mtd = nand_to_mtd(nand);
 
 
+	mtk_bmt_detach(mtd);
 	mtd_device_unregister(mtd);
 	mtd_device_unregister(mtd);
 	nand_cleanup(nand);
 	nand_cleanup(nand);
 	clk_disable_unprepare(nfc->nfi_clk);
 	clk_disable_unprepare(nfc->nfi_clk);