From: Matthieu CASTET <matthieu.castet@parrot.com>
To: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Subject: omap2 : bug in omap_wait
Date: Fri, 10 Jun 2011 10:33:09 +0200 [thread overview]
Message-ID: <4DF1D6C5.8080503@parrot.com> (raw)
Hi,
omap nand driver implement the nand.waitfunc[1] but it is buggy and can lead to
nand write/erase error :
- status = NAND_STATUS_FAIL
- timeo is computed
- thread is preempted
- timeo is expired and we never enter the loop
- we return NAND_STATUS_FAIL, even if the real status is okay.
The correct behavior is to read again the status after the loop like in nand_wait.
BTW why omap2 driver doesn't use nand_wait ?
Matthieu
[1]
static int omap_wait(struct mtd_info *mtd, struct nand_chip *chip)
{
struct nand_chip *this = mtd->priv;
struct omap_nand_info *info = container_of(mtd, struct omap_nand_info,
mtd);
unsigned long timeo = jiffies;
int status = NAND_STATUS_FAIL, state = this->state;
if (state == FL_ERASING)
timeo += (HZ * 400) / 1000;
else
timeo += (HZ * 20) / 1000;
gpmc_nand_write(info->gpmc_cs,
GPMC_NAND_COMMAND, (NAND_CMD_STATUS & 0xFF));
while (time_before(jiffies, timeo)) {
status = gpmc_nand_read(info->gpmc_cs, GPMC_NAND_DATA);
if (status & NAND_STATUS_READY)
break;
cond_resched();
}
return status;
}
reply other threads:[~2011-06-10 8:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4DF1D6C5.8080503@parrot.com \
--to=matthieu.castet@parrot.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.