mtd: fix hang-up in cfi erase and read contention

cfi erase command hangs up when erase and read contention occurs.
If read runs at the same address as erase operation, read issues
Erase-Suspend via get_chip() and the erase goes into sleep in wait queue.
But in this case, read operation exits by time-out without waking it up.

I think the other variants (0001, 0020 and lpddr) have the same problem too.
Tested and verified the patch only on CFI-0002 flash, though.

Signed-off-by: Tadashi Abe <tabe@mvista.com>
Acked-by: Joakim Tjernlund <joakim.tjernlund@transmode.se>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
这个提交包含在:
Tadashi Abe
2011-05-19 15:58:15 +09:00
提交者 David Woodhouse
父节点 52534f2dba
当前提交 100f2341e3
修改 4 个文件,包含 6 行新增15 行删除

查看文件

@@ -812,12 +812,9 @@ static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long
break;
if (time_after(jiffies, timeo)) {
/* Urgh. Resume and pretend we weren't here. */
map_write(map, CMD(0xd0), adr);
/* Make sure we're in 'read status' mode if it had finished */
map_write(map, CMD(0x70), adr);
chip->state = FL_ERASING;
chip->oldstate = FL_READY;
/* Urgh. Resume and pretend we weren't here.
* Make sure we're in 'read status' mode if it had finished */
put_chip(map, chip, adr);
printk(KERN_ERR "%s: Chip not ready after erase "
"suspended: status = 0x%lx\n", map->name, status.x[0]);
return -EIO;