ar71xx: Add support for AP147-010 reference board
[openwrt/openwrt.git] / target / linux / ar71xx / patches-4.1 / 411-mtd-cfi_cmdset_0002-force-word-write.patch
1 --- a/drivers/mtd/chips/cfi_cmdset_0002.c
2 +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
3 @@ -40,7 +40,7 @@
4 #include <linux/mtd/xip.h>
5
6 #define AMD_BOOTLOC_BUG
7 -#define FORCE_WORD_WRITE 0
8 +#define FORCE_WORD_WRITE 1
9
10 #define MAX_WORD_RETRIES 3
11
12 @@ -51,7 +51,9 @@
13
14 static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
15 static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
16 +#if !FORCE_WORD_WRITE
17 static int cfi_amdstd_write_buffers(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
18 +#endif
19 static int cfi_amdstd_erase_chip(struct mtd_info *, struct erase_info *);
20 static int cfi_amdstd_erase_varsize(struct mtd_info *, struct erase_info *);
21 static void cfi_amdstd_sync (struct mtd_info *);
22 @@ -202,6 +204,7 @@ static void fixup_amd_bootblock(struct m
23 }
24 #endif
25
26 +#if !FORCE_WORD_WRITE
27 static void fixup_use_write_buffers(struct mtd_info *mtd)
28 {
29 struct map_info *map = mtd->priv;
30 @@ -211,6 +214,7 @@ static void fixup_use_write_buffers(stru
31 mtd->_write = cfi_amdstd_write_buffers;
32 }
33 }
34 +#endif /* !FORCE_WORD_WRITE */
35
36 /* Atmel chips don't use the same PRI format as AMD chips */
37 static void fixup_convert_atmel_pri(struct mtd_info *mtd)
38 @@ -1791,6 +1795,7 @@ static int cfi_amdstd_write_words(struct
39 /*
40 * FIXME: interleaved mode not tested, and probably not supported!
41 */
42 +#if !FORCE_WORD_WRITE
43 static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
44 unsigned long adr, const u_char *buf,
45 int len)
46 @@ -1919,7 +1924,6 @@ static int __xipram do_write_buffer(stru
47 return ret;
48 }
49
50 -
51 static int cfi_amdstd_write_buffers(struct mtd_info *mtd, loff_t to, size_t len,
52 size_t *retlen, const u_char *buf)
53 {
54 @@ -1994,6 +1998,7 @@ static int cfi_amdstd_write_buffers(stru
55
56 return 0;
57 }
58 +#endif /* !FORCE_WORD_WRITE */
59
60 /*
61 * Wait for the flash chip to become ready to write data