comparison loadtools/fldevs.c @ 506:0dd2c87c1b63

fc-loadtool flash support overhaul
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 28 May 2019 05:12:47 +0000
parents
children 9a478d33b3ca
comparison
equal deleted inserted replaced
505:7bf0d909c87e 506:0dd2c87c1b63
1 /*
2 * This module holds the tables of supported flash devices
3 */
4
5 #include <sys/types.h>
6 #include <ctype.h>
7 #include <stdio.h>
8 #include <stdint.h>
9 #include <string.h>
10 #include <strings.h>
11 #include <stdlib.h>
12 #include "flash.h"
13
14 extern struct flash_cmdset flash_cmdset_amd;
15 extern struct flash_cmdset flash_cmdset_intel;
16 extern struct flash_cmdset flash_cmdset_intel_w30;
17
18 /* flash bank geometries */
19
20 static struct flash_geom geom_2M_topboot = {
21 .total_size = 0x200000,
22 .nregions = 2,
23 .regions = {0x10000, 31, 0x2000, 8},
24 .total_sectors = 39,
25 };
26
27 static struct flash_geom geom_4M_topboot = {
28 .total_size = 0x400000,
29 .nregions = 2,
30 .regions = {0x10000, 63, 0x2000, 8},
31 .total_sectors = 71,
32 };
33
34 static struct flash_geom geom_8M_topboot = {
35 .total_size = 0x800000,
36 .nregions = 2,
37 .regions = {0x10000, 127, 0x2000, 8},
38 .total_sectors = 135,
39 };
40
41 static struct flash_geom geom_8M_bottomboot = {
42 .total_size = 0x800000,
43 .nregions = 2,
44 .regions = {0x2000, 8, 0x10000, 127},
45 .total_sectors = 135,
46 };
47
48 static struct flash_geom geom_8M_topboot_big = {
49 .total_size = 0x800000,
50 .nregions = 2,
51 .regions = {0x40000, 31, 0x10000, 4},
52 .total_sectors = 35,
53 };
54
55 static struct flash_geom geom_8M_bottomboot_big = {
56 .total_size = 0x800000,
57 .nregions = 2,
58 .regions = {0x10000, 4, 0x40000, 31},
59 .total_sectors = 35,
60 };
61
62 /* Intel and compatible flash chips */
63
64 static struct cfi_check intel_2M_topboot_cfi[] = {
65 {0x10, 'Q'},
66 {0x11, 'R'},
67 {0x12, 'Y'},
68 {0x13, 0x03},
69 {0x14, 0x00},
70 {0x27, 0x15},
71 {0x2C, 0x02},
72 {0x2D, 0x1E},
73 {0x2E, 0x00},
74 {0x2F, 0x00},
75 {0x30, 0x01},
76 {0x31, 0x07},
77 {0x32, 0x00},
78 {0x33, 0x20},
79 {0x34, 0x00},
80 {-1, 0}
81 };
82
83 static struct cfi_check intel_4M_topboot_cfi[] = {
84 {0x10, 'Q'},
85 {0x11, 'R'},
86 {0x12, 'Y'},
87 {0x13, 0x03},
88 {0x14, 0x00},
89 {0x27, 0x16},
90 {0x2C, 0x02},
91 {0x2D, 0x3E},
92 {0x2E, 0x00},
93 {0x2F, 0x00},
94 {0x30, 0x01},
95 {0x31, 0x07},
96 {0x32, 0x00},
97 {0x33, 0x20},
98 {0x34, 0x00},
99 {-1, 0}
100 };
101
102 static struct cfi_check intel_8M_topboot_cfi[] = {
103 {0x10, 'Q'},
104 {0x11, 'R'},
105 {0x12, 'Y'},
106 {0x13, 0x03},
107 {0x14, 0x00},
108 {0x27, 0x17},
109 {0x2C, 0x02},
110 {0x2D, 0x7E},
111 {0x2E, 0x00},
112 {0x2F, 0x00},
113 {0x30, 0x01},
114 {0x31, 0x07},
115 {0x32, 0x00},
116 {0x33, 0x20},
117 {0x34, 0x00},
118 {-1, 0}
119 };
120
121 static struct cfi_check intel_8M_bottomboot_cfi[] = {
122 {0x10, 'Q'},
123 {0x11, 'R'},
124 {0x12, 'Y'},
125 {0x13, 0x03},
126 {0x14, 0x00},
127 {0x27, 0x17},
128 {0x2C, 0x02},
129 {0x2D, 0x07},
130 {0x2E, 0x00},
131 {0x2F, 0x20},
132 {0x30, 0x00},
133 {0x31, 0x7E},
134 {0x32, 0x00},
135 {0x33, 0x00},
136 {0x34, 0x01},
137 {-1, 0}
138 };
139
140 struct flash_device flashdev_28F160C3T = {
141 .name = "Intel 28F160C3T",
142 .cfi_table = intel_2M_topboot_cfi,
143 .required_global_config = FLASH_GLOBAL_CFG_SINGLE_4M,
144 .bank_geom = {&geom_2M_topboot, 0},
145 .cmdset = &flash_cmdset_intel,
146 };
147
148 struct flash_device flashdev_28F320C3T = {
149 .name = "Intel 28F320C3T",
150 .cfi_table = intel_4M_topboot_cfi,
151 .required_global_config = FLASH_GLOBAL_CFG_SINGLE_4M,
152 .bank_geom = {&geom_4M_topboot, 0},
153 .cmdset = &flash_cmdset_intel,
154 };
155
156 struct flash_device flashdev_28F640C3T = {
157 .name = "Intel 28F640C3T",
158 .cfi_table = intel_8M_topboot_cfi,
159 .required_global_config = FLASH_GLOBAL_CFG_SINGLE_8M,
160 .bank_geom = {&geom_8M_topboot, 0},
161 .cmdset = &flash_cmdset_intel,
162 };
163
164 struct flash_device flashdev_28F640C3B = {
165 .name = "Intel 28F640C3B",
166 .cfi_table = intel_8M_bottomboot_cfi,
167 .required_global_config = FLASH_GLOBAL_CFG_SINGLE_8M,
168 .bank_geom = {&geom_8M_bottomboot, 0},
169 .cmdset = &flash_cmdset_intel,
170 };
171
172 struct flash_device flashdev_28F640W30T = {
173 .name = "Intel 28F640W30T",
174 .cfi_table = intel_8M_topboot_cfi,
175 .required_global_config = FLASH_GLOBAL_CFG_SINGLE_8M,
176 .bank_geom = {&geom_8M_topboot, 0},
177 .cmdset = &flash_cmdset_intel_w30,
178 };
179
180 struct flash_device flashdev_28F640W30B = {
181 .name = "Intel 28F640W30B",
182 .cfi_table = intel_8M_bottomboot_cfi,
183 .required_global_config = FLASH_GLOBAL_CFG_SINGLE_8M,
184 .bank_geom = {&geom_8M_bottomboot, 0},
185 .cmdset = &flash_cmdset_intel_w30,
186 };
187
188 /* Spansion S71PL-J and S71PL-N flash */
189
190 static struct cfi_check spansion_PL129J_cfi[] = {
191 {0x10, 'Q'},
192 {0x11, 'R'},
193 {0x12, 'Y'},
194 {0x13, 0x02},
195 {0x14, 0x00},
196 {0x15, 0x40},
197 {0x16, 0x00},
198 {0x27, 0x18},
199 {0x2C, 0x03},
200 {0x2D, 0x07},
201 {0x2E, 0x00},
202 {0x2F, 0x20},
203 {0x30, 0x00},
204 {0x31, 0xFD},
205 {0x32, 0x00},
206 {0x33, 0x00},
207 {0x34, 0x01},
208 {0x35, 0x07},
209 {0x36, 0x00},
210 {0x37, 0x20},
211 {0x38, 0x00},
212 {0x40, 'P'},
213 {0x41, 'R'},
214 {0x42, 'I'},
215 {0x43, '1'},
216 {0x44, '3'},
217 {-1, 0}
218 };
219
220 struct flash_device flashdev_PL129J = {
221 .name = "Spansion S29PL129J",
222 .cfi_table = spansion_PL129J_cfi,
223 .required_global_config = FLASH_GLOBAL_CFG_DUAL_8M,
224 .bank_geom = {&geom_8M_bottomboot, &geom_8M_topboot},
225 .cmdset = &flash_cmdset_amd,
226 };
227
228 static struct cfi_check spansion_PL129N_cfi[] = {
229 {0x10, 'Q'},
230 {0x11, 'R'},
231 {0x12, 'Y'},
232 {0x13, 0x02},
233 {0x14, 0x00},
234 {0x15, 0x40},
235 {0x16, 0x00},
236 {0x27, 0x18},
237 {0x2C, 0x03},
238 {0x2D, 0x03},
239 {0x2E, 0x00},
240 {0x2F, 0x00},
241 {0x30, 0x01},
242 {0x31, 0x3D},
243 {0x32, 0x00},
244 {0x33, 0x00},
245 {0x34, 0x04},
246 {0x35, 0x03},
247 {0x36, 0x00},
248 {0x37, 0x00},
249 {0x38, 0x01},
250 {0x40, 'P'},
251 {0x41, 'R'},
252 {0x42, 'I'},
253 {0x43, '1'},
254 {0x44, '4'},
255 {-1, 0}
256 };
257
258 struct flash_device flashdev_PL129N = {
259 .name = "Spansion S29PL129N",
260 .cfi_table = spansion_PL129N_cfi,
261 .required_global_config = FLASH_GLOBAL_CFG_DUAL_8M,
262 .bank_geom = {&geom_8M_bottomboot_big,
263 &geom_8M_topboot_big},
264 .cmdset = &flash_cmdset_amd,
265 };
266
267 /* Samsung K5A32xxCTM introduced onto the scene by Openmoko */
268
269 static struct cfi_check samsung_4M_topboot_cfi[] = {
270 {0x10, 'Q'},
271 {0x11, 'R'},
272 {0x12, 'Y'},
273 {0x13, 0x02},
274 {0x14, 0x00},
275 {0x15, 0x40},
276 {0x16, 0x00},
277 {0x27, 0x16},
278 {0x2C, 0x02},
279 {0x2D, 0x07},
280 {0x2E, 0x00},
281 {0x2F, 0x20},
282 {0x30, 0x00},
283 {0x31, 0x3E},
284 {0x32, 0x00},
285 {0x33, 0x00},
286 {0x34, 0x01},
287 {0x40, 'P'},
288 {0x41, 'R'},
289 {0x42, 'I'},
290 {0x43, '3'},
291 {0x44, '3'},
292 {0x4F, 0x03},
293 {-1, 0}
294 };
295
296 struct flash_device flashdev_K5A32xx_T = {
297 .name = "Samsung K5A32xx_T",
298 .cfi_table = samsung_4M_topboot_cfi,
299 .required_global_config = FLASH_GLOBAL_CFG_SINGLE_4M,
300 .bank_geom = {&geom_4M_topboot, 0},
301 .cmdset = &flash_cmdset_amd,
302 };