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.

163 lines
4.5KB

  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. uint16_t manufacturer;
  30. uint16_t device_id;
  31. uint8_t qry[3];
  32. /* identification string */
  33. uint16_t pri_id;
  34. uint16_t pri_addr;
  35. uint16_t alt_id;
  36. uint16_t alt_addr;
  37. /* device-system interface */
  38. uint8_t vcc_min;
  39. uint8_t vcc_max;
  40. uint8_t vpp_min;
  41. uint8_t vpp_max;
  42. uint8_t word_write_timeout_typ;
  43. uint8_t buf_write_timeout_typ;
  44. uint8_t block_erase_timeout_typ;
  45. uint8_t chip_erase_timeout_typ;
  46. uint8_t word_write_timeout_max;
  47. uint8_t buf_write_timeout_max;
  48. uint8_t block_erase_timeout_max;
  49. uint8_t chip_erase_timeout_max;
  50. uint8_t status_poll_mask;
  51. /* flash geometry */
  52. uint32_t dev_size;
  53. uint16_t interface_desc;
  54. uint16_t max_buf_write_size;
  55. uint8_t num_erase_regions;
  56. uint32_t *erase_region_info;
  57. void *pri_ext;
  58. void *alt_ext;
  59. /* calculated timeouts */
  60. unsigned word_write_timeout;
  61. unsigned buf_write_timeout;
  62. unsigned block_erase_timeout;
  63. unsigned chip_erase_timeout;
  64. };
  65. /* Intel primary extended query table
  66. * as defined for the Advanced+ Boot Block Flash Memory (C3)
  67. * and used by the linux kernel cfi driver (as of 2.6.14)
  68. */
  69. struct cfi_intel_pri_ext {
  70. uint8_t pri[3];
  71. uint8_t major_version;
  72. uint8_t minor_version;
  73. uint32_t feature_support;
  74. uint8_t suspend_cmd_support;
  75. uint16_t blk_status_reg_mask;
  76. uint8_t vcc_optimal;
  77. uint8_t vpp_optimal;
  78. uint8_t num_protection_fields;
  79. uint16_t prot_reg_addr;
  80. uint8_t fact_prot_reg_size;
  81. uint8_t user_prot_reg_size;
  82. uint8_t extra[0];
  83. };
  84. /* Spansion primary extended query table as defined for and used by
  85. * the linux kernel cfi driver (as of 2.6.15)
  86. */
  87. struct cfi_spansion_pri_ext {
  88. uint8_t pri[3];
  89. uint8_t major_version;
  90. uint8_t minor_version;
  91. uint8_t SiliconRevision; /* bits 1-0: Address Sensitive Unlock */
  92. uint8_t EraseSuspend;
  93. uint8_t BlkProt;
  94. uint8_t TmpBlkUnprotect;
  95. uint8_t BlkProtUnprot;
  96. uint8_t SimultaneousOps;
  97. uint8_t BurstMode;
  98. uint8_t PageMode;
  99. uint8_t VppMin;
  100. uint8_t VppMax;
  101. uint8_t TopBottom;
  102. int _reversed_geometry;
  103. uint32_t _unlock1;
  104. uint32_t _unlock2;
  105. };
  106. /* Atmel primary extended query table as defined for and used by
  107. * the linux kernel cfi driver (as of 2.6.20+)
  108. */
  109. struct cfi_atmel_pri_ext {
  110. uint8_t pri[3];
  111. uint8_t major_version;
  112. uint8_t minor_version;
  113. uint8_t features;
  114. uint8_t bottom_boot;
  115. uint8_t burst_mode;
  116. uint8_t page_mode;
  117. };
  118. enum {
  119. CFI_UNLOCK_555_2AA,
  120. CFI_UNLOCK_5555_2AAA,
  121. };
  122. struct cfi_unlock_addresses {
  123. uint32_t unlock1;
  124. uint32_t unlock2;
  125. };
  126. struct cfi_fixup {
  127. uint16_t mfr;
  128. uint16_t id;
  129. void (*fixup)(struct flash_bank *bank, void *param);
  130. void *param;
  131. };
  132. #define CFI_MFR_AMD 0x0001
  133. #define CFI_MFR_FUJITSU 0x0004
  134. #define CFI_MFR_ATMEL 0x001F
  135. #define CFI_MFR_ST 0x0020 /* STMicroelectronics */
  136. #define CFI_MFR_AMIC 0x0037
  137. #define CFI_MFR_SST 0x00BF
  138. #define CFI_MFR_MX 0x00C2
  139. #define CFI_MFR_EON 0x007F
  140. #define CFI_MFR_ANY 0xffff
  141. #define CFI_ID_ANY 0xffff
  142. #endif /* CFI_H */