[PATCH] nand_wait_ready() timeout scaling
Andrew E. Mileski
andrewm at isoar.ca
Wed Apr 30 15:22:55 EDT 2008
The nand_wait_ready() timeout was hardcoded to 2 jiffies, which does not
scale with the system timer frequency. Using a guess of a 250 Hz system
timer frequency, I believe the timeout was meant to be 8 ms. This patch
sets an 8 ms timeout that scales with the system timer frequency.
Tested with a 1000 Hz system timer frequency and with a device requiring
at least a 3 ms timeout.
Signed-off-by: Andrew E. Mileski <andrewm at isoar.ca>
--
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index ba1bdf7..ef7e1c1 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -415,13 +415,13 @@ static int nand_block_checkbad(struct mtd_info *mtd, loff_t ofs, int getchip,
}
/*
- * Wait for the ready pin, after a command
- * The timeout is catched later.
+ * Wait 8 ms for the ready pin, after a command
+ * The timeout is caught later.
*/
void nand_wait_ready(struct mtd_info *mtd)
{
struct nand_chip *chip = mtd->priv;
- unsigned long timeo = jiffies + 2;
+ unsigned long timeo = jiffies + (HZ * 8) / 1000;
led_trigger_event(nand_led_trigger, LED_FULL);
/* wait until command is processed or timeout occures */
More information about the linux-mtd
mailing list