aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/chips
diff options
context:
space:
mode:
authorAlexander Belyakov <abelyako@googlemail.com>2007-11-07 03:58:07 -0500
committerDavid Woodhouse <dwmw2@infradead.org>2007-11-26 10:54:16 -0500
commit6c24e4161e80a5c03e9d969b5db73d8553846037 (patch)
tree56c24fb17325d89259fc1ce27148a58c2d5523b1 /drivers/mtd/chips
parent5f4d47d5d1060a93be83e33a167a53a7f8c08b20 (diff)
[MTD] [NOR] Prevent erase command invocation on suspended chip
while running stress tests we have met cfi_cmdset_0001.c driver issue. Working on multipartitional devices with erase suspend on write feature enabled it is possible to get erase operation invoked on chip with suspended erase. get_chip() looses information about earlier suspended erase and new erase operation gets issued. New erase operations report successful completion, but blocks remain dirty causing, for example, JFFS2 error messages like: ... Newly-erased block contained word 0x20031985 at offset 0x00200000 Newly-erased block contained word 0x20031985 at offset 0x00280000 Newly-erased block contained word 0x20031985 at offset 0x00240000 ... The patch below fixes that issue. Signed-off-by: Alexander Belyakov <alexander.belyakov@intel.com> Acked-by: Nicolas Pitre <nico@cam.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Diffstat (limited to 'drivers/mtd/chips')
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index ed5ce41d1377..350671ec5226 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -795,6 +795,7 @@ static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long
795static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr, int mode) 795static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr, int mode)
796{ 796{
797 int ret; 797 int ret;
798 DECLARE_WAITQUEUE(wait, current);
798 799
799 retry: 800 retry:
800 if (chip->priv && (mode == FL_WRITING || mode == FL_ERASING 801 if (chip->priv && (mode == FL_WRITING || mode == FL_ERASING
@@ -851,6 +852,20 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr
851 spin_unlock(contender->mutex); 852 spin_unlock(contender->mutex);
852 } 853 }
853 854
855 /* Check if we already have suspended erase
856 * on this chip. Sleep. */
857 if (mode == FL_ERASING && shared->erasing
858 && shared->erasing->oldstate == FL_ERASING) {
859 spin_unlock(&shared->lock);
860 set_current_state(TASK_UNINTERRUPTIBLE);
861 add_wait_queue(&chip->wq, &wait);
862 spin_unlock(chip->mutex);
863 schedule();
864 remove_wait_queue(&chip->wq, &wait);
865 spin_lock(chip->mutex);
866 goto retry;
867 }
868
854 /* We now own it */ 869 /* We now own it */
855 shared->writing = chip; 870 shared->writing = chip;
856 if (mode == FL_ERASING) 871 if (mode == FL_ERASING)