All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leo Yu <liangyanyu13@gmail.com>
To: dario.binacchi@amarulasolutions.com,
	michael@amarulasolutions.com, miquel.raynal@bootlin.com,
	u-boot@lists.denx.de
Cc: jaimeliao.tw@gmail.com, Leo Yu <liangyanyu13@gmail.com>
Subject: [PATCH v2 3/5] cmd: mtd: Add total length of read operation
Date: Wed,  2 Nov 2022 14:14:30 +0800	[thread overview]
Message-ID: <20221102061432.7113-4-liangyanyu13@gmail.com> (raw)
In-Reply-To: <20221102061432.7113-1-liangyanyu13@gmail.com>

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 <liangyanyu13@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;

 	/* 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


  parent reply	other threads:[~2022-11-02 11:29 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-02  6:14 [PATCH v2 0/5] Add continuous read mode support Leo Yu
2022-11-02  6:14 ` [PATCH v2 1/5] mtd: spinand: Add continuous read mode configuration Leo Yu
2022-11-02  6:14 ` [PATCH v2 2/5] mtd: spinand: Add continuous read mode initialization Leo Yu
2022-11-02  6:14 ` Leo Yu [this message]
2022-11-07 14:51   ` [PATCH v2 3/5] cmd: mtd: Add total length of read operation Miquel Raynal
2022-11-08  9:49     ` Liang-Yan Yu
2022-11-02  6:14 ` [PATCH v2 4/5] mtd: spinand: Add continuous " Leo Yu
2022-11-02  6:14 ` [PATCH v2 5/5] mtd: spinand: macronix: Add continuous read mode flag for devices Leo Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221102061432.7113-4-liangyanyu13@gmail.com \
    --to=liangyanyu13@gmail.com \
    --cc=dario.binacchi@amarulasolutions.com \
    --cc=jaimeliao.tw@gmail.com \
    --cc=michael@amarulasolutions.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.