mtd: rawnand: Make sure we wait tWB before polling the STATUS reg
Subsystems (3)
PATCH v2 1/1 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().
---
Changes in v2:
- Move the ndelay() to nand_soft_waitrdy() instead of having it in the FSMC driver
--- drivers/mtd/nand/raw/nand_base.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/mtd/nand/raw/nand_base.c +5 -0
@@ -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) { +const struct nand_sdr_timings *timings;u8 status =0 ;int ret;if (!chip->exec_op)return -ENOTSUPP ; +/* Wait tWB before polling the STATUS reg. */ + timings =nand_get_sdr_timings (&chip->data_interface); +ndelay (PSEC_TO_NSEC (sdr->tWB_max)); + ret =nand_status_op (chip,NULL );if (ret)return ret;
Signature · 1 line
2.14.1
Hi Boris,
Quoted 7 lines · Boris Brezillon
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 <[email protected]>Signed-off-by Boris Brezillon <[email protected]>
Thanks,
Miquèl
Signature · 3 lines
Miquel Raynal, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
Quoted 23 lines · On Fri, 4 May 2018 21:24:31 +0200 Boris Brezillon…
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 <[email protected]>Signed-off-by Boris Brezillon <[email protected]>---
Changes in v2:
- Move thendelay()tonand_soft_waitrdy()instead of having it in the FSMC driver--- drivers/mtd/nand/raw/nand_base.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/mtd/nand/raw/nand_base.c +0
-0@@ -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) {
drivers/mtd/nand/raw/nand_base.c static void nand_wait_status_ready(struct mtd_info *mtd, unsigned long timeo) · line 718
Quoted 10 lines
drivers/mtd/nand/raw/nand_base.c +4
-0+const struct nand_sdr_timings *timings;u8 status =0 ;int ret;if (!chip->exec_op)return -ENOTSUPP ; +/* Wait tWB before polling the STATUS reg. */ + timings =nand_get_sdr_timings (&chip->data_interface); +ndelay (PSEC_TO_NSEC (sdr->tWB_max));
^ timings->tWB_max
And for those who wonder, yes, I compiled the code, but it seems I forgot to amend the commit after fixing the bug locally :-).
Quoted 4 lines
drivers/mtd/nand/raw/nand_base.c +1
-0+ ret =nand_status_op (chip,NULL );if (ret)return ret;
Boris Brezillon
AppliedQuoted 33 lines · On Mon, 7 May 2018 11:35:22 +0200 Boris Brezillon…
Quoted 30 lines · On Fri, 4 May 2018 21:24:31 +0200 Boris Brezillon…
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 <[email protected]>Signed-off-by Boris Brezillon <[email protected]>---
Changes in v2:
- Move thendelay()tonand_soft_waitrdy()instead of having it in the FSMC driver--- drivers/mtd/nand/raw/nand_base.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/mtd/nand/raw/nand_base.c +1
-0@@ -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) { +const struct nand_sdr_timings *timings;u8 status =0 ;int ret;if (!chip->exec_op)return -ENOTSUPP ;
Quoted 8 lines
drivers/mtd/nand/raw/nand_base.c static void nand_wait_status_ready(struct mtd_info *mtd, unsigned long timeo) · line 718
Quoted 3 lines
drivers/mtd/nand/raw/nand_base.c +3
-0+/* Wait tWB before polling the STATUS reg. */ + timings =nand_get_sdr_timings (&chip->data_interface); +ndelay (PSEC_TO_NSEC (sdr->tWB_max));^ timings->tWB_maxAnd for those who wonder, yes, I compiled the code, but it seems I forgot to amend the commit after fixing the bug locally :-).
Queued to mtd/master after fixing the problem.
Quoted 10 lines
drivers/mtd/nand/raw/nand_base.c static void nand_wait_status_ready(struct mtd_info *mtd, unsigned long timeo) · line 722
Quoted 5 lines
drivers/mtd/nand/raw/nand_base.c +1
-0+ ret =nand_status_op (chip,NULL );if (ret)return ret;______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/