Commit 89491a9b authored by David Vrabel's avatar David Vrabel Committed by David Woodhouse

MTD: AMD/Fujitsu flash driver cleanup

Use get_chip() helper function instead of open-coding it.
Signed-off-by: default avatarDavid Vrabel <dvrabel@arcom.co.uk>
Signed-off-by: default avatarDavid Woodhouse <dwmw2@infradead.org>
parent 291517d6
......@@ -13,7 +13,7 @@
*
* This code is GPL
*
* $Id: cfi_cmdset_0002.c,v 1.112 2004/11/20 12:49:04 dwmw2 Exp $
* $Id: cfi_cmdset_0002.c,v 1.114 2004/12/11 15:43:53 dedekind Exp $
*
*/
......@@ -707,7 +707,7 @@ static int do_write_oneword(struct map_info *map, struct flchip *chip, unsigned
*/
unsigned long uWriteTimeout = ( HZ / 1000 ) + 1;
int ret = 0;
map_word oldd, curd;
map_word oldd;
int retry_cnt = 0;
adr += chip->start;
......@@ -764,23 +764,11 @@ static int do_write_oneword(struct map_info *map, struct flchip *chip, unsigned
continue;
}
/* Test to see if toggling has stopped. */
oldd = map_read(map, adr);
curd = map_read(map, adr);
if (map_word_equal(map, curd, oldd)) {
/* Do we have the correct value? */
if (map_word_equal(map, curd, datum)) {
goto op_done;
}
/* Nope something has gone wrong. */
break;
}
if (chip_ready(map, adr))
goto op_done;
if (time_after(jiffies, timeo)) {
printk(KERN_WARNING "MTD %s(): software timeout\n",
__func__ );
break;
}
if (time_after(jiffies, timeo))
break;
/* Latency issues. Drop the lock, wait a while and retry */
cfi_spin_unlock(chip->mutex);
......@@ -788,6 +776,8 @@ static int do_write_oneword(struct map_info *map, struct flchip *chip, unsigned
cfi_spin_lock(chip->mutex);
}
printk(KERN_WARNING "MTD %s(): software timeout\n", __func__);
/* reset on all failures. */
map_write( map, CMD(0xF0), chip->start );
/* FIXME - should have reset delay before continuing */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment