aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBoris Brezillon <boris.brezillon@bootlin.com>2018-05-04 15:24:31 -0400
committerBoris Brezillon <boris.brezillon@bootlin.com>2018-05-10 02:40:39 -0400
commit3057fcef385348fe85173f1b0c824d89f1176f72 (patch)
tree75f6441bec7387039a6934bc5f0f16424ca77a9b
parenta2ee41fd953e7c3ff6c55a3038c80354d191a318 (diff)
mtd: rawnand: Make sure we wait tWB before polling the STATUS reg
NAND chips require a bit of time to take the NAND operation into account and set the BUSY bit in the STATUS reg. Make sure we don't poll the STATUS reg too early in nand_soft_waitrdy(). Fixes: 8878b126df76 ("mtd: nand: add ->exec_op() implementation") Cc: <stable@vger.kernel.org> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com> Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
-rw-r--r--drivers/mtd/nand/raw/nand_base.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 72f3a89da513..f28c3a555861 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -706,12 +706,17 @@ static void nand_wait_status_ready(struct mtd_info *mtd, unsigned long timeo)
706 */ 706 */
707int nand_soft_waitrdy(struct nand_chip *chip, unsigned long timeout_ms) 707int nand_soft_waitrdy(struct nand_chip *chip, unsigned long timeout_ms)
708{ 708{
709 const struct nand_sdr_timings *timings;
709 u8 status = 0; 710 u8 status = 0;
710 int ret; 711 int ret;
711 712
712 if (!chip->exec_op) 713 if (!chip->exec_op)
713 return -ENOTSUPP; 714 return -ENOTSUPP;
714 715
716 /* Wait tWB before polling the STATUS reg. */
717 timings = nand_get_sdr_timings(&chip->data_interface);
718 ndelay(PSEC_TO_NSEC(timings->tWB_max));
719
715 ret = nand_status_op(chip, NULL); 720 ret = nand_status_op(chip, NULL);
716 if (ret) 721 if (ret)
717 return ret; 722 return ret;