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>
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);
while (1) {
if (get_timer(0) > timeo) {
printf("Timeout!");
- return 0;
- }
+ return 0x01;
+ }
if (this->dev_ready) {
if (this->dev_ready(mtd))