Skip to contentSkip to conversation

OMAP2: add retry after read timeout

PATCH In review Adrian Hunter 1 participant 2 messages Aug 25, 2008 – Sep 16, 2008 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
drivers/mtd/onenand/omap2.c | 26 +++++++++++++++++++++++---

1 files changed, 23 insertions(+), 3 deletions(-)
drivers/mtd/onenand/omap2.c +0 -0
index 34b4253..8387e05 100644
@@ -187,16 +187,36 @@ retry:
			}
		}
	} else {
+		int retry_cnt = 0;
+
		/* Turn interrupts off */
		syscfg = read_reg(c, ONENAND_REG_SYS_CFG1);
		syscfg &= ~ONENAND_SYS_CFG1_IOBE;
		write_reg(c, syscfg, ONENAND_REG_SYS_CFG1);

		timeout = jiffies + msecs_to_jiffies(20);

- while (time_before(jiffies, timeout)) {
- intr = read_reg(c, ONENAND_REG_INTERRUPT);
- if (intr & ONENAND_INT_MASTER)
+ while (1) {
+ if (time_before(jiffies, timeout)) {
+ 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;
+			}
		}
	}
Signature · 1 line
1.5.4.3
#1 lore raw
Quoted 6 lines · Adrian Hunter

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.

---

Can I have this applied?