diff options
Diffstat (limited to 'drivers/mtd/onenand/omap2.c')
-rw-r--r-- | drivers/mtd/onenand/omap2.c | 31 |
1 files changed, 23 insertions, 8 deletions
diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c index 0108ed42e877..fd406348fdfd 100644 --- a/drivers/mtd/onenand/omap2.c +++ b/drivers/mtd/onenand/omap2.c | |||
@@ -34,15 +34,16 @@ | |||
34 | #include <linux/delay.h> | 34 | #include <linux/delay.h> |
35 | #include <linux/dma-mapping.h> | 35 | #include <linux/dma-mapping.h> |
36 | #include <linux/io.h> | 36 | #include <linux/io.h> |
37 | #include <linux/slab.h> | ||
37 | 38 | ||
38 | #include <asm/mach/flash.h> | 39 | #include <asm/mach/flash.h> |
39 | #include <mach/gpmc.h> | 40 | #include <plat/gpmc.h> |
40 | #include <mach/onenand.h> | 41 | #include <plat/onenand.h> |
41 | #include <mach/gpio.h> | 42 | #include <mach/gpio.h> |
42 | 43 | ||
43 | #include <mach/dma.h> | 44 | #include <plat/dma.h> |
44 | 45 | ||
45 | #include <mach/board.h> | 46 | #include <plat/board.h> |
46 | 47 | ||
47 | #define DRIVER_NAME "omap2-onenand" | 48 | #define DRIVER_NAME "omap2-onenand" |
48 | 49 | ||
@@ -112,10 +113,24 @@ static int omap2_onenand_wait(struct mtd_info *mtd, int state) | |||
112 | unsigned long timeout; | 113 | unsigned long timeout; |
113 | u32 syscfg; | 114 | u32 syscfg; |
114 | 115 | ||
115 | if (state == FL_RESETING) { | 116 | if (state == FL_RESETING || state == FL_PREPARING_ERASE || |
116 | int i; | 117 | state == FL_VERIFYING_ERASE) { |
118 | int i = 21; | ||
119 | unsigned int intr_flags = ONENAND_INT_MASTER; | ||
117 | 120 | ||
118 | for (i = 0; i < 20; i++) { | 121 | switch (state) { |
122 | case FL_RESETING: | ||
123 | intr_flags |= ONENAND_INT_RESET; | ||
124 | break; | ||
125 | case FL_PREPARING_ERASE: | ||
126 | intr_flags |= ONENAND_INT_ERASE; | ||
127 | break; | ||
128 | case FL_VERIFYING_ERASE: | ||
129 | i = 101; | ||
130 | break; | ||
131 | } | ||
132 | |||
133 | while (--i) { | ||
119 | udelay(1); | 134 | udelay(1); |
120 | intr = read_reg(c, ONENAND_REG_INTERRUPT); | 135 | intr = read_reg(c, ONENAND_REG_INTERRUPT); |
121 | if (intr & ONENAND_INT_MASTER) | 136 | if (intr & ONENAND_INT_MASTER) |
@@ -126,7 +141,7 @@ static int omap2_onenand_wait(struct mtd_info *mtd, int state) | |||
126 | wait_err("controller error", state, ctrl, intr); | 141 | wait_err("controller error", state, ctrl, intr); |
127 | return -EIO; | 142 | return -EIO; |
128 | } | 143 | } |
129 | if (!(intr & ONENAND_INT_RESET)) { | 144 | if ((intr & intr_flags) != intr_flags) { |
130 | wait_err("timeout", state, ctrl, intr); | 145 | wait_err("timeout", state, ctrl, intr); |
131 | return -EIO; | 146 | return -EIO; |
132 | } | 147 | } |