[MTD] [NAND] OMAP2: add retry after read timeout
Very occasionally, (about one in a million) read operations are ongoing after the timeout has expired. So, retry three times while the ongoing bit remains set. Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
parent
34f6e15786
commit
8afbc11454
|
@ -187,16 +187,36 @@ retry:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
int retry_cnt = 0;
|
||||||
|
|
||||||
/* Turn interrupts off */
|
/* Turn interrupts off */
|
||||||
syscfg = read_reg(c, ONENAND_REG_SYS_CFG1);
|
syscfg = read_reg(c, ONENAND_REG_SYS_CFG1);
|
||||||
syscfg &= ~ONENAND_SYS_CFG1_IOBE;
|
syscfg &= ~ONENAND_SYS_CFG1_IOBE;
|
||||||
write_reg(c, syscfg, ONENAND_REG_SYS_CFG1);
|
write_reg(c, syscfg, ONENAND_REG_SYS_CFG1);
|
||||||
|
|
||||||
timeout = jiffies + msecs_to_jiffies(20);
|
timeout = jiffies + msecs_to_jiffies(20);
|
||||||
while (time_before(jiffies, timeout)) {
|
while (1) {
|
||||||
intr = read_reg(c, ONENAND_REG_INTERRUPT);
|
if (time_before(jiffies, timeout)) {
|
||||||
if (intr & ONENAND_INT_MASTER)
|
intr = read_reg(c, ONENAND_REG_INTERRUPT);
|
||||||
|
if (intr & ONENAND_INT_MASTER)
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
/* Timeout after 20ms */
|
||||||
|
ctrl = read_reg(c, ONENAND_REG_CTRL_STATUS);
|
||||||
|
if (ctrl & ONENAND_CTRL_ONGO) {
|
||||||
|
/*
|
||||||
|
* The operation seems to be still going
|
||||||
|
* so give it some more time.
|
||||||
|
*/
|
||||||
|
retry_cnt += 1;
|
||||||
|
if (retry_cnt < 3) {
|
||||||
|
timeout = jiffies +
|
||||||
|
msecs_to_jiffies(20);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue