Skip to contentSkip to conversation

OneNAND OMAP3: add delay for GPIO

PATCH In review Adrian Hunter 3 participants 4 messages Aug 14, 2008 – Aug 18, 2008 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OneNAND OMAP3: add delay for GPIO

On OMAP3, the driver was occasionally not seeing the GPIO interrupt. Adding a small delay of one register read eliminates the problem.

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

1 files changed, 7 insertions(+), 2 deletions(-)
drivers/mtd/onenand/omap2.c +0 -0
index 2bd8746..bf6bba5 100644
@@ -141,8 +141,13 @@ static int omap2_onenand_wait(struct mtd_info *mtd, int state)
 
		/* Turn interrupts on */
		syscfg = read_reg(c, ONENAND_REG_SYS_CFG1);

- syscfg |= ONENAND_SYS_CFG1_IOBE;
- write_reg(c, syscfg, ONENAND_REG_SYS_CFG1);
+ if (!(syscfg & ONENAND_SYS_CFG1_IOBE)) {
+ syscfg |= ONENAND_SYS_CFG1_IOBE;
+ write_reg(c, syscfg, ONENAND_REG_SYS_CFG1);
+ if (cpu_is_omap34xx())
+ /* Add a delay to let GPIO settle */
+ syscfg = read_reg(c, ONENAND_REG_SYS_CFG1);
+ }

		INIT_COMPLETION(c->irq_done);
		if (c->gpio_irq) {
Signature · 1 line
1.5.4.3
#1 lore raw
Quoted 3 lines · Adrian Hunter

On OMAP3, the driver was occasionally not seeing the GPIO interrupt. Adding a small delay of one register read eliminates the problem.

Pushing to linux-omap tree.

Tony

Quoted 31 lines

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

1 files changed, 7 insertions(+), 2 deletions(-)
drivers/mtd/onenand/omap2.c +7 -2
index 2bd8746..bf6bba5 100644
@@ -141,8 +141,13 @@ static int omap2_onenand_wait(struct mtd_info *mtd, int state)
 
 		/* Turn interrupts on */
 		syscfg = read_reg(c, ONENAND_REG_SYS_CFG1);
-		syscfg |= ONENAND_SYS_CFG1_IOBE;
-		write_reg(c, syscfg, ONENAND_REG_SYS_CFG1);
+		if (!(syscfg & ONENAND_SYS_CFG1_IOBE)) {
+			syscfg |= ONENAND_SYS_CFG1_IOBE;
+			write_reg(c, syscfg, ONENAND_REG_SYS_CFG1);
+			if (cpu_is_omap34xx())
+				/* Add a delay to let GPIO settle */
+				syscfg = read_reg(c, ONENAND_REG_SYS_CFG1);
+		}
 
 		INIT_COMPLETION(c->irq_done);
 		if (c->gpio_irq) {
Signature · 5 lines
1.5.4.3
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#3 lore raw
Quoted 7 lines · Artem Bityutskiy
Quoted 5 lines · Tony Lindgren
Quoted 3 lines · Adrian Hunter

On OMAP3, the driver was occasionally not seeing the GPIO interrupt. Adding a small delay of one register read eliminates the problem.

Quoted 5 lines
Quoted 1 line

Pushing to linux-omap tree.

Note, dwmw2 pushed this to mtd tree already:

http://git.infradead.org/mtd-2.6.git?a=commit;h=782b7a367d81da005d93b28cb00f9ae086773c24

OK good, I'll be using whatever drops down from mainline for MTD files.

So just pushing the fix to linux-omap to wait for it to drop down from mainline.

Regards,

Tony