diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index 2fd5cef..6f2d2d9 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c @@ -751,6 +751,8 @@ static int get_chip(struct map_info *map map_write(map, CMD(0x70), adr); chip->oldstate = FL_ERASING; chip->state = FL_ERASE_SUSPENDING; + if (chip->erase_suspended) + printk("chip already suspended"); chip->erase_suspended = 1; for (;;) { status = map_read(map, adr); @@ -775,6 +777,9 @@ static int get_chip(struct map_info *map /* Nobody will touch it while it's in state FL_ERASE_SUSPENDING. So we can just loop here. */ } + if (chip->erase_suspended != 1) + printk("SUSPEND: chip not suspended"); + chip->state = FL_STATUS; return 0; @@ -854,10 +859,15 @@ static void put_chip(struct map_info *ma sending the 0x70 (Read Status) command to an erasing chip and expecting it to be ignored, that's what we do. */ + if (chip->erase_suspended != 1) + printk("RESUME: chip not suspended"); + chip->erase_suspended = 0; map_write(map, CMD(0xd0), adr); map_write(map, CMD(0x70), adr); chip->oldstate = FL_READY; chip->state = FL_ERASING; + if (chip->erase_suspended) + printk("RESUME: chip suspended"); break; case FL_XIP_WHILE_ERASING: @@ -1718,7 +1728,7 @@ static int __xipram do_erase_oneblock(st map_write(map, CMD(0xD0), adr); chip->state = FL_ERASING; chip->erase_suspended = 0; - + again: ret = INVAL_CACHE_AND_WAIT(map, chip, adr, adr, len, chip->erase_time); @@ -1734,6 +1744,15 @@ static int __xipram do_erase_oneblock(st map_write(map, CMD(0x70), adr); chip->state = FL_STATUS; status = map_read(map, adr); +#if 1 + if (map_word_bitsset(map, status, CMD(0x40))) { + printk("resume again:%lx\n", MERGESTATUS(status)); + chip->state = FL_ERASING; + map_write(map, CMD(0x50), adr); /* reset status */ + map_write(map, CMD(0xd0), adr); /* resume */ + goto again; + } +#endif /* check for errors */ if (map_word_bitsset(map, status, CMD(0x3a))) { @@ -1770,6 +1789,7 @@ static int __xipram do_erase_oneblock(st xip_enable(map, chip, adr); out: put_chip(map, chip, adr); spin_unlock(chip->mutex); + printk("ERASE DONE: chip:%p adr:%x, status 0x%lx\n", chip, adr, MERGESTATUS(status)); return ret; }