mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 06:57:57 +00:00
fa4dc86e98
MEMREAD is a new ioctl for MTD character devices that was first included in Linux 6.1. It allows userspace applications to use the Linux kernel's OOB autoplacement mechanism while reading data from NAND devices. The Yafut tool needs this ioctl to do its job. Signed-off-by: Michał Kępień <openwrt@kempniu.pl>
35 lines
808 B
Diff
35 lines
808 B
Diff
--- 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;
|