[PATCH] mtd: nand: docg4: add udelay(1) to polling loop

Mike Dunn mikedunn at newsguy.com
Mon Apr 22 14:23:10 EDT 2013


Add call to udelay(1) in the busy-wait loop that polls the device status
register.  This will make the timeout independent of cpu clock rate. This
sloppiness came back to bite me when I increased the cpu clock rate, and
timeouts started occurring during long block erasure operations.

Signed-off-by: Mike Dunn <mikedunn at newsguy.com>
---
 drivers/mtd/nand/docg4.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/nand/docg4.c b/drivers/mtd/nand/docg4.c
index 18fa448..fd353d2 100644
--- a/drivers/mtd/nand/docg4.c
+++ b/drivers/mtd/nand/docg4.c
@@ -279,6 +279,7 @@ static int poll_status(struct docg4_priv *doc)
 
 	timeo = 1000;
 	do {
+		udelay(1);
 		cpu_relax();
 		flash_status = readb(docptr + DOC_FLASHCONTROL);
 	} while (!(flash_status & DOC_CTRL_FLASHREADY) && --timeo);
-- 
1.7.8.6




More information about the linux-mtd mailing list