aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/mediatek
diff options
context:
space:
mode:
authorChuanhong Guo <gch981213@gmail.com>2021-08-20 15:21:40 +0800
committerChuanhong Guo <gch981213@gmail.com>2021-08-27 10:26:25 +0800
commitb600aee3edbbf66e8cc714a7d5f69e4505a7445a (patch)
tree33827d017580bace15d915b36a55fc816be8f798 /target/linux/mediatek
parent01b452fe2dace93343d8b568a57317d5fd53aea2 (diff)
downloadupstream-b600aee3edbbf66e8cc714a7d5f69e4505a7445a.tar.gz
upstream-b600aee3edbbf66e8cc714a7d5f69e4505a7445a.tar.bz2
upstream-b600aee3edbbf66e8cc714a7d5f69e4505a7445a.zip
mediatek: attach bmt to the new snand driver
Signed-off-by: Chuanhong Guo <gch981213@gmail.com>
Diffstat (limited to 'target/linux/mediatek')
-rw-r--r--target/linux/mediatek/patches-5.10/330-mtk-bmt-support.patch63
1 files changed, 36 insertions, 27 deletions
diff --git a/target/linux/mediatek/patches-5.10/330-mtk-bmt-support.patch b/target/linux/mediatek/patches-5.10/330-mtk-bmt-support.patch
index 699870fbd6..ca1e74b863 100644
--- a/target/linux/mediatek/patches-5.10/330-mtk-bmt-support.patch
+++ b/target/linux/mediatek/patches-5.10/330-mtk-bmt-support.patch
@@ -805,33 +805,6 @@
+MODULE_AUTHOR("Xiangsheng Hou <xiangsheng.hou@mediatek.com>, Felix Fietkau <nbd@nbd.name>");
+MODULE_DESCRIPTION("Bad Block mapping management v2 for MediaTek NAND Flash Driver");
+
---- 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)
- {
-@@ -1140,6 +1141,8 @@ 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;
-@@ -1165,6 +1168,7 @@ static int spinand_remove(struct spi_mem
- if (ret)
- return ret;
-
-+ mtk_bmt_detach(mtd);
- spinand_cleanup(spinand);
-
- return 0;
--- /dev/null
+++ b/include/linux/mtd/mtk_bmt.h
@@ -0,0 +1,18 @@
@@ -853,3 +826,39 @@
+#endif
+
+#endif
+--- a/drivers/mtd/mtk-snand/mtk-snand-mtd.c
++++ b/drivers/mtd/mtk-snand/mtk-snand-mtd.c
+@@ -16,6 +16,7 @@
+ #include <linux/dma-mapping.h>
+ #include <linux/wait.h>
+ #include <linux/mtd/mtd.h>
++#include <linux/mtd/mtk_bmt.h>
+ #include <linux/mtd/partitions.h>
+ #include <linux/of_platform.h>
+
+@@ -608,6 +609,8 @@ static int mtk_snand_probe(struct platfo
+ mtd->_block_isbad = mtk_snand_mtd_block_isbad;
+ mtd->_block_markbad = mtk_snand_mtd_block_markbad;
+
++ mtk_bmt_attach(mtd);
++
+ ret = mtd_device_register(mtd, NULL, 0);
+ if (ret) {
+ dev_err(msm->pdev.dev, "failed to register mtd partition\n");
+@@ -619,6 +622,7 @@ static int mtk_snand_probe(struct platfo
+ return 0;
+
+ errout4:
++ mtk_bmt_detach(mtd);
+ devm_kfree(msm->pdev.dev, msm->page_cache);
+
+ errout3:
+@@ -646,6 +650,8 @@ static int mtk_snand_remove(struct platf
+ if (ret)
+ return ret;
+
++ mtk_bmt_detach(mtd);
++
+ mtk_snand_cleanup(msm->snf);
+
+ if (msm->irq >= 0)