You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

165 lines
4.5 KiB

  1. /***************************************************************************
  2. * Copyright (C) 2005 by Dominic Rath *
  3. * Dominic.Rath@gmx.de *
  4. * *
  5. * This program is free software; you can redistribute it and/or modify *
  6. * it under the terms of the GNU General Public License as published by *
  7. * the Free Software Foundation; either version 2 of the License, or *
  8. * (at your option) any later version. *
  9. * *
  10. * This program is distributed in the hope that it will be useful, *
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of *
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
  13. * GNU General Public License for more details. *
  14. * *
  15. * You should have received a copy of the GNU General Public License *
  16. * along with this program; if not, write to the *
  17. * Free Software Foundation, Inc., *
  18. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. *
  19. ***************************************************************************/
  20. #ifndef CFI_H
  21. #define CFI_H
  22. #define CFI_STATUS_POLL_MASK_DQ5_DQ6_DQ7 0xE0 /* DQ5..DQ7 */
  23. #define CFI_STATUS_POLL_MASK_DQ6_DQ7 0xC0 /* DQ6..DQ7 */
  24. struct cfi_flash_bank {
  25. int x16_as_x8;
  26. int jedec_probe;
  27. int not_cfi;
  28. int probed;
  29. enum target_endianness endianness;
  30. uint16_t manufacturer;
  31. uint16_t device_id;
  32. uint8_t qry[3];
  33. /* identification string */
  34. uint16_t pri_id;
  35. uint16_t pri_addr;
  36. uint16_t alt_id;
  37. uint16_t alt_addr;
  38. /* device-system interface */
  39. uint8_t vcc_min;
  40. uint8_t vcc_max;
  41. uint8_t vpp_min;
  42. uint8_t vpp_max;
  43. uint8_t word_write_timeout_typ;
  44. uint8_t buf_write_timeout_typ;
  45. uint8_t block_erase_timeout_typ;
  46. uint8_t chip_erase_timeout_typ;
  47. uint8_t word_write_timeout_max;
  48. uint8_t buf_write_timeout_max;
  49. uint8_t block_erase_timeout_max;
  50. uint8_t chip_erase_timeout_max;
  51. uint8_t status_poll_mask;
  52. /* flash geometry */
  53. uint32_t dev_size;
  54. uint16_t interface_desc;
  55. uint16_t max_buf_write_size;
  56. uint8_t num_erase_regions;
  57. uint32_t *erase_region_info;
  58. void *pri_ext;
  59. void *alt_ext;
  60. /* calculated timeouts */
  61. unsigned word_write_timeout;
  62. unsigned buf_write_timeout;
  63. unsigned block_erase_timeout;
  64. unsigned chip_erase_timeout;
  65. };
  66. /* Intel primary extended query table
  67. * as defined for the Advanced+ Boot Block Flash Memory (C3)
  68. * and used by the linux kernel cfi driver (as of 2.6.14)
  69. */
  70. struct cfi_intel_pri_ext {
  71. uint8_t pri[3];
  72. uint8_t major_version;
  73. uint8_t minor_version;
  74. uint32_t feature_support;
  75. uint8_t suspend_cmd_support;
  76. uint16_t blk_status_reg_mask;
  77. uint8_t vcc_optimal;
  78. uint8_t vpp_optimal;
  79. uint8_t num_protection_fields;
  80. uint16_t prot_reg_addr;
  81. uint8_t fact_prot_reg_size;
  82. uint8_t user_prot_reg_size;
  83. uint8_t extra[0];
  84. };
  85. /* Spansion primary extended query table as defined for and used by
  86. * the linux kernel cfi driver (as of 2.6.15)
  87. */
  88. struct cfi_spansion_pri_ext {
  89. uint8_t pri[3];
  90. uint8_t major_version;
  91. uint8_t minor_version;
  92. uint8_t SiliconRevision; /* bits 1-0: Address Sensitive Unlock */
  93. uint8_t EraseSuspend;
  94. uint8_t BlkProt;
  95. uint8_t TmpBlkUnprotect;
  96. uint8_t BlkProtUnprot;
  97. uint8_t SimultaneousOps;
  98. uint8_t BurstMode;
  99. uint8_t PageMode;
  100. uint8_t VppMin;
  101. uint8_t VppMax;
  102. uint8_t TopBottom;
  103. int _reversed_geometry;
  104. uint32_t _unlock1;
  105. uint32_t _unlock2;
  106. };
  107. /* Atmel primary extended query table as defined for and used by
  108. * the linux kernel cfi driver (as of 2.6.20+)
  109. */
  110. struct cfi_atmel_pri_ext {
  111. uint8_t pri[3];
  112. uint8_t major_version;
  113. uint8_t minor_version;
  114. uint8_t features;
  115. uint8_t bottom_boot;
  116. uint8_t burst_mode;
  117. uint8_t page_mode;
  118. };
  119. enum {
  120. CFI_UNLOCK_555_2AA,
  121. CFI_UNLOCK_5555_2AAA,
  122. };
  123. struct cfi_unlock_addresses {
  124. uint32_t unlock1;
  125. uint32_t unlock2;
  126. };
  127. struct cfi_fixup {
  128. uint16_t mfr;
  129. uint16_t id;
  130. void (*fixup)(struct flash_bank *bank, const void *param);
  131. const void *param;
  132. };
  133. #define CFI_MFR_AMD 0x0001
  134. #define CFI_MFR_FUJITSU 0x0004
  135. #define CFI_MFR_ATMEL 0x001F
  136. #define CFI_MFR_ST 0x0020 /* STMicroelectronics */
  137. #define CFI_MFR_AMIC 0x0037
  138. #define CFI_MFR_SST 0x00BF
  139. #define CFI_MFR_MX 0x00C2
  140. #define CFI_MFR_EON 0x007F
  141. #define CFI_MFR_ANY 0xffff
  142. #define CFI_ID_ANY 0xffff
  143. #endif /* CFI_H */