aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek/patches-5.15/330-snand-mtk-bmt-support.patch
blob: 6814e5f5e983e0fa8f20d0f5b1b202d5c13c7b57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -19,6 +19,7 @@
 #include <linux/string.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/spi-mem.h>
+#include <linux/mtd/mtk_bmt.h>
 
 static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val)
 {
@@ -1343,6 +1344,7 @@ static int spinand_probe(struct spi_mem
 	if (ret)
 		return ret;
 
+	mtk_bmt_attach(mtd);
 	ret = mtd_device_register(mtd, NULL, 0);
 	if (ret)
 		goto err_spinand_cleanup;
@@ -1350,6 +1352,7 @@ static int spinand_probe(struct spi_mem
 	return 0;
 
 err_spinand_cleanup:
+	mtk_bmt_detach(mtd);
 	spinand_cleanup(spinand);
 
 	return ret;
@@ -1368,6 +1371,7 @@ static int spinand_remove(struct spi_mem
 	if (ret)
 		return ret;
 
+	mtk_bmt_detach(mtd);
 	spinand_cleanup(spinand);
 
 	return 0;