0042-mtd-cfi-cmdset-0002-force-word-write.patch 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. From 39010a26a34a56a7928f9217ac23e5138c5ea952 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 42/57] mtd: cfi cmdset 0002 force word write
  5. ---
  6. drivers/mtd/chips/cfi_cmdset_0002.c | 9 +++++++--
  7. 1 file changed, 7 insertions(+), 2 deletions(-)
  8. --- a/drivers/mtd/chips/cfi_cmdset_0002.c
  9. +++ b/drivers/mtd/chips/cfi_cmdset_0002.c
  10. @@ -40,7 +40,7 @@
  11. #include <linux/mtd/xip.h>
  12. #define AMD_BOOTLOC_BUG
  13. -#define FORCE_WORD_WRITE 0
  14. +#define FORCE_WORD_WRITE 1
  15. #define MAX_WORD_RETRIES 3
  16. @@ -51,7 +51,9 @@
  17. static int cfi_amdstd_read (struct mtd_info *, loff_t, size_t, size_t *, u_char *);
  18. static int cfi_amdstd_write_words(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
  19. +#if !FORCE_WORD_WRITE
  20. static int cfi_amdstd_write_buffers(struct mtd_info *, loff_t, size_t, size_t *, const u_char *);
  21. +#endif
  22. static int cfi_amdstd_erase_chip(struct mtd_info *, struct erase_info *);
  23. static int cfi_amdstd_erase_varsize(struct mtd_info *, struct erase_info *);
  24. static void cfi_amdstd_sync (struct mtd_info *);
  25. @@ -202,6 +204,7 @@ static void fixup_amd_bootblock(struct m
  26. }
  27. #endif
  28. +#if !FORCE_WORD_WRITE
  29. static void fixup_use_write_buffers(struct mtd_info *mtd)
  30. {
  31. struct map_info *map = mtd->priv;
  32. @@ -211,6 +214,7 @@ static void fixup_use_write_buffers(stru
  33. mtd->_write = cfi_amdstd_write_buffers;
  34. }
  35. }
  36. +#endif /* !FORCE_WORD_WRITE */
  37. /* Atmel chips don't use the same PRI format as AMD chips */
  38. static void fixup_convert_atmel_pri(struct mtd_info *mtd)
  39. @@ -1789,6 +1793,7 @@ static int cfi_amdstd_write_words(struct
  40. /*
  41. * FIXME: interleaved mode not tested, and probably not supported!
  42. */
  43. +#if !FORCE_WORD_WRITE
  44. static int __xipram do_write_buffer(struct map_info *map, struct flchip *chip,
  45. unsigned long adr, const u_char *buf,
  46. int len)
  47. @@ -1917,7 +1922,6 @@ static int __xipram do_write_buffer(stru
  48. return ret;
  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. @@ -1992,6 +1996,7 @@ static int cfi_amdstd_write_buffers(stru
  55. return 0;
  56. }
  57. +#endif /* !FORCE_WORD_WRITE */
  58. /*
  59. * Wait for the flash chip to become ready to write data