diff options
author | Matthieu CASTET <matthieu.castet@parrot.com> | 2012-11-05 09:00:44 -0500 |
---|---|---|
committer | Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com> | 2012-11-15 12:50:30 -0500 |
commit | f251b8dfdd0721255ea11751cdc282834e43b74e (patch) | |
tree | ada4f9467ab39c19d95fb8529e3de21c362f0539 | |
parent | 192afdbfbc5c3346e27b3c3e3be8337495b2a41b (diff) |
mtd: nand_wait: warn if the nand is busy on exit
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>
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index 1d5c951ebcb0..01505406ca7b 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) | |||
865 | led_trigger_event(nand_led_trigger, LED_OFF); | 865 | led_trigger_event(nand_led_trigger, LED_OFF); |
866 | 866 | ||
867 | status = (int)chip->read_byte(mtd); | 867 | status = (int)chip->read_byte(mtd); |
868 | /* This can happen if in case of timeout or buggy dev_ready */ | ||
869 | WARN_ON(!(status & NAND_STATUS_READY)); | ||
868 | return status; | 870 | return status; |
869 | } | 871 | } |
870 | 872 | ||