All of lore.kernel.org
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@collabora.com>
To: "Miquel Raynal" <miquel.raynal@bootlin.com>,
	linux-mtd@lists.infradead.org,
	"Hauke Mehrtens" <hauke@hauke-m.de>,
	"Rafał Miłecki" <zajec5@gmail.com>,
	linux-mips@vger.kernel.org
Cc: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Tudor Ambarus <tudor.ambarus@microchip.com>,
	Boris Brezillon <boris.brezillon@collabora.com>
Subject: [PATCH v2 1/8] mtd: rawnand: Add an is_last flag to nand_subop
Date: Mon, 18 May 2020 18:28:30 +0200	[thread overview]
Message-ID: <20200518162837.304471-2-boris.brezillon@collabora.com> (raw)
In-Reply-To: <20200518162837.304471-1-boris.brezillon@collabora.com>

Some controllers need to know when they're passed the last subop so
they can de-assert the CE pin.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
Changes in v2:
* Add R-b
---
 drivers/mtd/nand/raw/nand_base.c | 2 ++
 include/linux/mtd/rawnand.h      | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 169150a7c140..21f8771b00ba 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -2169,6 +2169,8 @@ nand_op_parser_match_pat(const struct nand_op_parser_pattern *pat,
 	 */
 	ctx->subop.ninstrs = ninstrs;
 	ctx->subop.last_instr_end_off = instr_offset;
+	if (ctx->subop.instrs + ninstrs == end && !instr_offset)
+		ctx->subop.is_last = true;
 
 	return true;
 }
diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
index 0f45b6984ad1..69f1c1652187 100644
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
@@ -715,6 +715,7 @@ struct nand_op_instr {
  *			   of the sub-operation
  * @last_instr_end_off: offset to end at (excluded) for the last instruction
  *			of the sub-operation
+ * @is_last: this sub-operation is the last one
  *
  * Both @first_instr_start_off and @last_instr_end_off only apply to data or
  * address instructions.
@@ -728,6 +729,7 @@ struct nand_subop {
 	unsigned int ninstrs;
 	unsigned int first_instr_start_off;
 	unsigned int last_instr_end_off;
+	bool is_last;
 };
 
 unsigned int nand_subop_get_addr_start_off(const struct nand_subop *subop,
-- 
2.25.4


WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon@collabora.com>
To: "Miquel Raynal" <miquel.raynal@bootlin.com>,
	linux-mtd@lists.infradead.org,
	"Hauke Mehrtens" <hauke@hauke-m.de>,
	"Rafał Miłecki" <zajec5@gmail.com>,
	linux-mips@vger.kernel.org
Cc: Richard Weinberger <richard@nod.at>,
	Boris Brezillon <boris.brezillon@collabora.com>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Tudor Ambarus <tudor.ambarus@microchip.com>
Subject: [PATCH v2 1/8] mtd: rawnand: Add an is_last flag to nand_subop
Date: Mon, 18 May 2020 18:28:30 +0200	[thread overview]
Message-ID: <20200518162837.304471-2-boris.brezillon@collabora.com> (raw)
In-Reply-To: <20200518162837.304471-1-boris.brezillon@collabora.com>

Some controllers need to know when they're passed the last subop so
they can de-assert the CE pin.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
Changes in v2:
* Add R-b
---
 drivers/mtd/nand/raw/nand_base.c | 2 ++
 include/linux/mtd/rawnand.h      | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 169150a7c140..21f8771b00ba 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -2169,6 +2169,8 @@ nand_op_parser_match_pat(const struct nand_op_parser_pattern *pat,
 	 */
 	ctx->subop.ninstrs = ninstrs;
 	ctx->subop.last_instr_end_off = instr_offset;
+	if (ctx->subop.instrs + ninstrs == end && !instr_offset)
+		ctx->subop.is_last = true;
 
 	return true;
 }
diff --git a/include/linux/mtd/rawnand.h b/include/linux/mtd/rawnand.h
index 0f45b6984ad1..69f1c1652187 100644
--- a/include/linux/mtd/rawnand.h
+++ b/include/linux/mtd/rawnand.h
@@ -715,6 +715,7 @@ struct nand_op_instr {
  *			   of the sub-operation
  * @last_instr_end_off: offset to end at (excluded) for the last instruction
  *			of the sub-operation
+ * @is_last: this sub-operation is the last one
  *
  * Both @first_instr_start_off and @last_instr_end_off only apply to data or
  * address instructions.
@@ -728,6 +729,7 @@ struct nand_subop {
 	unsigned int ninstrs;
 	unsigned int first_instr_start_off;
 	unsigned int last_instr_end_off;
+	bool is_last;
 };
 
 unsigned int nand_subop_get_addr_start_off(const struct nand_subop *subop,
-- 
2.25.4


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2020-05-18 16:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-18 16:28 [PATCH v2 0/8] mtd: rawnand: bcm47xx: Convert to exec_op() (and more) Boris Brezillon
2020-05-18 16:28 ` Boris Brezillon
2020-05-18 16:28 ` Boris Brezillon [this message]
2020-05-18 16:28   ` [PATCH v2 1/8] mtd: rawnand: Add an is_last flag to nand_subop Boris Brezillon
2020-05-18 16:28 ` [PATCH v2 2/8] mtd: rawnand: bcm47xx: Drop dependency on BCMA Boris Brezillon
2020-05-18 16:28   ` Boris Brezillon
2020-05-18 16:28 ` [PATCH v2 3/8] mtd: rawnand: bcm47xx: Allow compiling the driver when COMPILE_TEST=y Boris Brezillon
2020-05-18 16:28   ` Boris Brezillon
2020-05-18 16:28 ` [PATCH v2 4/8] mtd: rawnand: bcm47xx: Demistify a few more things Boris Brezillon
2020-05-18 16:28   ` Boris Brezillon
2020-05-18 16:28 ` [PATCH v2 5/8] mtd: rawnand: bcm47xx: Implement the exec_op() interface Boris Brezillon
2020-05-18 16:28   ` Boris Brezillon
2020-05-18 16:28 ` [PATCH v2 6/8] mtd: rawnand: bcm47xx: Get rid of the legacy implementation Boris Brezillon
2020-05-18 16:28   ` Boris Brezillon
2020-05-18 16:28 ` [PATCH v2 7/8] mtd: rawnand: bcm47xx: Simplify the init() function Boris Brezillon
2020-05-18 16:28   ` Boris Brezillon
2020-05-18 16:28 ` [PATCH v2 8/8] mtd: rawnand: bcm47xx: Merge all source files Boris Brezillon
2020-05-18 16:28   ` Boris Brezillon
2020-06-03 14:22 ` [PATCH v2 0/8] mtd: rawnand: bcm47xx: Convert to exec_op() (and more) Miquel Raynal
2020-06-03 14:22   ` Miquel Raynal

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=20200518162837.304471-2-boris.brezillon@collabora.com \
    --to=boris.brezillon@collabora.com \
    --cc=hauke@hauke-m.de \
    --cc=linux-mips@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=tudor.ambarus@microchip.com \
    --cc=vigneshr@ti.com \
    --cc=zajec5@gmail.com \
    /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.