1 From d5b094ea6d435817d295d554d652a97a5014c64f 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 33/33] mtd: cfi cmdset 0002 force word write
7 drivers/mtd/chips/cfi_cmdset_0002.c | 9 +++++++--
8 1 file changed, 7 insertions(+), 2 deletions(-)
10 diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
11 index ab8eb03..d84668d 100644
12 --- a/drivers/mtd/chips/cfi_cmdset_0002.c
13 +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
15 #include <linux/mtd/xip.h>
17 #define AMD_BOOTLOC_BUG
18 -#define FORCE_WORD_WRITE 0
19 +#define FORCE_WORD_WRITE 1
21 #define MAX_WORD_RETRIES 3
25 static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
26 static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
27 +#if !FORCE_WORD_WRITE
28 static int cfi_amdstd_write_buffers(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
30 static int cfi_amdstd_erase_chip(struct mtd_info *, struct erase_info *);
31 static int cfi_amdstd_erase_varsize(struct mtd_info *, struct erase_info *);
32 static void cfi_amdstd_sync (struct mtd_info *);
33 @@ -192,6 +194,7 @@ static void fixup_amd_bootblock(struct mtd_info *mtd)
37 +#if !FORCE_WORD_WRITE
38 static void fixup_use_write_buffers(struct mtd_info *mtd)
40 struct map_info *map = mtd->priv;
41 @@ -201,6 +204,7 @@ static void fixup_use_write_buffers(struct mtd_info *mtd)
42 mtd->_write = cfi_amdstd_write_buffers;
45 +#endif /* !FORCE_WORD_WRITE */
47 /* Atmel chips don't use the same PRI format as AMD chips */
48 static void fixup_convert_atmel_pri(struct mtd_info *mtd)
49 @@ -1461,6 +1465,7 @@ static int cfi_amdstd_write_words(struct mtd_info *mtd, loff_t to, size_t len,
51 * FIXME: interleaved mode not tested, and probably not supported!
53 +#if !FORCE_WORD_WRITE
54 static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
55 unsigned long adr, const u_char *buf,
57 @@ -1584,7 +1589,6 @@ static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
62 static int cfi_amdstd_write_buffers(struct mtd_info *mtd, loff_t to, size_t len,
63 size_t *retlen, const u_char *buf)
65 @@ -1659,6 +1663,7 @@ static int cfi_amdstd_write_buffers(struct mtd_info *mtd, loff_t to, size_t len,
69 +#endif /* !FORCE_WORD_WRITE */
72 * Wait for the flash chip to become ready to write data