]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
OneNAND OMAP3: add delay for GPIO
authorAdrian Hunter <ext-adrian.hunter@nokia.com>
Thu, 14 Aug 2008 11:00:12 +0000 (14:00 +0300)
committerTony Lindgren <tony@atomide.com>
Mon, 18 Aug 2008 12:33:14 +0000 (15:33 +0300)
On OMAP3, the driver was occasionally not seeing the GPIO
interrupt.  Adding a small delay of one register read
eliminates the problem.

Signed-off-by: Adrian Hunter <ext-adrian.hunter@nokia.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
drivers/mtd/onenand/omap2.c

index d265215e862da41a7779cc70495e1249ec0a34b0..24dd54f31bdcc3743af3427ccd03b8b89523ccbd 100644 (file)
@@ -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) {