[U-Boot-Users] [PATCH] NAND: Change nand_wait_ready() to not call nand_wait()

Stefan Roese sr at denx.de
Sat Jan 5 16:54:23 CET 2008


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 at denx.de>
---
William & Stig, could you please review this patch and test it on your
platforms?

Thanks.

 drivers/mtd/nand/nand_base.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 5a8196e..6c5c794 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -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
 
-- 
1.5.4.rc2





More information about the U-Boot mailing list