Commit d19d7b46 authored by Roman Tereshonkov's avatar Roman Tereshonkov Committed by David Woodhouse

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: default avatarRoman Tereshonkov <roman.tereshonkov@nokia.com>
Signed-off-by: default avatarArtem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: default avatarDavid Woodhouse <David.Woodhouse@intel.com>
parent 3e3198f1
...@@ -108,8 +108,9 @@ static void wait_warn(char *msg, int state, unsigned int ctrl, ...@@ -108,8 +108,9 @@ static void wait_warn(char *msg, int state, unsigned int ctrl,
static int omap2_onenand_wait(struct mtd_info *mtd, int state) static int omap2_onenand_wait(struct mtd_info *mtd, int state)
{ {
struct omap2_onenand *c = container_of(mtd, struct omap2_onenand, mtd); struct omap2_onenand *c = container_of(mtd, struct omap2_onenand, mtd);
struct onenand_chip *this = mtd->priv;
unsigned int intr = 0; unsigned int intr = 0;
unsigned int ctrl; unsigned int ctrl, ctrl_mask;
unsigned long timeout; unsigned long timeout;
u32 syscfg; u32 syscfg;
...@@ -180,7 +181,8 @@ static int omap2_onenand_wait(struct mtd_info *mtd, int state) ...@@ -180,7 +181,8 @@ static int omap2_onenand_wait(struct mtd_info *mtd, int state)
if (result == 0) { if (result == 0) {
/* Timeout after 20ms */ /* Timeout after 20ms */
ctrl = read_reg(c, ONENAND_REG_CTRL_STATUS); ctrl = read_reg(c, ONENAND_REG_CTRL_STATUS);
if (ctrl & ONENAND_CTRL_ONGO) { if (ctrl & ONENAND_CTRL_ONGO &&
!this->ongoing) {
/* /*
* The operation seems to be still going * The operation seems to be still going
* so give it some more time. * so give it some more time.
...@@ -269,7 +271,11 @@ static int omap2_onenand_wait(struct mtd_info *mtd, int state) ...@@ -269,7 +271,11 @@ static int omap2_onenand_wait(struct mtd_info *mtd, int state)
return -EIO; return -EIO;
} }
if (ctrl & 0xFE9F) ctrl_mask = 0xFE9F;
if (this->ongoing)
ctrl_mask &= ~0x8000;
if (ctrl & ctrl_mask)
wait_warn("unexpected controller status", state, ctrl, intr); wait_warn("unexpected controller status", state, ctrl, intr);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment