]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mtd: nand: Support 'EXIT GET STATUS' command in nand_command[_lp]()
authorBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 16 May 2017 16:35:45 +0000 (18:35 +0200)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Thu, 1 Jun 2017 08:09:34 +0000 (10:09 +0200)
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@free-electrons.com>
Tested-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
drivers/mtd/nand/nand_base.c

index 4b4fea4a3d1f3c818e8b689332af466061eff47c..58a97e30b3f4ebc48658535499ecb69e4098f9b2 100644 (file)
@@ -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,