[PATCH] mtd: CFI: fix bug - bonnie++ error on BF548 NOR flash
Bryan Wu
cooloney at kernel.org
Thu Mar 5 22:32:18 EST 2009
From: Graf Yang <graf.yang at analog.com>
The function inval_cache_and_wait_for_operation() is called both
by write and erase operation. If erase call it and stayed there, then write
call it and male-cleared chip->erase_suspended, the time out error may arise.
Signed-off-by: Graf Yang <graf.yang at analog.com>
Signed-off-by: Bryan Wu <cooloney at kernel.org>
---
drivers/mtd/chips/cfi_cmdset_0001.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index f5ab6fa..c151075 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -1236,10 +1236,14 @@ static int inval_cache_and_wait_for_operation(
remove_wait_queue(&chip->wq, &wait);
spin_lock(chip->mutex);
}
- if (chip->erase_suspended || chip->write_suspended) {
- /* Suspend has occured while sleep: reset timeout */
+ if (chip->erase_suspended && chip_state == FL_ERASING) {
+ /* Erase suspend has occured while sleep: reset timeout */
timeo = reset_timeo;
chip->erase_suspended = 0;
+ }
+ if (chip->write_suspended && chip_state == FL_WRITING) {
+ /* Write suspend has occured while sleep: reset timeout */
+ timeo = reset_timeo;
chip->write_suspended = 0;
}
}
--
1.5.6.3
More information about the linux-mtd
mailing list