This patch bypasses the limitation of length for read operations
in MTD test module. Thus, the total length of a read operation
can be passed down to the continuous read operation in SPI NAND
layer.

Signed-off-by: Leo Yu <[email protected]>
---
 cmd/mtd.c               | 2 ++
 include/linux/mtd/mtd.h | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/cmd/mtd.c b/cmd/mtd.c
index ad5cc9827d..0b601e08a3 100644
--- a/cmd/mtd.c
+++ b/cmd/mtd.c
@@ -335,6 +335,8 @@ static int do_mtd_io(struct cmd_tbl *cmdtp, int flag, int 
argc,
        io_op.ooblen = woob ? mtd->oobsize : 0;
        io_op.datbuf = buf;
        io_op.oobbuf = woob ? &buf[len] : NULL;
+       /* Total length of this read operation passed by user */
+       io_op.totallen = len;

        /* Search for the first good block after the given offset */
        off = start_off;
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h
index ff635bd716..df8a231c82 100644
--- a/include/linux/mtd/mtd.h
+++ b/include/linux/mtd/mtd.h
@@ -79,6 +79,7 @@ struct mtd_erase_region_info {
  *             mode = MTD_OPS_PLACE_OOB or MTD_OPS_RAW)
  * @datbuf:    data buffer - if NULL only oob data are read/written
  * @oobbuf:    oob data buffer
+ * @totallen:   total number of data bytes to read in one read operation (for 
continuous read mode)
  */
 struct mtd_oob_ops {
        unsigned int    mode;
@@ -89,6 +90,7 @@ struct mtd_oob_ops {
        uint32_t        ooboffs;
        uint8_t         *datbuf;
        uint8_t         *oobbuf;
+       size_t          totallen;
 };

 #ifdef CONFIG_SYS_NAND_MAX_OOBFREE
--
2.17.1

Reply via email to