Skip to content

Commit

Permalink
mtd: onenand: fix omap2 code to handle cache program feature
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Roman Tereshonkov authored and David Woodhouse committed Dec 3, 2010
1 parent 3e3198f commit d19d7b4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions drivers/mtd/onenand/omap2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
struct omap2_onenand *c = container_of(mtd, struct omap2_onenand, mtd);
struct onenand_chip *this = mtd->priv;
unsigned int intr = 0;
unsigned int ctrl;
unsigned int ctrl, ctrl_mask;
unsigned long timeout;
u32 syscfg;

Expand Down Expand Up @@ -180,7 +181,8 @@ static int omap2_onenand_wait(struct mtd_info *mtd, int state)
if (result == 0) {
/* Timeout after 20ms */
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
* so give it some more time.
Expand Down Expand Up @@ -269,7 +271,11 @@ static int omap2_onenand_wait(struct mtd_info *mtd, int state)
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);

return 0;
Expand Down

0 comments on commit d19d7b4

Please sign in to comment.