diff options
Diffstat (limited to 'drivers/mtd/onenand/omap2.c')
-rw-r--r-- | drivers/mtd/onenand/omap2.c | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c index 86c4f6dcdc65..75f38b95811e 100644 --- a/drivers/mtd/onenand/omap2.c +++ b/drivers/mtd/onenand/omap2.c | |||
@@ -112,10 +112,24 @@ static int omap2_onenand_wait(struct mtd_info *mtd, int state) | |||
112 | unsigned long timeout; | 112 | unsigned long timeout; |
113 | u32 syscfg; | 113 | u32 syscfg; |
114 | 114 | ||
115 | if (state == FL_RESETING) { | 115 | if (state == FL_RESETING || state == FL_PREPARING_ERASE || |
116 | int i; | 116 | state == FL_VERIFYING_ERASE) { |
117 | int i = 21; | ||
118 | unsigned int intr_flags = ONENAND_INT_MASTER; | ||
119 | |||
120 | switch (state) { | ||
121 | case FL_RESETING: | ||
122 | intr_flags |= ONENAND_INT_RESET; | ||
123 | break; | ||
124 | case FL_PREPARING_ERASE: | ||
125 | intr_flags |= ONENAND_INT_ERASE; | ||
126 | break; | ||
127 | case FL_VERIFYING_ERASE: | ||
128 | i = 101; | ||
129 | break; | ||
130 | } | ||
117 | 131 | ||
118 | for (i = 0; i < 20; i++) { | 132 | while (--i) { |
119 | udelay(1); | 133 | udelay(1); |
120 | intr = read_reg(c, ONENAND_REG_INTERRUPT); | 134 | intr = read_reg(c, ONENAND_REG_INTERRUPT); |
121 | if (intr & ONENAND_INT_MASTER) | 135 | if (intr & ONENAND_INT_MASTER) |
@@ -126,7 +140,7 @@ static int omap2_onenand_wait(struct mtd_info *mtd, int state) | |||
126 | wait_err("controller error", state, ctrl, intr); | 140 | wait_err("controller error", state, ctrl, intr); |
127 | return -EIO; | 141 | return -EIO; |
128 | } | 142 | } |
129 | if (!(intr & ONENAND_INT_RESET)) { | 143 | if ((intr & intr_flags) != intr_flags) { |
130 | wait_err("timeout", state, ctrl, intr); | 144 | wait_err("timeout", state, ctrl, intr); |
131 | return -EIO; | 145 | return -EIO; |
132 | } | 146 | } |