mtd: nand: Support 'EXIT GET STATUS' command in nand_command[_lp]()

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Thu Jul 13 10:59:16 PDT 2017


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=2165c4a1f71a04c7ea6493f18740a3afd4e47e4f
Commit:     2165c4a1f71a04c7ea6493f18740a3afd4e47e4f
Parent:     41145649f4acb30249b636b945053db50c9331c5
Author:     Boris Brezillon <boris.brezillon at free-electrons.com>
AuthorDate: Tue May 16 18:35:45 2017 +0200
Committer:  Boris Brezillon <boris.brezillon at free-electrons.com>
CommitDate: Thu Jun 1 10:09:34 2017 +0200

    mtd: nand: Support 'EXIT GET STATUS' command in nand_command[_lp]()
    
    READ0 is sometimes used to exit GET STATUS mode. When this is the case
    no address cycles are requested, and we can use this information to
    detect that READSTART should not be issued after READ0 or that we
    shouldn't wait for the chip to be ready.
    
    Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
    Tested-by: Thomas Petazzoni <thomas.petazzoni at free-electrons.com>
---
 drivers/mtd/nand/nand_base.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 4b4fea4..58a97e3 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -753,6 +753,16 @@ static void nand_command(struct mtd_info *mtd, unsigned int command,
 		return;
 
 		/* This applies to read commands */
+	case NAND_CMD_READ0:
+		/*
+		 * READ0 is sometimes used to exit GET STATUS mode. When this
+		 * is the case no address cycles are requested, and we can use
+		 * this information to detect that we should not wait for the
+		 * device to be ready.
+		 */
+		if (column == -1 && page_addr == -1)
+			return;
+
 	default:
 		/*
 		 * If we don't have access to the busy pin, we apply the given
@@ -887,6 +897,15 @@ static void nand_command_lp(struct mtd_info *mtd, unsigned int command,
 		return;
 
 	case NAND_CMD_READ0:
+		/*
+		 * READ0 is sometimes used to exit GET STATUS mode. When this
+		 * is the case no address cycles are requested, and we can use
+		 * this information to detect that READSTART should not be
+		 * issued.
+		 */
+		if (column == -1 && page_addr == -1)
+			return;
+
 		chip->cmd_ctrl(mtd, NAND_CMD_READSTART,
 			       NAND_NCE | NAND_CLE | NAND_CTRL_CHANGE);
 		chip->cmd_ctrl(mtd, NAND_CMD_NONE,



More information about the linux-mtd-cvs mailing list