Commit 3057fcef authored by Boris Brezillon's avatar Boris Brezillon

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: 8878b126 ("mtd: nand: add ->exec_op() implementation")
Cc: <stable@vger.kernel.org>
Signed-off-by: default avatarBoris Brezillon <boris.brezillon@bootlin.com>
Acked-by: default avatarMiquel Raynal <miquel.raynal@bootlin.com>
parent a2ee41fd
...@@ -706,12 +706,17 @@ static void nand_wait_status_ready(struct mtd_info *mtd, unsigned long timeo) ...@@ -706,12 +706,17 @@ static void nand_wait_status_ready(struct mtd_info *mtd, unsigned long timeo)
*/ */
int nand_soft_waitrdy(struct nand_chip *chip, unsigned long timeout_ms) int nand_soft_waitrdy(struct nand_chip *chip, unsigned long timeout_ms)
{ {
const struct nand_sdr_timings *timings;
u8 status = 0; u8 status = 0;
int ret; int ret;
if (!chip->exec_op) if (!chip->exec_op)
return -ENOTSUPP; return -ENOTSUPP;
/* Wait tWB before polling the STATUS reg. */
timings = nand_get_sdr_timings(&chip->data_interface);
ndelay(PSEC_TO_NSEC(timings->tWB_max));
ret = nand_status_op(chip, NULL); ret = nand_status_op(chip, NULL);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment