diff options
author | Stefan Roese <sr@denx.de> | 2006-11-27 17:22:19 +0100 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2006-11-27 17:24:40 +0100 |
commit | 15784862857c3c2214498defcfed84ff137fb81e (patch) | |
tree | 00fb89e8966770ca7985cdbb7ad4addd4b881d42 /drivers | |
parent | 3b58d9459081ae33885335c645fc0b865584ae4e (diff) |
[PATCH] nand_wait() timeout fixes
Two fixes for the nand_wait() function in
drivers/nand/nand_base.c:
1. Use correct timeouts. The original timeouts in Linux
source are 400ms and 20ms not 40s and 20s
2. Return correct error value in case of timeout. 0 is
interpreted as OK.
Signed-off-by: Rui Sousa <rui.sousa@laposte.net>
Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/nand/nand_base.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/nand/nand_base.c b/drivers/nand/nand_base.c index b7a5d32fb3f..8237f4a8b34 100644 --- a/drivers/nand/nand_base.c +++ b/drivers/nand/nand_base.c @@ -838,9 +838,9 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *this, int state) unsigned long timeo; if (state == FL_ERASING) - timeo = CFG_HZ * 400; + timeo += (HZ * 400) / 1000; else - timeo = CFG_HZ * 20; + timeo += (HZ * 20) / 1000; if ((state == FL_ERASING) && (this->options & NAND_IS_AND)) this->cmdfunc(mtd, NAND_CMD_STATUS_MULTI, -1, -1); @@ -852,8 +852,8 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *this, int state) while (1) { if (get_timer(0) > timeo) { printf("Timeout!"); - return 0; - } + return 0x01; + } if (this->dev_ready) { if (this->dev_ready(mtd)) |