ramips: switch to linux 4.14
[openwrt/openwrt.git] / target / linux / ramips / patches-4.9 / 0037-mtd-cfi-cmdset-0002-force-word-write.patch
1 From ee9081b2726a5ca8cde5497afdc5425e21ff8f8b Mon Sep 17 00:00:00 2001
2 From: John Crispin <blogic@openwrt.org>
3 Date: Mon, 15 Jul 2013 00:39:21 +0200
4 Subject: [PATCH 37/53] mtd: cfi cmdset 0002 force word write
5
6 ---
7 drivers/mtd/chips/cfi_cmdset_0002.c | 9 +++++++--
8 1 file changed, 7 insertions(+), 2 deletions(-)
9
10 --- a/drivers/mtd/chips/cfi_cmdset_0002.c
11 +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
12 @@ -40,7 +40,7 @@
13 #include <linux/mtd/xip.h>
14
15 #define AMD_BOOTLOC_BUG
16 -#define FORCE_WORD_WRITE 0
17 +#define FORCE_WORD_WRITE 1
18
19 #define MAX_WORD_RETRIES 3
20
21 @@ -51,7 +51,9 @@
22
23 static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
24 static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
25 +#if !FORCE_WORD_WRITE
26 static int cfi_amdstd_write_buffers(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
27 +#endif
28 static int cfi_amdstd_erase_chip(struct mtd_info *, struct erase_info *);
29 static int cfi_amdstd_erase_varsize(struct mtd_info *, struct erase_info *);
30 static void cfi_amdstd_sync (struct mtd_info *);
31 @@ -202,6 +204,7 @@ static void fixup_amd_bootblock(struct m
32 }
33 #endif
34
35 +#if !FORCE_WORD_WRITE
36 static void fixup_use_write_buffers(struct mtd_info *mtd)
37 {
38 struct map_info *map = mtd->priv;
39 @@ -211,6 +214,7 @@ static void fixup_use_write_buffers(stru
40 mtd->_write = cfi_amdstd_write_buffers;
41 }
42 }
43 +#endif /* !FORCE_WORD_WRITE */
44
45 /* Atmel chips don't use the same PRI format as AMD chips */
46 static void fixup_convert_atmel_pri(struct mtd_info *mtd)
47 @@ -1787,6 +1791,7 @@ static int cfi_amdstd_write_words(struct
48 /*
49 * FIXME: interleaved mode not tested, and probably not supported!
50 */
51 +#if !FORCE_WORD_WRITE
52 static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
53 unsigned long adr, const u_char *buf,
54 int len)
55 @@ -1915,7 +1920,6 @@ static int __xipram do_write_buffer(stru
56 return ret;
57 }
58
59 -
60 static int cfi_amdstd_write_buffers(struct mtd_info *mtd, loff_t to, size_t len,
61 size_t *retlen, const u_char *buf)
62 {
63 @@ -1990,6 +1994,7 @@ static int cfi_amdstd_write_buffers(stru
64
65 return 0;
66 }
67 +#endif /* !FORCE_WORD_WRITE */
68
69 /*
70 * Wait for the flash chip to become ready to write data