1 --- a/drivers/mtd/chips/cfi_cmdset_0002.c
2 +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
4 #include <linux/mtd/xip.h>
6 #define AMD_BOOTLOC_BUG
7 -#define FORCE_WORD_WRITE 0
8 +#define FORCE_WORD_WRITE 1
10 #define MAX_WORD_RETRIES 3
12 @@ -190,6 +190,7 @@ static void fixup_amd_bootblock(struct m
16 +#if !FORCE_WORD_WRITE
17 static void fixup_use_write_buffers(struct mtd_info *mtd, void *param)
19 struct map_info *map = mtd->priv;
20 @@ -199,6 +200,7 @@ static void fixup_use_write_buffers(stru
21 mtd->write = cfi_amdstd_write_buffers;
26 /* Atmel chips don't use the same PRI format as AMD chips */
27 static void fixup_convert_atmel_pri(struct mtd_info *mtd, void *param)
28 @@ -1152,8 +1154,8 @@ static int __xipram do_write_oneword(str
32 - if (chip_ready(map, adr))
34 + if (chip_good(map, adr, datum))
37 /* Latency issues. Drop the lock, wait a while and retry */
38 UDELAY(map, chip, adr, 1);
39 @@ -1169,6 +1171,8 @@ static int __xipram do_write_oneword(str
45 xip_enable(map, chip, adr);
47 chip->state = FL_READY;
48 @@ -1436,6 +1440,7 @@ static int __xipram do_write_buffer(stru
52 +#if !FORCE_WORD_WRITE
53 static int cfi_amdstd_write_buffers(struct mtd_info *mtd, loff_t to, size_t len,
54 size_t *retlen, const u_char *buf)
56 @@ -1514,7 +1519,7 @@ static int cfi_amdstd_write_buffers(stru
64 * Handle devices with one erase region, that only implement
65 @@ -1579,8 +1584,8 @@ static int __xipram do_erase_chip(struct
66 chip->erase_suspended = 0;
69 - if (chip_ready(map, adr))
71 + if (chip_good(map, adr, map_word_ff(map)))
74 if (time_after(jiffies, timeo)) {
75 printk(KERN_WARNING "MTD %s(): software timeout\n",
76 @@ -1600,6 +1605,7 @@ static int __xipram do_erase_chip(struct
81 chip->state = FL_READY;
82 xip_enable(map, chip, adr);
83 put_chip(map, chip, adr);
84 @@ -1667,9 +1673,9 @@ static int __xipram do_erase_oneblock(st
85 chip->erase_suspended = 0;
88 - if (chip_ready(map, adr)) {
89 + if (chip_good(map, adr, map_word_ff(map))) {
90 xip_enable(map, chip, adr);
95 if (time_after(jiffies, timeo)) {
96 @@ -1691,6 +1697,7 @@ static int __xipram do_erase_oneblock(st
101 chip->state = FL_READY;
102 put_chip(map, chip, adr);
103 spin_unlock(chip->mutex);