From: Stefan Roese <sr@denx.de>
Date: Sat, 5 Jan 2008 15:43:25 +0000 (+0100)
Subject: NAND: Change nand_wait_ready() to not call nand_wait()
X-Git-Tag: v2025.01-rc5-pxa1908~21997^2~21
X-Git-Url: http://git.dujemihanovic.xyz/img/static/git-logo.png?a=commitdiff_plain;h=12072264528eba33737bc9674e19f0e925ffda23;p=u-boot.git

NAND: Change nand_wait_ready() to not call nand_wait()

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>
---

diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 4b1c564f75..f577ed6294 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