mediatek: add patches for 5.15 and kernel config for mt7622
[openwrt/openwrt.git] / target / linux / mediatek / patches-5.15 / 330-mtk-snand-bmt-support.patch
1 --- a/drivers/mtd/mtk-snand/mtk-snand-mtd.c
2 +++ b/drivers/mtd/mtk-snand/mtk-snand-mtd.c
3 @@ -16,6 +16,7 @@
4 #include <linux/dma-mapping.h>
5 #include <linux/wait.h>
6 #include <linux/mtd/mtd.h>
7 +#include <linux/mtd/mtk_bmt.h>
8 #include <linux/mtd/partitions.h>
9 #include <linux/of_platform.h>
10
11 @@ -612,6 +613,8 @@ static int mtk_snand_probe(struct platfo
12 mtd->_block_isbad = mtk_snand_mtd_block_isbad;
13 mtd->_block_markbad = mtk_snand_mtd_block_markbad;
14
15 + mtk_bmt_attach(mtd);
16 +
17 ret = mtd_device_register(mtd, NULL, 0);
18 if (ret) {
19 dev_err(msm->pdev.dev, "failed to register mtd partition\n");
20 @@ -623,6 +626,7 @@ static int mtk_snand_probe(struct platfo
21 return 0;
22
23 errout4:
24 + mtk_bmt_detach(mtd);
25 devm_kfree(msm->pdev.dev, msm->page_cache);
26
27 errout3:
28 @@ -650,6 +654,8 @@ static int mtk_snand_remove(struct platf
29 if (ret)
30 return ret;
31
32 + mtk_bmt_detach(mtd);
33 +
34 mtk_snand_cleanup(msm->snf);
35
36 if (msm->irq >= 0)