[PATCH 2/4] mtd: spinand: Add continuous read exit command
Zhengxun
zhengxunli.mxic at gmail.com
Thu Oct 7 23:57:57 PDT 2021
Add a continuous read exit command to terminate continuous read
operation.
Signed-off-by: Zhengxun <zhengxunli.mxic at gmail.com>
---
drivers/mtd/nand/spi/core.c | 10 ++++++++++
include/linux/mtd/spinand.h | 6 ++++++
2 files changed, 16 insertions(+)
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index bcdd438..0d9632f 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -431,6 +431,16 @@ static int spinand_read_from_cache_op(struct spinand_device *spinand,
return 0;
}
+static int spinand_continuous_read_exit(struct spinand_device *spinand)
+{
+ struct spi_mem_op op = SPINAND_EXIT_CONT_READ;
+
+ if (!(spinand->flags & SPINAND_HAS_CONT_READ_BIT))
+ return 0;
+
+ return spi_mem_exec_op(spinand->spimem, &op);
+}
+
static int spinand_write_to_cache_op(struct spinand_device *spinand,
const struct nand_page_io_req *req)
{
diff --git a/include/linux/mtd/spinand.h b/include/linux/mtd/spinand.h
index 04be10e..e044aba 100644
--- a/include/linux/mtd/spinand.h
+++ b/include/linux/mtd/spinand.h
@@ -122,6 +122,12 @@
SPI_MEM_OP_DUMMY(ndummy, 4), \
SPI_MEM_OP_DATA_IN(len, buf, 4))
+#define SPINAND_EXIT_CONT_READ \
+ SPI_MEM_OP(SPI_MEM_OP_CMD(0x63, 1), \
+ SPI_MEM_OP_NO_ADDR, \
+ SPI_MEM_OP_NO_DUMMY, \
+ SPI_MEM_OP_NO_DATA)
+
#define SPINAND_PROG_EXEC_OP(addr) \
SPI_MEM_OP(SPI_MEM_OP_CMD(0x10, 1), \
SPI_MEM_OP_ADDR(3, addr, 1), \
--
2.7.4
More information about the linux-mtd
mailing list