|
31 | 31 |
|
32 | 32 | typedef struct { |
33 | 33 | uint32_t total_size; |
34 | | - uint16_t erase_size; |
35 | | - uint16_t page_size; |
36 | 34 | uint16_t start_up_time_us; |
| 35 | + |
| 36 | + // Three response bytes to 0x9f JEDEC ID command. |
37 | 37 | uint8_t manufacturer_id; |
38 | 38 | uint8_t memory_type; |
39 | 39 | uint8_t capacity; |
| 40 | + |
| 41 | + // Max clock speed for all operations and the fastest read mode. |
40 | 42 | uint8_t max_clock_speed_mhz; |
41 | | - bool has_sector_protection; |
42 | | - bool supports_qspi; |
43 | | - bool supports_qspi_writes; |
| 43 | + bool has_sector_protection : 1; |
| 44 | + |
| 45 | + // Supports the 0x0b fast read command with 8 dummy cycles. |
| 46 | + bool supports_fast_read : 1; |
| 47 | + |
| 48 | + // Supports the fast read, quad output command 0x6b with 8 dummy cycles. |
| 49 | + bool supports_qspi : 1; |
| 50 | + |
| 51 | + // Requires quad enable set in status bit 9. |
| 52 | + bool has_quad_enable : 1; |
| 53 | + |
| 54 | + // Supports the quad input page program command 0x32. This is known as 1-1-4 because it only |
| 55 | + // uses all four lines for data. |
| 56 | + bool supports_qspi_writes: 1; |
44 | 57 | } external_flash_device; |
45 | 58 |
|
46 | 59 | // Settings for the Adesto Tech AT25DF081A 1MiB SPI flash. Its on the SAMD21 |
47 | 60 | // Xplained board. |
48 | 61 | // Datasheet: https://www.adestotech.com/wp-content/uploads/doc8715.pdf |
49 | 62 | #define AT25DF081A {\ |
50 | 63 | .total_size = (1 << 20), /* 1 MiB */ \ |
51 | | - .erase_size = (1 << 12), /* 4 KiB */ \ |
52 | | - .page_size = 256, /*256 bytes */ \ |
53 | 64 | .start_up_time_us = 10000, \ |
54 | 65 | .manufacturer_id = 0x1f, \ |
55 | 66 | .memory_type = 0x45, \ |
56 | 67 | .capacity = 0x01, \ |
57 | | - .max_clock_speed_mhz = 104, \ |
| 68 | + .max_clock_speed_mhz = 85, \ |
58 | 69 | .has_sector_protection = true, \ |
59 | | - .supports_qspi = true, \ |
| 70 | + .supports_fast_read = true, \ |
| 71 | + .supports_qspi = false, \ |
| 72 | + .has_quad_enable = false, \ |
60 | 73 | .supports_qspi_writes = false, \ |
61 | 74 | } |
62 | 75 |
|
63 | 76 | // Settings for the Gigadevice GD25Q16C 2MiB SPI flash. |
64 | 77 | // Datasheet: http://www.gigadevice.com/wp-content/uploads/2017/12/DS-00086-GD25Q16C-Rev2.6.pdf |
65 | | - |
66 | 78 | #define GD25Q16C {\ |
67 | 79 | .total_size = (1 << 21), /* 2 MiB */ \ |
68 | | - .erase_size = (1 << 12), /* 4 KiB */ \ |
69 | | - .page_size = 256, /*256 bytes */ \ |
70 | 80 | .start_up_time_us = 5000, \ |
71 | 81 | .manufacturer_id = 0xc8, \ |
72 | 82 | .memory_type = 0x40, \ |
73 | 83 | .capacity = 0x15, \ |
74 | | - .max_clock_speed_mhz = 104, \ |
75 | | - .has_sector_protection = true, \ |
| 84 | + .max_clock_speed_mhz = 104, /* if we need 120 then we can turn on high performance mode */ \ |
| 85 | + .has_sector_protection = false, \ |
| 86 | + .supports_fast_read = true, \ |
76 | 87 | .supports_qspi = true, \ |
77 | | - .supports_qspi_writes = false, \ |
| 88 | + .has_quad_enable = true, \ |
| 89 | + .supports_qspi_writes = true, \ |
78 | 90 | } |
79 | 91 |
|
80 | 92 | // Settings for the Cypress (was Spansion) S25FL064L 8MiB SPI flash. |
81 | 93 | // Datasheet: http://www.cypress.com/file/316661/download |
82 | 94 | #define S25FL064L {\ |
83 | 95 | .total_size = (1 << 23), /* 8 MiB */ \ |
84 | | - .erase_size = (1 << 12), /* 4 KiB */ \ |
85 | | - .page_size = 256, /*256 bytes */ \ |
86 | 96 | .start_up_time_us = 300, \ |
87 | 97 | .manufacturer_id = 0x01, \ |
88 | 98 | .memory_type = 0x60, \ |
89 | 99 | .capacity = 0x17, \ |
90 | | - .max_clock_speed_mhz = 104, \ |
91 | | - .has_sector_protection = true, \ |
| 100 | + .max_clock_speed_mhz = 108, \ |
| 101 | + .has_sector_protection = false, \ |
| 102 | + .supports_fast_read = true, \ |
92 | 103 | .supports_qspi = true, \ |
93 | | - .supports_qspi_writes = false, \ |
| 104 | + .has_quad_enable = true, \ |
| 105 | + .supports_qspi_writes = true, \ |
94 | 106 | } |
95 | 107 |
|
96 | 108 | // Settings for the Cypress (was Spansion) S25FL116K 2MiB SPI flash. |
97 | 109 | // Datasheet: http://www.cypress.com/file/196886/download |
98 | 110 | #define S25FL116K {\ |
99 | 111 | .total_size = (1 << 21), /* 2 MiB */ \ |
100 | | - .erase_size = (1 << 12), /* 4 KiB */ \ |
101 | | - .page_size = 256, /*256 bytes */ \ |
102 | 112 | .start_up_time_us = 10000, \ |
103 | 113 | .manufacturer_id = 0x01, \ |
104 | 114 | .memory_type = 0x40, \ |
105 | 115 | .capacity = 0x15, \ |
106 | | - .max_clock_speed_mhz = 104, \ |
107 | | - .has_sector_protection = true, \ |
| 116 | + .max_clock_speed_mhz = 108, \ |
| 117 | + .has_sector_protection = false, \ |
| 118 | + .supports_fast_read = true, \ |
108 | 119 | .supports_qspi = true, \ |
| 120 | + .has_quad_enable = true, \ |
109 | 121 | .supports_qspi_writes = false, \ |
110 | 122 | } |
111 | 123 |
|
112 | | - |
113 | 124 | // Settings for the Cypress (was Spansion) S25FL216K 2MiB SPI flash. |
114 | 125 | // Datasheet: http://www.cypress.com/file/197346/download |
115 | | - |
116 | 126 | #define S25FL216K {\ |
117 | 127 | .total_size = (1 << 21), /* 2 MiB */ \ |
118 | | - .erase_size = (1 << 12), /* 4 KiB */ \ |
119 | | - .page_size = 256, /*256 bytes */ \ |
120 | 128 | .start_up_time_us = 10000, \ |
121 | 129 | .manufacturer_id = 0x01, \ |
122 | 130 | .memory_type = 0x40, \ |
123 | 131 | .capacity = 0x15, \ |
124 | | - .max_clock_speed_mhz = 104, \ |
| 132 | + .max_clock_speed_mhz = 65, \ |
125 | 133 | .has_sector_protection = false, \ |
126 | | - .supports_qspi = true, \ |
| 134 | + .supports_fast_read = true, \ |
| 135 | + .supports_qspi = false, \ |
| 136 | + .has_quad_enable = false, \ |
127 | 137 | .supports_qspi_writes = false, \ |
128 | 138 | } |
129 | 139 |
|
130 | 140 | // Settings for the Winbond W25Q16FW 2MiB SPI flash. |
131 | 141 | // Datasheet: https://www.winbond.com/resource-files/w25q16fw%20revj%2005182017%20sfdp.pdf |
132 | | - |
133 | 142 | #define W25Q16FW {\ |
134 | 143 | .total_size = (1 << 21), /* 2 MiB */ \ |
135 | | - .erase_size = (1 << 12), /* 4 KiB */ \ |
136 | | - .page_size = 256, /*256 bytes */ \ |
137 | 144 | .start_up_time_us = 5000, \ |
138 | 145 | .manufacturer_id = 0xef, \ |
139 | 146 | .memory_type = 0x60, \ |
140 | 147 | .capacity = 0x15, \ |
141 | | - .max_clock_speed_mhz = 104, \ |
| 148 | + .max_clock_speed_mhz = 133, \ |
142 | 149 | .has_sector_protection = false, \ |
| 150 | + .supports_fast_read = true, \ |
143 | 151 | .supports_qspi = true, \ |
144 | | - .supports_qspi_writes = false, \ |
| 152 | + .has_quad_enable = true, \ |
| 153 | + .supports_qspi_writes = true, \ |
| 154 | +} |
| 155 | + |
| 156 | +// Settings for the Winbond W25Q16JV 2MiB SPI flash. |
| 157 | +// Datasheet: https://www.winbond.com/resource-files/w25q16jv%20spi%20revf%2005092017.pdf |
| 158 | +#define W25Q16JV {\ |
| 159 | + .total_size = (1 << 21), /* 2 MiB */ \ |
| 160 | + .start_up_time_us = 5000, \ |
| 161 | + .manufacturer_id = 0xef, \ |
| 162 | + .memory_type = 0x40, \ |
| 163 | + .capacity = 0x15, \ |
| 164 | + .max_clock_speed_mhz = 133, \ |
| 165 | + .has_sector_protection = false, \ |
| 166 | + .supports_fast_read = true, \ |
| 167 | + .supports_qspi = true, \ |
| 168 | + .has_quad_enable = true, \ |
| 169 | + .supports_qspi_writes = true, \ |
145 | 170 | } |
146 | 171 |
|
147 | 172 | // Settings for the Winbond W25Q32BV 2MiB SPI flash. |
148 | 173 | // Datasheet: https://www.winbond.com/resource-files/w25q32bv_revi_100413_wo_automotive.pdf |
149 | | - |
150 | 174 | #define W25Q32BV {\ |
151 | | - .total_size = (1 << 21), /* 2 MiB */ \ |
152 | | - .erase_size = (1 << 12), /* 4 KiB */ \ |
153 | | - .page_size = 256, /*256 bytes */ \ |
154 | | - .start_up_time_us = 5000, \ |
| 175 | + .total_size = (1 << 22), /* 4 MiB */ \ |
| 176 | + .start_up_time_us = 10000, \ |
155 | 177 | .manufacturer_id = 0xef, \ |
156 | 178 | .memory_type = 0x60, \ |
157 | 179 | .capacity = 0x16, \ |
158 | 180 | .max_clock_speed_mhz = 104, \ |
159 | 181 | .has_sector_protection = false, \ |
| 182 | + .supports_fast_read = true, \ |
160 | 183 | .supports_qspi = true, \ |
| 184 | + .has_quad_enable = true, \ |
161 | 185 | .supports_qspi_writes = false, \ |
162 | 186 | } |
163 | 187 |
|
164 | 188 | // Settings for the Winbond W25Q80DL 1MiB SPI flash. |
165 | 189 | // Datasheet: https://www.winbond.com/resource-files/w25q80dv%20dl_revh_10022015.pdf |
166 | 190 | #define W25Q80DL {\ |
167 | 191 | .total_size = (1 << 20), /* 1 MiB */ \ |
168 | | - .erase_size = (1 << 12), /* 4 KiB */ \ |
169 | | - .page_size = 256, /*256 bytes */ \ |
170 | 192 | .start_up_time_us = 5000, \ |
171 | 193 | .manufacturer_id = 0xef, \ |
172 | 194 | .memory_type = 0x60, \ |
173 | 195 | .capacity = 0x14, \ |
174 | 196 | .max_clock_speed_mhz = 104, \ |
175 | 197 | .has_sector_protection = false, \ |
| 198 | + .supports_fast_read = true, \ |
176 | 199 | .supports_qspi = true, \ |
| 200 | + .has_quad_enable = true, \ |
177 | 201 | .supports_qspi_writes = false, \ |
178 | 202 | } |
179 | 203 |
|
|
0 commit comments