Files
wlan-ap/patches/ramips/0011-ramips-enable-support-for-mtk_bmt-in-the-nand-flash-.patch
John Crispin 16e0724ace ramips: fix actiontec web7200 dual boot
Signed-off-by: John Crispin <john@phrozen.org>
2022-04-04 16:09:55 +02:00

52 lines
1.5 KiB
Diff

From bee84b6606374bb887e70e263419b19e112f1b5c Mon Sep 17 00:00:00 2001
From: Felix Fietkau <nbd@nbd.name>
Date: Thu, 10 Mar 2022 11:45:00 +0100
Subject: [PATCH 11/14] ramips: enable support for mtk_bmt in the nand flash
driver
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
.../linux/ramips/files/drivers/mtd/nand/raw/mt7621_nand.c | 8 ++++++++
1 file changed, 8 insertions(+)
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 0751e59c37..1072450898 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_release(nand);
return ret;
}
@@ -1325,7 +1329,11 @@ clk_disable:
static int mt7621_nfc_remove(struct platform_device *pdev)
{
struct mt7621_nfc *nfc = platform_get_drvdata(pdev);
+ struct nand_chip *nand = &nfc->nand;
+ struct mtd_info *mtd = nand_to_mtd(nand);
+ mtk_bmt_detach(mtd);
+ mtd_device_unregister(mtd);
nand_release(&nfc->nand);
clk_disable_unprepare(nfc->nfi_clk);
--
2.25.1