diff options
author | Roman Tereshonkov <roman.tereshonkov@nokia.com> | 2010-11-03 06:55:20 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-12-03 11:28:13 -0500 |
commit | d19d7b46d2b4936be14cfeef779ffeb76cf7b757 (patch) | |
tree | ab7aa8ebecf9a4375647dc971d6f09d89c21e9bd /drivers/mtd | |
parent | 3e3198f1adda8e0fbd499bde806781237d6c841f (diff) |
mtd: onenand: fix omap2 code to handle cache program feature
Some fixes are introduced into omap2 code to handle errors when
cache program feature is used.
Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/onenand/omap2.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/mtd/onenand/omap2.c b/drivers/mtd/onenand/omap2.c index 9f322f1a7f22..da25a90af4a4 100644 --- a/drivers/mtd/onenand/omap2.c +++ b/drivers/mtd/onenand/omap2.c | |||
@@ -108,8 +108,9 @@ static void wait_warn(char *msg, int state, unsigned int ctrl, | |||
108 | static int omap2_onenand_wait(struct mtd_info *mtd, int state) | 108 | static int omap2_onenand_wait(struct mtd_info *mtd, int state) |
109 | { | 109 | { |
110 | struct omap2_onenand *c = container_of(mtd, struct omap2_onenand, mtd); | 110 | struct omap2_onenand *c = container_of(mtd, struct omap2_onenand, mtd); |
111 | struct onenand_chip *this = mtd->priv; | ||
111 | unsigned int intr = 0; | 112 | unsigned int intr = 0; |
112 | unsigned int ctrl; | 113 | unsigned int ctrl, ctrl_mask; |
113 | unsigned long timeout; | 114 | unsigned long timeout; |
114 | u32 syscfg; | 115 | u32 syscfg; |
115 | 116 | ||
@@ -180,7 +181,8 @@ retry: | |||
180 | if (result == 0) { | 181 | if (result == 0) { |
181 | /* Timeout after 20ms */ | 182 | /* Timeout after 20ms */ |
182 | ctrl = read_reg(c, ONENAND_REG_CTRL_STATUS); | 183 | ctrl = read_reg(c, ONENAND_REG_CTRL_STATUS); |
183 | if (ctrl & ONENAND_CTRL_ONGO) { | 184 | if (ctrl & ONENAND_CTRL_ONGO && |
185 | !this->ongoing) { | ||
184 | /* | 186 | /* |
185 | * The operation seems to be still going | 187 | * The operation seems to be still going |
186 | * so give it some more time. | 188 | * so give it some more time. |
@@ -269,7 +271,11 @@ retry: | |||
269 | return -EIO; | 271 | return -EIO; |
270 | } | 272 | } |
271 | 273 | ||
272 | if (ctrl & 0xFE9F) | 274 | ctrl_mask = 0xFE9F; |
275 | if (this->ongoing) | ||
276 | ctrl_mask &= ~0x8000; | ||
277 | |||
278 | if (ctrl & ctrl_mask) | ||
273 | wait_warn("unexpected controller status", state, ctrl, intr); | 279 | wait_warn("unexpected controller status", state, ctrl, intr); |
274 | 280 | ||
275 | return 0; | 281 | return 0; |