NAND: Change nand_wait_ready() to not call nand_wait()
authorStefan Roese <sr@denx.de>
Sat, 5 Jan 2008 15:43:25 +0000 (16:43 +0100)
committerScott Wood <scottwood@freescale.com>
Tue, 12 Aug 2008 16:31:22 +0000 (11:31 -0500)
This patch changes nand_wait_ready() to not just call nand_wait(),
since this will send a new command to the NAND chip. We just want to
wait for the chip to become ready here.

Signed-off-by: Stefan Roese <sr@denx.de>
drivers/mtd/nand/nand_base.c

index 4b1c564f7509d4c83e6f520180e0b7f25631930c..f577ed6294c341b3f1dba90c0f6800bdcb3e4994 100644 (file)
@@ -489,7 +489,16 @@ EXPORT_SYMBOL_GPL(nand_wait_ready);
 void nand_wait_ready(struct mtd_info *mtd)
 {
        struct nand_chip *chip = mtd->priv;
-       nand_wait(mtd, chip);
+       u32 timeo = (CFG_HZ * 20) / 1000;
+
+       reset_timer();
+
+       /* wait until command is processed or timeout occures */
+       while (get_timer(0) < timeo) {
+               if (chip->dev_ready)
+                       if (chip->dev_ready(mtd))
+                               break;
+       }
 }
 #endif