* [PATCH] nand_wait : warn if the nand is busy on exit
@ 2012-11-05 14:00 Matthieu CASTET
2012-11-15 14:20 ` Artem Bityutskiy
0 siblings, 1 reply; 2+ messages in thread
From: Matthieu CASTET @ 2012-11-05 14:00 UTC (permalink / raw)
To: linux-mtd; +Cc: Ivan Djelic, Matthieu CASTET, dedekind1
This patch allow to detect buggy driver/hardware with
bad RnB (dev_ready) management or when timeout occurs in polling mode.
This works when dev_ready is set or not set.
There are 2 methods to wait for an erase/program command completion:
1. Wait until nand RnB pin goes high (that's what chip->dev_ready usually does)
2. Poll the device: send a status (0x70) command and read status byte in a loop
until bit NAND_STATUS_READY is set
In all cases, you should send a status command after completion, to check if
the operation was successful. And if the operation completed, the status should
have bit NAND_STATUS_READY set.
Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
CC: Ivan Djelic <ivan.djelic@parrot.com>
---
drivers/mtd/nand/nand_base.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index ee49fe2..5894c2c 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -865,6 +865,8 @@ static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip)
led_trigger_event(nand_led_trigger, LED_OFF);
status = (int)chip->read_byte(mtd);
+ /* This can happen if in case of timeout or buggy dev_ready */
+ WARN_ON(!(status & NAND_STATUS_READY));
return status;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] nand_wait : warn if the nand is busy on exit
2012-11-05 14:00 [PATCH] nand_wait : warn if the nand is busy on exit Matthieu CASTET
@ 2012-11-15 14:20 ` Artem Bityutskiy
0 siblings, 0 replies; 2+ messages in thread
From: Artem Bityutskiy @ 2012-11-15 14:20 UTC (permalink / raw)
To: Matthieu CASTET; +Cc: Ivan Djelic, linux-mtd
[-- Attachment #1: Type: text/plain, Size: 911 bytes --]
On Mon, 2012-11-05 at 15:00 +0100, Matthieu CASTET wrote:
> This patch allow to detect buggy driver/hardware with
> bad RnB (dev_ready) management or when timeout occurs in polling mode.
>
> This works when dev_ready is set or not set.
> There are 2 methods to wait for an erase/program command completion:
>
> 1. Wait until nand RnB pin goes high (that's what chip->dev_ready usually does)
> 2. Poll the device: send a status (0x70) command and read status byte in a loop
> until bit NAND_STATUS_READY is set
>
> In all cases, you should send a status command after completion, to check if
> the operation was successful. And if the operation completed, the status should
> have bit NAND_STATUS_READY set.
>
> Signed-off-by: Matthieu CASTET <matthieu.castet@parrot.com>
> CC: Ivan Djelic <ivan.djelic@parrot.com>
Pushed to l2-mtd.git, thanks!
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-11-15 14:19 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-05 14:00 [PATCH] nand_wait : warn if the nand is busy on exit Matthieu CASTET
2012-11-15 14:20 ` Artem Bityutskiy
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.