8e93b10aa517f818504ffd914ee843555172b83e
[openwrt.git] / target / linux / ramips / patches-2.6.37 / 011-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 @@ -39,7 +39,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 @@ -50,7 +50,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 @@ -186,6 +188,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, void *param)
28  {
29         struct map_info *map = mtd->priv;
30 @@ -195,6 +198,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, void *param)
38 @@ -472,7 +476,7 @@ struct mtd_info *cfi_cmdset_0002(struct 
39  
40                         /*
41                          * Valid primary extension versions are: 1.0, 1.1, 1.2, 1.3, 1.4
42 -                        * see: Spec 1.3 http://cs.ozerki.net/zap/pub/axim-x5/docs/cfi_r20.pdf, page 19 
43 +                        * see: Spec 1.3 http://cs.ozerki.net/zap/pub/axim-x5/docs/cfi_r20.pdf, page 19
44                          *               http://www.spansion.com/Support/AppNotes/cfi_100_20011201.pdf
45                          *      Spec 1.4 http://www.spansion.com/Support/AppNotes/CFI_Spec_AN_03.pdf, page 9
46                          */
47 @@ -1386,6 +1390,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 @@ -1496,7 +1501,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 @@ -1575,6 +1579,7 @@ static int cfi_amdstd_write_buffers(stru
64  
65         return 0;
66  }
67 +#endif /* !FORCE_WORD_WRITE */
68  
69  
70  /*