mediatek: refresh patches for Linux 5.15
[openwrt/staging/mkresin.git] / target / linux / mediatek / patches-5.15 / 330-snand-mtk-bmt-support.patch
1 --- a/drivers/mtd/nand/spi/core.c
2 +++ b/drivers/mtd/nand/spi/core.c
3 @@ -19,6 +19,7 @@
4 #include <linux/string.h>
5 #include <linux/spi/spi.h>
6 #include <linux/spi/spi-mem.h>
7 +#include <linux/mtd/mtk_bmt.h>
8
9 static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val)
10 {
11 @@ -1332,6 +1333,7 @@ static int spinand_probe(struct spi_mem
12 if (ret)
13 return ret;
14
15 + mtk_bmt_attach(mtd);
16 ret = mtd_device_register(mtd, NULL, 0);
17 if (ret)
18 goto err_spinand_cleanup;
19 @@ -1339,6 +1341,7 @@ static int spinand_probe(struct spi_mem
20 return 0;
21
22 err_spinand_cleanup:
23 + mtk_bmt_detach(mtd);
24 spinand_cleanup(spinand);
25
26 return ret;
27 @@ -1357,6 +1360,7 @@ static int spinand_remove(struct spi_mem
28 if (ret)
29 return ret;
30
31 + mtk_bmt_detach(mtd);
32 spinand_cleanup(spinand);
33
34 return 0;