kernel: backport MEMREAD ioctl
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>
This commit is contained in:
committed by
Christian Marangi
parent
3d110053f8
commit
fa4dc86e98
@@ -18,7 +18,7 @@ Link: https://lore.kernel.org/linux-mtd/20220127091808.1043392-8-miquel.raynal@b
|
||||
|
||||
--- a/drivers/mtd/nand/spi/core.c
|
||||
+++ b/drivers/mtd/nand/spi/core.c
|
||||
@@ -1211,14 +1211,6 @@ static int spinand_init(struct spinand_d
|
||||
@@ -1221,14 +1221,6 @@ static int spinand_init(struct spinand_d
|
||||
if (ret)
|
||||
goto err_free_bufs;
|
||||
|
||||
@@ -33,7 +33,7 @@ Link: https://lore.kernel.org/linux-mtd/20220127091808.1043392-8-miquel.raynal@b
|
||||
ret = nanddev_init(nand, &spinand_ops, THIS_MODULE);
|
||||
if (ret)
|
||||
goto err_manuf_cleanup;
|
||||
@@ -1253,6 +1245,14 @@ static int spinand_init(struct spinand_d
|
||||
@@ -1263,6 +1255,14 @@ static int spinand_init(struct spinand_d
|
||||
mtd->ecc_strength = nanddev_get_ecc_conf(nand)->strength;
|
||||
mtd->ecc_step_size = nanddev_get_ecc_conf(nand)->step_size;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ Link: https://lore.kernel.org/linux-mtd/20220127091808.1043392-9-miquel.raynal@b
|
||||
|
||||
while (nbytes) {
|
||||
ret = spi_mem_dirmap_write(wdesc, column, nbytes, buf);
|
||||
@@ -865,6 +871,31 @@ static int spinand_create_dirmap(struct
|
||||
@@ -875,6 +881,31 @@ static int spinand_create_dirmap(struct
|
||||
|
||||
spinand->dirmaps[plane].rdesc = desc;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
--- a/drivers/mtd/nand/spi/core.c
|
||||
+++ b/drivers/mtd/nand/spi/core.c
|
||||
@@ -714,7 +714,7 @@ static int spinand_mtd_write(struct mtd_
|
||||
@@ -724,7 +724,7 @@ static int spinand_mtd_write(struct mtd_
|
||||
static bool spinand_isbad(struct nand_device *nand, const struct nand_pos *pos)
|
||||
{
|
||||
struct spinand_device *spinand = nand_to_spinand(nand);
|
||||
@@ -9,7 +9,7 @@
|
||||
struct nand_page_io_req req = {
|
||||
.pos = *pos,
|
||||
.ooblen = sizeof(marker),
|
||||
@@ -725,7 +725,7 @@ static bool spinand_isbad(struct nand_de
|
||||
@@ -735,7 +735,7 @@ static bool spinand_isbad(struct nand_de
|
||||
|
||||
spinand_select_target(spinand, pos->target);
|
||||
spinand_read_page(spinand, &req);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
static int spinand_read_reg_op(struct spinand_device *spinand, u8 reg, u8 *val)
|
||||
{
|
||||
@@ -1333,6 +1334,7 @@ static int spinand_probe(struct spi_mem
|
||||
@@ -1343,6 +1344,7 @@ static int spinand_probe(struct spi_mem
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
ret = mtd_device_register(mtd, NULL, 0);
|
||||
if (ret)
|
||||
goto err_spinand_cleanup;
|
||||
@@ -1340,6 +1342,7 @@ static int spinand_probe(struct spi_mem
|
||||
@@ -1350,6 +1352,7 @@ static int spinand_probe(struct spi_mem
|
||||
return 0;
|
||||
|
||||
err_spinand_cleanup:
|
||||
@@ -24,7 +24,7 @@
|
||||
spinand_cleanup(spinand);
|
||||
|
||||
return ret;
|
||||
@@ -1358,6 +1361,7 @@ static int spinand_remove(struct spi_mem
|
||||
@@ -1368,6 +1371,7 @@ static int spinand_remove(struct spi_mem
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ Signed-off-by: Davide Fioravanti <pantanastyle@gmail.com>
|
||||
obj-$(CONFIG_MTD_SPI_NAND) += spinand.o
|
||||
--- a/drivers/mtd/nand/spi/core.c
|
||||
+++ b/drivers/mtd/nand/spi/core.c
|
||||
@@ -929,6 +929,7 @@ static const struct nand_ops spinand_ops
|
||||
@@ -939,6 +939,7 @@ static const struct nand_ops spinand_ops
|
||||
|
||||
static const struct spinand_manufacturer *spinand_manufacturers[] = {
|
||||
&esmt_c8_spinand_manufacturer,
|
||||
|
||||
@@ -11,7 +11,7 @@ Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
|
||||
|
||||
--- a/drivers/mtd/nand/spi/core.c
|
||||
+++ b/drivers/mtd/nand/spi/core.c
|
||||
@@ -967,6 +967,56 @@ static int spinand_manufacturer_match(st
|
||||
@@ -977,6 +977,56 @@ static int spinand_manufacturer_match(st
|
||||
return -ENOTSUPP;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
|
||||
static int spinand_id_detect(struct spinand_device *spinand)
|
||||
{
|
||||
u8 *id = spinand->id.data;
|
||||
@@ -1217,6 +1267,10 @@ static int spinand_init(struct spinand_d
|
||||
@@ -1227,6 +1277,10 @@ static int spinand_init(struct spinand_d
|
||||
if (!spinand->scratchbuf)
|
||||
return -ENOMEM;
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ Signed-off-by: SkyLake.Huang <skylake.huang@mediatek.com>
|
||||
|
||||
--- a/drivers/mtd/nand/spi/core.c
|
||||
+++ b/drivers/mtd/nand/spi/core.c
|
||||
@@ -1008,7 +1008,10 @@ int spinand_cal_read(void *priv, u32 *ad
|
||||
@@ -1018,7 +1018,10 @@ int spinand_cal_read(void *priv, u32 *ad
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user