Hi Miquel, > > Hi Leo, > > liangyany...@gmail.com wrote on Wed, 2 Nov 2022 14:14:30 +0800: > > > 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 <liangyany...@gmail.com> > > --- > > 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; > > Where is this used?
It is used in spinand_mtd_read function (drivers/mtd/nand/spi/core.c) as a condition to trigger continuous read mode (please refer to patch[4/5]). This member stores the total length of a read operation. The reason why this member is added is because the mtd command sets the length of an operation to one page if has_pages flag is set. This limits spinand_mtd_read to receive length greater than one page. Which means there is no way to trigger continuous mode. Thus, I added this member to bypass the limitation. > > > > /* 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 > > > > > Thanks, > Miquèl Best, Leo Yu