blob: 3f2c090a94fc30d71557844586c8a8ded356813d [file] [log] [blame]
Tim Harvey256dba02021-03-02 14:00:21 -08001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2021 Gateworks Corporation
4 *
5 * Generated code from MX8M_DDR_tool
6 */
7
8#include <linux/kernel.h>
Tim Harvey256dba02021-03-02 14:00:21 -08009#include <asm/arch/ddr.h>
10#include <asm/arch/lpddr4_define.h>
11
Tim Harvey5cc5e192022-02-18 15:19:33 -080012/* ddr phy trained csr */
13static struct dram_cfg_param lpddr4_ddrphy_trained_csr[] = {
14 { 0x200b2, 0x0 },
15 { 0x1200b2, 0x0 },
16 { 0x2200b2, 0x0 },
17 { 0x200cb, 0x0 },
18 { 0x10043, 0x0 },
19 { 0x110043, 0x0 },
20 { 0x210043, 0x0 },
21 { 0x10143, 0x0 },
22 { 0x110143, 0x0 },
23 { 0x210143, 0x0 },
24 { 0x11043, 0x0 },
25 { 0x111043, 0x0 },
26 { 0x211043, 0x0 },
27 { 0x11143, 0x0 },
28 { 0x111143, 0x0 },
29 { 0x211143, 0x0 },
30 { 0x12043, 0x0 },
31 { 0x112043, 0x0 },
32 { 0x212043, 0x0 },
33 { 0x12143, 0x0 },
34 { 0x112143, 0x0 },
35 { 0x212143, 0x0 },
36 { 0x13043, 0x0 },
37 { 0x113043, 0x0 },
38 { 0x213043, 0x0 },
39 { 0x13143, 0x0 },
40 { 0x113143, 0x0 },
41 { 0x213143, 0x0 },
42 { 0x80, 0x0 },
43 { 0x100080, 0x0 },
44 { 0x200080, 0x0 },
45 { 0x1080, 0x0 },
46 { 0x101080, 0x0 },
47 { 0x201080, 0x0 },
48 { 0x2080, 0x0 },
49 { 0x102080, 0x0 },
50 { 0x202080, 0x0 },
51 { 0x3080, 0x0 },
52 { 0x103080, 0x0 },
53 { 0x203080, 0x0 },
54 { 0x4080, 0x0 },
55 { 0x104080, 0x0 },
56 { 0x204080, 0x0 },
57 { 0x5080, 0x0 },
58 { 0x105080, 0x0 },
59 { 0x205080, 0x0 },
60 { 0x6080, 0x0 },
61 { 0x106080, 0x0 },
62 { 0x206080, 0x0 },
63 { 0x7080, 0x0 },
64 { 0x107080, 0x0 },
65 { 0x207080, 0x0 },
66 { 0x8080, 0x0 },
67 { 0x108080, 0x0 },
68 { 0x208080, 0x0 },
69 { 0x9080, 0x0 },
70 { 0x109080, 0x0 },
71 { 0x209080, 0x0 },
72 { 0x10080, 0x0 },
73 { 0x110080, 0x0 },
74 { 0x210080, 0x0 },
75 { 0x10180, 0x0 },
76 { 0x110180, 0x0 },
77 { 0x210180, 0x0 },
78 { 0x11080, 0x0 },
79 { 0x111080, 0x0 },
80 { 0x211080, 0x0 },
81 { 0x11180, 0x0 },
82 { 0x111180, 0x0 },
83 { 0x211180, 0x0 },
84 { 0x12080, 0x0 },
85 { 0x112080, 0x0 },
86 { 0x212080, 0x0 },
87 { 0x12180, 0x0 },
88 { 0x112180, 0x0 },
89 { 0x212180, 0x0 },
90 { 0x13080, 0x0 },
91 { 0x113080, 0x0 },
92 { 0x213080, 0x0 },
93 { 0x13180, 0x0 },
94 { 0x113180, 0x0 },
95 { 0x213180, 0x0 },
96 { 0x10081, 0x0 },
97 { 0x110081, 0x0 },
98 { 0x210081, 0x0 },
99 { 0x10181, 0x0 },
100 { 0x110181, 0x0 },
101 { 0x210181, 0x0 },
102 { 0x11081, 0x0 },
103 { 0x111081, 0x0 },
104 { 0x211081, 0x0 },
105 { 0x11181, 0x0 },
106 { 0x111181, 0x0 },
107 { 0x211181, 0x0 },
108 { 0x12081, 0x0 },
109 { 0x112081, 0x0 },
110 { 0x212081, 0x0 },
111 { 0x12181, 0x0 },
112 { 0x112181, 0x0 },
113 { 0x212181, 0x0 },
114 { 0x13081, 0x0 },
115 { 0x113081, 0x0 },
116 { 0x213081, 0x0 },
117 { 0x13181, 0x0 },
118 { 0x113181, 0x0 },
119 { 0x213181, 0x0 },
120 { 0x100d0, 0x0 },
121 { 0x1100d0, 0x0 },
122 { 0x2100d0, 0x0 },
123 { 0x101d0, 0x0 },
124 { 0x1101d0, 0x0 },
125 { 0x2101d0, 0x0 },
126 { 0x110d0, 0x0 },
127 { 0x1110d0, 0x0 },
128 { 0x2110d0, 0x0 },
129 { 0x111d0, 0x0 },
130 { 0x1111d0, 0x0 },
131 { 0x2111d0, 0x0 },
132 { 0x120d0, 0x0 },
133 { 0x1120d0, 0x0 },
134 { 0x2120d0, 0x0 },
135 { 0x121d0, 0x0 },
136 { 0x1121d0, 0x0 },
137 { 0x2121d0, 0x0 },
138 { 0x130d0, 0x0 },
139 { 0x1130d0, 0x0 },
140 { 0x2130d0, 0x0 },
141 { 0x131d0, 0x0 },
142 { 0x1131d0, 0x0 },
143 { 0x2131d0, 0x0 },
144 { 0x100d1, 0x0 },
145 { 0x1100d1, 0x0 },
146 { 0x2100d1, 0x0 },
147 { 0x101d1, 0x0 },
148 { 0x1101d1, 0x0 },
149 { 0x2101d1, 0x0 },
150 { 0x110d1, 0x0 },
151 { 0x1110d1, 0x0 },
152 { 0x2110d1, 0x0 },
153 { 0x111d1, 0x0 },
154 { 0x1111d1, 0x0 },
155 { 0x2111d1, 0x0 },
156 { 0x120d1, 0x0 },
157 { 0x1120d1, 0x0 },
158 { 0x2120d1, 0x0 },
159 { 0x121d1, 0x0 },
160 { 0x1121d1, 0x0 },
161 { 0x2121d1, 0x0 },
162 { 0x130d1, 0x0 },
163 { 0x1130d1, 0x0 },
164 { 0x2130d1, 0x0 },
165 { 0x131d1, 0x0 },
166 { 0x1131d1, 0x0 },
167 { 0x2131d1, 0x0 },
168 { 0x10068, 0x0 },
169 { 0x10168, 0x0 },
170 { 0x10268, 0x0 },
171 { 0x10368, 0x0 },
172 { 0x10468, 0x0 },
173 { 0x10568, 0x0 },
174 { 0x10668, 0x0 },
175 { 0x10768, 0x0 },
176 { 0x10868, 0x0 },
177 { 0x11068, 0x0 },
178 { 0x11168, 0x0 },
179 { 0x11268, 0x0 },
180 { 0x11368, 0x0 },
181 { 0x11468, 0x0 },
182 { 0x11568, 0x0 },
183 { 0x11668, 0x0 },
184 { 0x11768, 0x0 },
185 { 0x11868, 0x0 },
186 { 0x12068, 0x0 },
187 { 0x12168, 0x0 },
188 { 0x12268, 0x0 },
189 { 0x12368, 0x0 },
190 { 0x12468, 0x0 },
191 { 0x12568, 0x0 },
192 { 0x12668, 0x0 },
193 { 0x12768, 0x0 },
194 { 0x12868, 0x0 },
195 { 0x13068, 0x0 },
196 { 0x13168, 0x0 },
197 { 0x13268, 0x0 },
198 { 0x13368, 0x0 },
199 { 0x13468, 0x0 },
200 { 0x13568, 0x0 },
201 { 0x13668, 0x0 },
202 { 0x13768, 0x0 },
203 { 0x13868, 0x0 },
204 { 0x10069, 0x0 },
205 { 0x10169, 0x0 },
206 { 0x10269, 0x0 },
207 { 0x10369, 0x0 },
208 { 0x10469, 0x0 },
209 { 0x10569, 0x0 },
210 { 0x10669, 0x0 },
211 { 0x10769, 0x0 },
212 { 0x10869, 0x0 },
213 { 0x11069, 0x0 },
214 { 0x11169, 0x0 },
215 { 0x11269, 0x0 },
216 { 0x11369, 0x0 },
217 { 0x11469, 0x0 },
218 { 0x11569, 0x0 },
219 { 0x11669, 0x0 },
220 { 0x11769, 0x0 },
221 { 0x11869, 0x0 },
222 { 0x12069, 0x0 },
223 { 0x12169, 0x0 },
224 { 0x12269, 0x0 },
225 { 0x12369, 0x0 },
226 { 0x12469, 0x0 },
227 { 0x12569, 0x0 },
228 { 0x12669, 0x0 },
229 { 0x12769, 0x0 },
230 { 0x12869, 0x0 },
231 { 0x13069, 0x0 },
232 { 0x13169, 0x0 },
233 { 0x13269, 0x0 },
234 { 0x13369, 0x0 },
235 { 0x13469, 0x0 },
236 { 0x13569, 0x0 },
237 { 0x13669, 0x0 },
238 { 0x13769, 0x0 },
239 { 0x13869, 0x0 },
240 { 0x1008c, 0x0 },
241 { 0x11008c, 0x0 },
242 { 0x21008c, 0x0 },
243 { 0x1018c, 0x0 },
244 { 0x11018c, 0x0 },
245 { 0x21018c, 0x0 },
246 { 0x1108c, 0x0 },
247 { 0x11108c, 0x0 },
248 { 0x21108c, 0x0 },
249 { 0x1118c, 0x0 },
250 { 0x11118c, 0x0 },
251 { 0x21118c, 0x0 },
252 { 0x1208c, 0x0 },
253 { 0x11208c, 0x0 },
254 { 0x21208c, 0x0 },
255 { 0x1218c, 0x0 },
256 { 0x11218c, 0x0 },
257 { 0x21218c, 0x0 },
258 { 0x1308c, 0x0 },
259 { 0x11308c, 0x0 },
260 { 0x21308c, 0x0 },
261 { 0x1318c, 0x0 },
262 { 0x11318c, 0x0 },
263 { 0x21318c, 0x0 },
264 { 0x1008d, 0x0 },
265 { 0x11008d, 0x0 },
266 { 0x21008d, 0x0 },
267 { 0x1018d, 0x0 },
268 { 0x11018d, 0x0 },
269 { 0x21018d, 0x0 },
270 { 0x1108d, 0x0 },
271 { 0x11108d, 0x0 },
272 { 0x21108d, 0x0 },
273 { 0x1118d, 0x0 },
274 { 0x11118d, 0x0 },
275 { 0x21118d, 0x0 },
276 { 0x1208d, 0x0 },
277 { 0x11208d, 0x0 },
278 { 0x21208d, 0x0 },
279 { 0x1218d, 0x0 },
280 { 0x11218d, 0x0 },
281 { 0x21218d, 0x0 },
282 { 0x1308d, 0x0 },
283 { 0x11308d, 0x0 },
284 { 0x21308d, 0x0 },
285 { 0x1318d, 0x0 },
286 { 0x11318d, 0x0 },
287 { 0x21318d, 0x0 },
288 { 0x100c0, 0x0 },
289 { 0x1100c0, 0x0 },
290 { 0x2100c0, 0x0 },
291 { 0x101c0, 0x0 },
292 { 0x1101c0, 0x0 },
293 { 0x2101c0, 0x0 },
294 { 0x102c0, 0x0 },
295 { 0x1102c0, 0x0 },
296 { 0x2102c0, 0x0 },
297 { 0x103c0, 0x0 },
298 { 0x1103c0, 0x0 },
299 { 0x2103c0, 0x0 },
300 { 0x104c0, 0x0 },
301 { 0x1104c0, 0x0 },
302 { 0x2104c0, 0x0 },
303 { 0x105c0, 0x0 },
304 { 0x1105c0, 0x0 },
305 { 0x2105c0, 0x0 },
306 { 0x106c0, 0x0 },
307 { 0x1106c0, 0x0 },
308 { 0x2106c0, 0x0 },
309 { 0x107c0, 0x0 },
310 { 0x1107c0, 0x0 },
311 { 0x2107c0, 0x0 },
312 { 0x108c0, 0x0 },
313 { 0x1108c0, 0x0 },
314 { 0x2108c0, 0x0 },
315 { 0x110c0, 0x0 },
316 { 0x1110c0, 0x0 },
317 { 0x2110c0, 0x0 },
318 { 0x111c0, 0x0 },
319 { 0x1111c0, 0x0 },
320 { 0x2111c0, 0x0 },
321 { 0x112c0, 0x0 },
322 { 0x1112c0, 0x0 },
323 { 0x2112c0, 0x0 },
324 { 0x113c0, 0x0 },
325 { 0x1113c0, 0x0 },
326 { 0x2113c0, 0x0 },
327 { 0x114c0, 0x0 },
328 { 0x1114c0, 0x0 },
329 { 0x2114c0, 0x0 },
330 { 0x115c0, 0x0 },
331 { 0x1115c0, 0x0 },
332 { 0x2115c0, 0x0 },
333 { 0x116c0, 0x0 },
334 { 0x1116c0, 0x0 },
335 { 0x2116c0, 0x0 },
336 { 0x117c0, 0x0 },
337 { 0x1117c0, 0x0 },
338 { 0x2117c0, 0x0 },
339 { 0x118c0, 0x0 },
340 { 0x1118c0, 0x0 },
341 { 0x2118c0, 0x0 },
342 { 0x120c0, 0x0 },
343 { 0x1120c0, 0x0 },
344 { 0x2120c0, 0x0 },
345 { 0x121c0, 0x0 },
346 { 0x1121c0, 0x0 },
347 { 0x2121c0, 0x0 },
348 { 0x122c0, 0x0 },
349 { 0x1122c0, 0x0 },
350 { 0x2122c0, 0x0 },
351 { 0x123c0, 0x0 },
352 { 0x1123c0, 0x0 },
353 { 0x2123c0, 0x0 },
354 { 0x124c0, 0x0 },
355 { 0x1124c0, 0x0 },
356 { 0x2124c0, 0x0 },
357 { 0x125c0, 0x0 },
358 { 0x1125c0, 0x0 },
359 { 0x2125c0, 0x0 },
360 { 0x126c0, 0x0 },
361 { 0x1126c0, 0x0 },
362 { 0x2126c0, 0x0 },
363 { 0x127c0, 0x0 },
364 { 0x1127c0, 0x0 },
365 { 0x2127c0, 0x0 },
366 { 0x128c0, 0x0 },
367 { 0x1128c0, 0x0 },
368 { 0x2128c0, 0x0 },
369 { 0x130c0, 0x0 },
370 { 0x1130c0, 0x0 },
371 { 0x2130c0, 0x0 },
372 { 0x131c0, 0x0 },
373 { 0x1131c0, 0x0 },
374 { 0x2131c0, 0x0 },
375 { 0x132c0, 0x0 },
376 { 0x1132c0, 0x0 },
377 { 0x2132c0, 0x0 },
378 { 0x133c0, 0x0 },
379 { 0x1133c0, 0x0 },
380 { 0x2133c0, 0x0 },
381 { 0x134c0, 0x0 },
382 { 0x1134c0, 0x0 },
383 { 0x2134c0, 0x0 },
384 { 0x135c0, 0x0 },
385 { 0x1135c0, 0x0 },
386 { 0x2135c0, 0x0 },
387 { 0x136c0, 0x0 },
388 { 0x1136c0, 0x0 },
389 { 0x2136c0, 0x0 },
390 { 0x137c0, 0x0 },
391 { 0x1137c0, 0x0 },
392 { 0x2137c0, 0x0 },
393 { 0x138c0, 0x0 },
394 { 0x1138c0, 0x0 },
395 { 0x2138c0, 0x0 },
396 { 0x100c1, 0x0 },
397 { 0x1100c1, 0x0 },
398 { 0x2100c1, 0x0 },
399 { 0x101c1, 0x0 },
400 { 0x1101c1, 0x0 },
401 { 0x2101c1, 0x0 },
402 { 0x102c1, 0x0 },
403 { 0x1102c1, 0x0 },
404 { 0x2102c1, 0x0 },
405 { 0x103c1, 0x0 },
406 { 0x1103c1, 0x0 },
407 { 0x2103c1, 0x0 },
408 { 0x104c1, 0x0 },
409 { 0x1104c1, 0x0 },
410 { 0x2104c1, 0x0 },
411 { 0x105c1, 0x0 },
412 { 0x1105c1, 0x0 },
413 { 0x2105c1, 0x0 },
414 { 0x106c1, 0x0 },
415 { 0x1106c1, 0x0 },
416 { 0x2106c1, 0x0 },
417 { 0x107c1, 0x0 },
418 { 0x1107c1, 0x0 },
419 { 0x2107c1, 0x0 },
420 { 0x108c1, 0x0 },
421 { 0x1108c1, 0x0 },
422 { 0x2108c1, 0x0 },
423 { 0x110c1, 0x0 },
424 { 0x1110c1, 0x0 },
425 { 0x2110c1, 0x0 },
426 { 0x111c1, 0x0 },
427 { 0x1111c1, 0x0 },
428 { 0x2111c1, 0x0 },
429 { 0x112c1, 0x0 },
430 { 0x1112c1, 0x0 },
431 { 0x2112c1, 0x0 },
432 { 0x113c1, 0x0 },
433 { 0x1113c1, 0x0 },
434 { 0x2113c1, 0x0 },
435 { 0x114c1, 0x0 },
436 { 0x1114c1, 0x0 },
437 { 0x2114c1, 0x0 },
438 { 0x115c1, 0x0 },
439 { 0x1115c1, 0x0 },
440 { 0x2115c1, 0x0 },
441 { 0x116c1, 0x0 },
442 { 0x1116c1, 0x0 },
443 { 0x2116c1, 0x0 },
444 { 0x117c1, 0x0 },
445 { 0x1117c1, 0x0 },
446 { 0x2117c1, 0x0 },
447 { 0x118c1, 0x0 },
448 { 0x1118c1, 0x0 },
449 { 0x2118c1, 0x0 },
450 { 0x120c1, 0x0 },
451 { 0x1120c1, 0x0 },
452 { 0x2120c1, 0x0 },
453 { 0x121c1, 0x0 },
454 { 0x1121c1, 0x0 },
455 { 0x2121c1, 0x0 },
456 { 0x122c1, 0x0 },
457 { 0x1122c1, 0x0 },
458 { 0x2122c1, 0x0 },
459 { 0x123c1, 0x0 },
460 { 0x1123c1, 0x0 },
461 { 0x2123c1, 0x0 },
462 { 0x124c1, 0x0 },
463 { 0x1124c1, 0x0 },
464 { 0x2124c1, 0x0 },
465 { 0x125c1, 0x0 },
466 { 0x1125c1, 0x0 },
467 { 0x2125c1, 0x0 },
468 { 0x126c1, 0x0 },
469 { 0x1126c1, 0x0 },
470 { 0x2126c1, 0x0 },
471 { 0x127c1, 0x0 },
472 { 0x1127c1, 0x0 },
473 { 0x2127c1, 0x0 },
474 { 0x128c1, 0x0 },
475 { 0x1128c1, 0x0 },
476 { 0x2128c1, 0x0 },
477 { 0x130c1, 0x0 },
478 { 0x1130c1, 0x0 },
479 { 0x2130c1, 0x0 },
480 { 0x131c1, 0x0 },
481 { 0x1131c1, 0x0 },
482 { 0x2131c1, 0x0 },
483 { 0x132c1, 0x0 },
484 { 0x1132c1, 0x0 },
485 { 0x2132c1, 0x0 },
486 { 0x133c1, 0x0 },
487 { 0x1133c1, 0x0 },
488 { 0x2133c1, 0x0 },
489 { 0x134c1, 0x0 },
490 { 0x1134c1, 0x0 },
491 { 0x2134c1, 0x0 },
492 { 0x135c1, 0x0 },
493 { 0x1135c1, 0x0 },
494 { 0x2135c1, 0x0 },
495 { 0x136c1, 0x0 },
496 { 0x1136c1, 0x0 },
497 { 0x2136c1, 0x0 },
498 { 0x137c1, 0x0 },
499 { 0x1137c1, 0x0 },
500 { 0x2137c1, 0x0 },
501 { 0x138c1, 0x0 },
502 { 0x1138c1, 0x0 },
503 { 0x2138c1, 0x0 },
504 { 0x10020, 0x0 },
505 { 0x110020, 0x0 },
506 { 0x210020, 0x0 },
507 { 0x11020, 0x0 },
508 { 0x111020, 0x0 },
509 { 0x211020, 0x0 },
510 { 0x12020, 0x0 },
511 { 0x112020, 0x0 },
512 { 0x212020, 0x0 },
513 { 0x13020, 0x0 },
514 { 0x113020, 0x0 },
515 { 0x213020, 0x0 },
516 { 0x20072, 0x0 },
517 { 0x20073, 0x0 },
518 { 0x20074, 0x0 },
519 { 0x100aa, 0x0 },
520 { 0x110aa, 0x0 },
521 { 0x120aa, 0x0 },
522 { 0x130aa, 0x0 },
523 { 0x20010, 0x0 },
524 { 0x120010, 0x0 },
525 { 0x220010, 0x0 },
526 { 0x20011, 0x0 },
527 { 0x120011, 0x0 },
528 { 0x220011, 0x0 },
529 { 0x100ae, 0x0 },
530 { 0x1100ae, 0x0 },
531 { 0x2100ae, 0x0 },
532 { 0x100af, 0x0 },
533 { 0x1100af, 0x0 },
534 { 0x2100af, 0x0 },
535 { 0x110ae, 0x0 },
536 { 0x1110ae, 0x0 },
537 { 0x2110ae, 0x0 },
538 { 0x110af, 0x0 },
539 { 0x1110af, 0x0 },
540 { 0x2110af, 0x0 },
541 { 0x120ae, 0x0 },
542 { 0x1120ae, 0x0 },
543 { 0x2120ae, 0x0 },
544 { 0x120af, 0x0 },
545 { 0x1120af, 0x0 },
546 { 0x2120af, 0x0 },
547 { 0x130ae, 0x0 },
548 { 0x1130ae, 0x0 },
549 { 0x2130ae, 0x0 },
550 { 0x130af, 0x0 },
551 { 0x1130af, 0x0 },
552 { 0x2130af, 0x0 },
553 { 0x20020, 0x0 },
554 { 0x120020, 0x0 },
555 { 0x220020, 0x0 },
556 { 0x100a0, 0x0 },
557 { 0x100a1, 0x0 },
558 { 0x100a2, 0x0 },
559 { 0x100a3, 0x0 },
560 { 0x100a4, 0x0 },
561 { 0x100a5, 0x0 },
562 { 0x100a6, 0x0 },
563 { 0x100a7, 0x0 },
564 { 0x110a0, 0x0 },
565 { 0x110a1, 0x0 },
566 { 0x110a2, 0x0 },
567 { 0x110a3, 0x0 },
568 { 0x110a4, 0x0 },
569 { 0x110a5, 0x0 },
570 { 0x110a6, 0x0 },
571 { 0x110a7, 0x0 },
572 { 0x120a0, 0x0 },
573 { 0x120a1, 0x0 },
574 { 0x120a2, 0x0 },
575 { 0x120a3, 0x0 },
576 { 0x120a4, 0x0 },
577 { 0x120a5, 0x0 },
578 { 0x120a6, 0x0 },
579 { 0x120a7, 0x0 },
580 { 0x130a0, 0x0 },
581 { 0x130a1, 0x0 },
582 { 0x130a2, 0x0 },
583 { 0x130a3, 0x0 },
584 { 0x130a4, 0x0 },
585 { 0x130a5, 0x0 },
586 { 0x130a6, 0x0 },
587 { 0x130a7, 0x0 },
588 { 0x2007c, 0x0 },
589 { 0x12007c, 0x0 },
590 { 0x22007c, 0x0 },
591 { 0x2007d, 0x0 },
592 { 0x12007d, 0x0 },
593 { 0x22007d, 0x0 },
594 { 0x400fd, 0x0 },
595 { 0x400c0, 0x0 },
596 { 0x90201, 0x0 },
597 { 0x190201, 0x0 },
598 { 0x290201, 0x0 },
599 { 0x90202, 0x0 },
600 { 0x190202, 0x0 },
601 { 0x290202, 0x0 },
602 { 0x90203, 0x0 },
603 { 0x190203, 0x0 },
604 { 0x290203, 0x0 },
605 { 0x90204, 0x0 },
606 { 0x190204, 0x0 },
607 { 0x290204, 0x0 },
608 { 0x90205, 0x0 },
609 { 0x190205, 0x0 },
610 { 0x290205, 0x0 },
611 { 0x90206, 0x0 },
612 { 0x190206, 0x0 },
613 { 0x290206, 0x0 },
614 { 0x90207, 0x0 },
615 { 0x190207, 0x0 },
616 { 0x290207, 0x0 },
617 { 0x90208, 0x0 },
618 { 0x190208, 0x0 },
619 { 0x290208, 0x0 },
620 { 0x10062, 0x0 },
621 { 0x10162, 0x0 },
622 { 0x10262, 0x0 },
623 { 0x10362, 0x0 },
624 { 0x10462, 0x0 },
625 { 0x10562, 0x0 },
626 { 0x10662, 0x0 },
627 { 0x10762, 0x0 },
628 { 0x10862, 0x0 },
629 { 0x11062, 0x0 },
630 { 0x11162, 0x0 },
631 { 0x11262, 0x0 },
632 { 0x11362, 0x0 },
633 { 0x11462, 0x0 },
634 { 0x11562, 0x0 },
635 { 0x11662, 0x0 },
636 { 0x11762, 0x0 },
637 { 0x11862, 0x0 },
638 { 0x12062, 0x0 },
639 { 0x12162, 0x0 },
640 { 0x12262, 0x0 },
641 { 0x12362, 0x0 },
642 { 0x12462, 0x0 },
643 { 0x12562, 0x0 },
644 { 0x12662, 0x0 },
645 { 0x12762, 0x0 },
646 { 0x12862, 0x0 },
647 { 0x13062, 0x0 },
648 { 0x13162, 0x0 },
649 { 0x13262, 0x0 },
650 { 0x13362, 0x0 },
651 { 0x13462, 0x0 },
652 { 0x13562, 0x0 },
653 { 0x13662, 0x0 },
654 { 0x13762, 0x0 },
655 { 0x13862, 0x0 },
656 { 0x20077, 0x0 },
657 { 0x10001, 0x0 },
658 { 0x11001, 0x0 },
659 { 0x12001, 0x0 },
660 { 0x13001, 0x0 },
661 { 0x10040, 0x0 },
662 { 0x10140, 0x0 },
663 { 0x10240, 0x0 },
664 { 0x10340, 0x0 },
665 { 0x10440, 0x0 },
666 { 0x10540, 0x0 },
667 { 0x10640, 0x0 },
668 { 0x10740, 0x0 },
669 { 0x10840, 0x0 },
670 { 0x10030, 0x0 },
671 { 0x10130, 0x0 },
672 { 0x10230, 0x0 },
673 { 0x10330, 0x0 },
674 { 0x10430, 0x0 },
675 { 0x10530, 0x0 },
676 { 0x10630, 0x0 },
677 { 0x10730, 0x0 },
678 { 0x10830, 0x0 },
679 { 0x11040, 0x0 },
680 { 0x11140, 0x0 },
681 { 0x11240, 0x0 },
682 { 0x11340, 0x0 },
683 { 0x11440, 0x0 },
684 { 0x11540, 0x0 },
685 { 0x11640, 0x0 },
686 { 0x11740, 0x0 },
687 { 0x11840, 0x0 },
688 { 0x11030, 0x0 },
689 { 0x11130, 0x0 },
690 { 0x11230, 0x0 },
691 { 0x11330, 0x0 },
692 { 0x11430, 0x0 },
693 { 0x11530, 0x0 },
694 { 0x11630, 0x0 },
695 { 0x11730, 0x0 },
696 { 0x11830, 0x0 },
697 { 0x12040, 0x0 },
698 { 0x12140, 0x0 },
699 { 0x12240, 0x0 },
700 { 0x12340, 0x0 },
701 { 0x12440, 0x0 },
702 { 0x12540, 0x0 },
703 { 0x12640, 0x0 },
704 { 0x12740, 0x0 },
705 { 0x12840, 0x0 },
706 { 0x12030, 0x0 },
707 { 0x12130, 0x0 },
708 { 0x12230, 0x0 },
709 { 0x12330, 0x0 },
710 { 0x12430, 0x0 },
711 { 0x12530, 0x0 },
712 { 0x12630, 0x0 },
713 { 0x12730, 0x0 },
714 { 0x12830, 0x0 },
715 { 0x13040, 0x0 },
716 { 0x13140, 0x0 },
717 { 0x13240, 0x0 },
718 { 0x13340, 0x0 },
719 { 0x13440, 0x0 },
720 { 0x13540, 0x0 },
721 { 0x13640, 0x0 },
722 { 0x13740, 0x0 },
723 { 0x13840, 0x0 },
724 { 0x13030, 0x0 },
725 { 0x13130, 0x0 },
726 { 0x13230, 0x0 },
727 { 0x13330, 0x0 },
728 { 0x13430, 0x0 },
729 { 0x13530, 0x0 },
730 { 0x13630, 0x0 },
731 { 0x13730, 0x0 },
732 { 0x13830, 0x0 },
Tim Harvey256dba02021-03-02 14:00:21 -0800733};
734
735/* DRAM PHY init engine image */
736struct dram_cfg_param lpddr4_phy_pie[] = {
737 { 0xd0000, 0x0 },
738 { 0x90000, 0x10 },
739 { 0x90001, 0x400 },
740 { 0x90002, 0x10e },
741 { 0x90003, 0x0 },
742 { 0x90004, 0x0 },
743 { 0x90005, 0x8 },
744 { 0x90029, 0xb },
745 { 0x9002a, 0x480 },
746 { 0x9002b, 0x109 },
747 { 0x9002c, 0x8 },
748 { 0x9002d, 0x448 },
749 { 0x9002e, 0x139 },
750 { 0x9002f, 0x8 },
751 { 0x90030, 0x478 },
752 { 0x90031, 0x109 },
753 { 0x90032, 0x0 },
754 { 0x90033, 0xe8 },
755 { 0x90034, 0x109 },
756 { 0x90035, 0x2 },
757 { 0x90036, 0x10 },
758 { 0x90037, 0x139 },
759 { 0x90038, 0xf },
760 { 0x90039, 0x7c0 },
761 { 0x9003a, 0x139 },
762 { 0x9003b, 0x44 },
763 { 0x9003c, 0x630 },
764 { 0x9003d, 0x159 },
765 { 0x9003e, 0x14f },
766 { 0x9003f, 0x630 },
767 { 0x90040, 0x159 },
768 { 0x90041, 0x47 },
769 { 0x90042, 0x630 },
770 { 0x90043, 0x149 },
771 { 0x90044, 0x4f },
772 { 0x90045, 0x630 },
773 { 0x90046, 0x179 },
774 { 0x90047, 0x8 },
775 { 0x90048, 0xe0 },
776 { 0x90049, 0x109 },
777 { 0x9004a, 0x0 },
778 { 0x9004b, 0x7c8 },
779 { 0x9004c, 0x109 },
780 { 0x9004d, 0x0 },
781 { 0x9004e, 0x1 },
782 { 0x9004f, 0x8 },
783 { 0x90050, 0x0 },
784 { 0x90051, 0x45a },
785 { 0x90052, 0x9 },
786 { 0x90053, 0x0 },
787 { 0x90054, 0x448 },
788 { 0x90055, 0x109 },
789 { 0x90056, 0x40 },
790 { 0x90057, 0x630 },
791 { 0x90058, 0x179 },
792 { 0x90059, 0x1 },
793 { 0x9005a, 0x618 },
794 { 0x9005b, 0x109 },
795 { 0x9005c, 0x40c0 },
796 { 0x9005d, 0x630 },
797 { 0x9005e, 0x149 },
798 { 0x9005f, 0x8 },
799 { 0x90060, 0x4 },
800 { 0x90061, 0x48 },
801 { 0x90062, 0x4040 },
802 { 0x90063, 0x630 },
803 { 0x90064, 0x149 },
804 { 0x90065, 0x0 },
805 { 0x90066, 0x4 },
806 { 0x90067, 0x48 },
807 { 0x90068, 0x40 },
808 { 0x90069, 0x630 },
809 { 0x9006a, 0x149 },
810 { 0x9006b, 0x10 },
811 { 0x9006c, 0x4 },
812 { 0x9006d, 0x18 },
813 { 0x9006e, 0x0 },
814 { 0x9006f, 0x4 },
815 { 0x90070, 0x78 },
816 { 0x90071, 0x549 },
817 { 0x90072, 0x630 },
818 { 0x90073, 0x159 },
819 { 0x90074, 0xd49 },
820 { 0x90075, 0x630 },
821 { 0x90076, 0x159 },
822 { 0x90077, 0x94a },
823 { 0x90078, 0x630 },
824 { 0x90079, 0x159 },
825 { 0x9007a, 0x441 },
826 { 0x9007b, 0x630 },
827 { 0x9007c, 0x149 },
828 { 0x9007d, 0x42 },
829 { 0x9007e, 0x630 },
830 { 0x9007f, 0x149 },
831 { 0x90080, 0x1 },
832 { 0x90081, 0x630 },
833 { 0x90082, 0x149 },
834 { 0x90083, 0x0 },
835 { 0x90084, 0xe0 },
836 { 0x90085, 0x109 },
837 { 0x90086, 0xa },
838 { 0x90087, 0x10 },
839 { 0x90088, 0x109 },
840 { 0x90089, 0x9 },
841 { 0x9008a, 0x3c0 },
842 { 0x9008b, 0x149 },
843 { 0x9008c, 0x9 },
844 { 0x9008d, 0x3c0 },
845 { 0x9008e, 0x159 },
846 { 0x9008f, 0x18 },
847 { 0x90090, 0x10 },
848 { 0x90091, 0x109 },
849 { 0x90092, 0x0 },
850 { 0x90093, 0x3c0 },
851 { 0x90094, 0x109 },
852 { 0x90095, 0x18 },
853 { 0x90096, 0x4 },
854 { 0x90097, 0x48 },
855 { 0x90098, 0x18 },
856 { 0x90099, 0x4 },
857 { 0x9009a, 0x58 },
858 { 0x9009b, 0xa },
859 { 0x9009c, 0x10 },
860 { 0x9009d, 0x109 },
861 { 0x9009e, 0x2 },
862 { 0x9009f, 0x10 },
863 { 0x900a0, 0x109 },
864 { 0x900a1, 0x5 },
865 { 0x900a2, 0x7c0 },
866 { 0x900a3, 0x109 },
867 { 0x900a4, 0x10 },
868 { 0x900a5, 0x10 },
869 { 0x900a6, 0x109 },
870 { 0x40000, 0x811 },
871 { 0x40020, 0x880 },
872 { 0x40040, 0x0 },
873 { 0x40060, 0x0 },
874 { 0x40001, 0x4008 },
875 { 0x40021, 0x83 },
876 { 0x40041, 0x4f },
877 { 0x40061, 0x0 },
878 { 0x40002, 0x4040 },
879 { 0x40022, 0x83 },
880 { 0x40042, 0x51 },
881 { 0x40062, 0x0 },
882 { 0x40003, 0x811 },
883 { 0x40023, 0x880 },
884 { 0x40043, 0x0 },
885 { 0x40063, 0x0 },
886 { 0x40004, 0x720 },
887 { 0x40024, 0xf },
888 { 0x40044, 0x1740 },
889 { 0x40064, 0x0 },
890 { 0x40005, 0x16 },
891 { 0x40025, 0x83 },
892 { 0x40045, 0x4b },
893 { 0x40065, 0x0 },
894 { 0x40006, 0x716 },
895 { 0x40026, 0xf },
896 { 0x40046, 0x2001 },
897 { 0x40066, 0x0 },
898 { 0x40007, 0x716 },
899 { 0x40027, 0xf },
900 { 0x40047, 0x2800 },
901 { 0x40067, 0x0 },
902 { 0x40008, 0x716 },
903 { 0x40028, 0xf },
904 { 0x40048, 0xf00 },
905 { 0x40068, 0x0 },
906 { 0x40009, 0x720 },
907 { 0x40029, 0xf },
908 { 0x40049, 0x1400 },
909 { 0x40069, 0x0 },
910 { 0x4000a, 0xe08 },
911 { 0x4002a, 0xc15 },
912 { 0x4004a, 0x0 },
913 { 0x4006a, 0x0 },
914 { 0x4000b, 0x623 },
915 { 0x4002b, 0x15 },
916 { 0x4004b, 0x0 },
917 { 0x4006b, 0x0 },
918 { 0x4000c, 0x4028 },
919 { 0x4002c, 0x80 },
920 { 0x4004c, 0x0 },
921 { 0x4006c, 0x0 },
922 { 0x4000d, 0xe08 },
923 { 0x4002d, 0xc1a },
924 { 0x4004d, 0x0 },
925 { 0x4006d, 0x0 },
926 { 0x4000e, 0x623 },
927 { 0x4002e, 0x1a },
928 { 0x4004e, 0x0 },
929 { 0x4006e, 0x0 },
930 { 0x4000f, 0x4040 },
931 { 0x4002f, 0x80 },
932 { 0x4004f, 0x0 },
933 { 0x4006f, 0x0 },
934 { 0x40010, 0x2604 },
935 { 0x40030, 0x15 },
936 { 0x40050, 0x0 },
937 { 0x40070, 0x0 },
938 { 0x40011, 0x708 },
939 { 0x40031, 0x5 },
940 { 0x40051, 0x0 },
941 { 0x40071, 0x2002 },
942 { 0x40012, 0x8 },
943 { 0x40032, 0x80 },
944 { 0x40052, 0x0 },
945 { 0x40072, 0x0 },
946 { 0x40013, 0x2604 },
947 { 0x40033, 0x1a },
948 { 0x40053, 0x0 },
949 { 0x40073, 0x0 },
950 { 0x40014, 0x708 },
951 { 0x40034, 0xa },
952 { 0x40054, 0x0 },
953 { 0x40074, 0x2002 },
954 { 0x40015, 0x4040 },
955 { 0x40035, 0x80 },
956 { 0x40055, 0x0 },
957 { 0x40075, 0x0 },
958 { 0x40016, 0x60a },
959 { 0x40036, 0x15 },
960 { 0x40056, 0x1200 },
961 { 0x40076, 0x0 },
962 { 0x40017, 0x61a },
963 { 0x40037, 0x15 },
964 { 0x40057, 0x1300 },
965 { 0x40077, 0x0 },
966 { 0x40018, 0x60a },
967 { 0x40038, 0x1a },
968 { 0x40058, 0x1200 },
969 { 0x40078, 0x0 },
970 { 0x40019, 0x642 },
971 { 0x40039, 0x1a },
972 { 0x40059, 0x1300 },
973 { 0x40079, 0x0 },
974 { 0x4001a, 0x4808 },
975 { 0x4003a, 0x880 },
976 { 0x4005a, 0x0 },
977 { 0x4007a, 0x0 },
978 { 0x900a7, 0x0 },
979 { 0x900a8, 0x790 },
980 { 0x900a9, 0x11a },
981 { 0x900aa, 0x8 },
982 { 0x900ab, 0x7aa },
983 { 0x900ac, 0x2a },
984 { 0x900ad, 0x10 },
985 { 0x900ae, 0x7b2 },
986 { 0x900af, 0x2a },
987 { 0x900b0, 0x0 },
988 { 0x900b1, 0x7c8 },
989 { 0x900b2, 0x109 },
990 { 0x900b3, 0x10 },
991 { 0x900b4, 0x2a8 },
992 { 0x900b5, 0x129 },
993 { 0x900b6, 0x8 },
994 { 0x900b7, 0x370 },
995 { 0x900b8, 0x129 },
996 { 0x900b9, 0xa },
997 { 0x900ba, 0x3c8 },
998 { 0x900bb, 0x1a9 },
999 { 0x900bc, 0xc },
1000 { 0x900bd, 0x408 },
1001 { 0x900be, 0x199 },
1002 { 0x900bf, 0x14 },
1003 { 0x900c0, 0x790 },
1004 { 0x900c1, 0x11a },
1005 { 0x900c2, 0x8 },
1006 { 0x900c3, 0x4 },
1007 { 0x900c4, 0x18 },
1008 { 0x900c5, 0xe },
1009 { 0x900c6, 0x408 },
1010 { 0x900c7, 0x199 },
1011 { 0x900c8, 0x8 },
1012 { 0x900c9, 0x8568 },
1013 { 0x900ca, 0x108 },
1014 { 0x900cb, 0x18 },
1015 { 0x900cc, 0x790 },
1016 { 0x900cd, 0x16a },
1017 { 0x900ce, 0x8 },
1018 { 0x900cf, 0x1d8 },
1019 { 0x900d0, 0x169 },
1020 { 0x900d1, 0x10 },
1021 { 0x900d2, 0x8558 },
1022 { 0x900d3, 0x168 },
1023 { 0x900d4, 0x70 },
1024 { 0x900d5, 0x788 },
1025 { 0x900d6, 0x16a },
1026 { 0x900d7, 0x1ff8 },
1027 { 0x900d8, 0x85a8 },
1028 { 0x900d9, 0x1e8 },
1029 { 0x900da, 0x50 },
1030 { 0x900db, 0x798 },
1031 { 0x900dc, 0x16a },
1032 { 0x900dd, 0x60 },
1033 { 0x900de, 0x7a0 },
1034 { 0x900df, 0x16a },
1035 { 0x900e0, 0x8 },
1036 { 0x900e1, 0x8310 },
1037 { 0x900e2, 0x168 },
1038 { 0x900e3, 0x8 },
1039 { 0x900e4, 0xa310 },
1040 { 0x900e5, 0x168 },
1041 { 0x900e6, 0xa },
1042 { 0x900e7, 0x408 },
1043 { 0x900e8, 0x169 },
1044 { 0x900e9, 0x6e },
1045 { 0x900ea, 0x0 },
1046 { 0x900eb, 0x68 },
1047 { 0x900ec, 0x0 },
1048 { 0x900ed, 0x408 },
1049 { 0x900ee, 0x169 },
1050 { 0x900ef, 0x0 },
1051 { 0x900f0, 0x8310 },
1052 { 0x900f1, 0x168 },
1053 { 0x900f2, 0x0 },
1054 { 0x900f3, 0xa310 },
1055 { 0x900f4, 0x168 },
1056 { 0x900f5, 0x1ff8 },
1057 { 0x900f6, 0x85a8 },
1058 { 0x900f7, 0x1e8 },
1059 { 0x900f8, 0x68 },
1060 { 0x900f9, 0x798 },
1061 { 0x900fa, 0x16a },
1062 { 0x900fb, 0x78 },
1063 { 0x900fc, 0x7a0 },
1064 { 0x900fd, 0x16a },
1065 { 0x900fe, 0x68 },
1066 { 0x900ff, 0x790 },
1067 { 0x90100, 0x16a },
1068 { 0x90101, 0x8 },
1069 { 0x90102, 0x8b10 },
1070 { 0x90103, 0x168 },
1071 { 0x90104, 0x8 },
1072 { 0x90105, 0xab10 },
1073 { 0x90106, 0x168 },
1074 { 0x90107, 0xa },
1075 { 0x90108, 0x408 },
1076 { 0x90109, 0x169 },
1077 { 0x9010a, 0x58 },
1078 { 0x9010b, 0x0 },
1079 { 0x9010c, 0x68 },
1080 { 0x9010d, 0x0 },
1081 { 0x9010e, 0x408 },
1082 { 0x9010f, 0x169 },
1083 { 0x90110, 0x0 },
1084 { 0x90111, 0x8b10 },
1085 { 0x90112, 0x168 },
1086 { 0x90113, 0x0 },
1087 { 0x90114, 0xab10 },
1088 { 0x90115, 0x168 },
1089 { 0x90116, 0x0 },
1090 { 0x90117, 0x1d8 },
1091 { 0x90118, 0x169 },
1092 { 0x90119, 0x80 },
1093 { 0x9011a, 0x790 },
1094 { 0x9011b, 0x16a },
1095 { 0x9011c, 0x18 },
1096 { 0x9011d, 0x7aa },
1097 { 0x9011e, 0x6a },
1098 { 0x9011f, 0xa },
1099 { 0x90120, 0x0 },
1100 { 0x90121, 0x1e9 },
1101 { 0x90122, 0x8 },
1102 { 0x90123, 0x8080 },
1103 { 0x90124, 0x108 },
1104 { 0x90125, 0xf },
1105 { 0x90126, 0x408 },
1106 { 0x90127, 0x169 },
1107 { 0x90128, 0xc },
1108 { 0x90129, 0x0 },
1109 { 0x9012a, 0x68 },
1110 { 0x9012b, 0x9 },
1111 { 0x9012c, 0x0 },
1112 { 0x9012d, 0x1a9 },
1113 { 0x9012e, 0x0 },
1114 { 0x9012f, 0x408 },
1115 { 0x90130, 0x169 },
1116 { 0x90131, 0x0 },
1117 { 0x90132, 0x8080 },
1118 { 0x90133, 0x108 },
1119 { 0x90134, 0x8 },
1120 { 0x90135, 0x7aa },
1121 { 0x90136, 0x6a },
1122 { 0x90137, 0x0 },
1123 { 0x90138, 0x8568 },
1124 { 0x90139, 0x108 },
1125 { 0x9013a, 0xb7 },
1126 { 0x9013b, 0x790 },
1127 { 0x9013c, 0x16a },
1128 { 0x9013d, 0x1f },
1129 { 0x9013e, 0x0 },
1130 { 0x9013f, 0x68 },
1131 { 0x90140, 0x8 },
1132 { 0x90141, 0x8558 },
1133 { 0x90142, 0x168 },
1134 { 0x90143, 0xf },
1135 { 0x90144, 0x408 },
1136 { 0x90145, 0x169 },
1137 { 0x90146, 0xc },
1138 { 0x90147, 0x0 },
1139 { 0x90148, 0x68 },
1140 { 0x90149, 0x0 },
1141 { 0x9014a, 0x408 },
1142 { 0x9014b, 0x169 },
1143 { 0x9014c, 0x0 },
1144 { 0x9014d, 0x8558 },
1145 { 0x9014e, 0x168 },
1146 { 0x9014f, 0x8 },
1147 { 0x90150, 0x3c8 },
1148 { 0x90151, 0x1a9 },
1149 { 0x90152, 0x3 },
1150 { 0x90153, 0x370 },
1151 { 0x90154, 0x129 },
1152 { 0x90155, 0x20 },
1153 { 0x90156, 0x2aa },
1154 { 0x90157, 0x9 },
1155 { 0x90158, 0x0 },
1156 { 0x90159, 0x400 },
1157 { 0x9015a, 0x10e },
1158 { 0x9015b, 0x8 },
1159 { 0x9015c, 0xe8 },
1160 { 0x9015d, 0x109 },
1161 { 0x9015e, 0x0 },
1162 { 0x9015f, 0x8140 },
1163 { 0x90160, 0x10c },
1164 { 0x90161, 0x10 },
1165 { 0x90162, 0x8138 },
1166 { 0x90163, 0x10c },
1167 { 0x90164, 0x8 },
1168 { 0x90165, 0x7c8 },
1169 { 0x90166, 0x101 },
1170 { 0x90167, 0x8 },
1171 { 0x90168, 0x0 },
1172 { 0x90169, 0x8 },
1173 { 0x9016a, 0x8 },
1174 { 0x9016b, 0x448 },
1175 { 0x9016c, 0x109 },
1176 { 0x9016d, 0xf },
1177 { 0x9016e, 0x7c0 },
1178 { 0x9016f, 0x109 },
1179 { 0x90170, 0x0 },
1180 { 0x90171, 0xe8 },
1181 { 0x90172, 0x109 },
1182 { 0x90173, 0x47 },
1183 { 0x90174, 0x630 },
1184 { 0x90175, 0x109 },
1185 { 0x90176, 0x8 },
1186 { 0x90177, 0x618 },
1187 { 0x90178, 0x109 },
1188 { 0x90179, 0x8 },
1189 { 0x9017a, 0xe0 },
1190 { 0x9017b, 0x109 },
1191 { 0x9017c, 0x0 },
1192 { 0x9017d, 0x7c8 },
1193 { 0x9017e, 0x109 },
1194 { 0x9017f, 0x8 },
1195 { 0x90180, 0x8140 },
1196 { 0x90181, 0x10c },
1197 { 0x90182, 0x0 },
1198 { 0x90183, 0x1 },
1199 { 0x90184, 0x8 },
1200 { 0x90185, 0x8 },
1201 { 0x90186, 0x4 },
1202 { 0x90187, 0x8 },
1203 { 0x90188, 0x8 },
1204 { 0x90189, 0x7c8 },
1205 { 0x9018a, 0x101 },
1206 { 0x90006, 0x0 },
1207 { 0x90007, 0x0 },
1208 { 0x90008, 0x8 },
1209 { 0x90009, 0x0 },
1210 { 0x9000a, 0x0 },
1211 { 0x9000b, 0x0 },
1212 { 0xd00e7, 0x400 },
1213 { 0x90017, 0x0 },
1214 { 0x9001f, 0x2a },
1215 { 0x90026, 0x6a },
1216 { 0x400d0, 0x0 },
1217 { 0x400d1, 0x101 },
1218 { 0x400d2, 0x105 },
1219 { 0x400d3, 0x107 },
1220 { 0x400d4, 0x10f },
1221 { 0x400d5, 0x202 },
1222 { 0x400d6, 0x20a },
1223 { 0x400d7, 0x20b },
1224 { 0x2003a, 0x2 },
1225 { 0x2000b, 0x5d },
1226 { 0x2000c, 0xbb },
1227 { 0x2000d, 0x753 },
1228 { 0x2000e, 0x2c },
1229 { 0x12000b, 0xc },
1230 { 0x12000c, 0x19 },
1231 { 0x12000d, 0xfa },
1232 { 0x12000e, 0x10 },
1233 { 0x22000b, 0x3 },
1234 { 0x22000c, 0x6 },
1235 { 0x22000d, 0x3e },
1236 { 0x22000e, 0x10 },
1237 { 0x9000c, 0x0 },
1238 { 0x9000d, 0x173 },
1239 { 0x9000e, 0x60 },
1240 { 0x9000f, 0x6110 },
1241 { 0x90010, 0x2152 },
1242 { 0x90011, 0xdfbd },
1243 { 0x90012, 0x60 },
1244 { 0x90013, 0x6152 },
1245 { 0x20010, 0x5a },
1246 { 0x20011, 0x3 },
1247 { 0x120010, 0x5a },
1248 { 0x120011, 0x3 },
1249 { 0x220010, 0x5a },
1250 { 0x220011, 0x3 },
1251 { 0x40080, 0xe0 },
1252 { 0x40081, 0x12 },
1253 { 0x40082, 0xe0 },
1254 { 0x40083, 0x12 },
1255 { 0x40084, 0xe0 },
1256 { 0x40085, 0x12 },
1257 { 0x140080, 0xe0 },
1258 { 0x140081, 0x12 },
1259 { 0x140082, 0xe0 },
1260 { 0x140083, 0x12 },
1261 { 0x140084, 0xe0 },
1262 { 0x140085, 0x12 },
1263 { 0x240080, 0xe0 },
1264 { 0x240081, 0x12 },
1265 { 0x240082, 0xe0 },
1266 { 0x240083, 0x12 },
1267 { 0x240084, 0xe0 },
1268 { 0x240085, 0x12 },
1269 { 0x400fd, 0xf },
1270 { 0x10011, 0x1 },
1271 { 0x10012, 0x1 },
1272 { 0x10013, 0x180 },
1273 { 0x10018, 0x1 },
1274 { 0x10002, 0x6209 },
1275 { 0x100b2, 0x1 },
1276 { 0x101b4, 0x1 },
1277 { 0x102b4, 0x1 },
1278 { 0x103b4, 0x1 },
1279 { 0x104b4, 0x1 },
1280 { 0x105b4, 0x1 },
1281 { 0x106b4, 0x1 },
1282 { 0x107b4, 0x1 },
1283 { 0x108b4, 0x1 },
1284 { 0x11011, 0x1 },
1285 { 0x11012, 0x1 },
1286 { 0x11013, 0x180 },
1287 { 0x11018, 0x1 },
1288 { 0x11002, 0x6209 },
1289 { 0x110b2, 0x1 },
1290 { 0x111b4, 0x1 },
1291 { 0x112b4, 0x1 },
1292 { 0x113b4, 0x1 },
1293 { 0x114b4, 0x1 },
1294 { 0x115b4, 0x1 },
1295 { 0x116b4, 0x1 },
1296 { 0x117b4, 0x1 },
1297 { 0x118b4, 0x1 },
1298 { 0x12011, 0x1 },
1299 { 0x12012, 0x1 },
1300 { 0x12013, 0x180 },
1301 { 0x12018, 0x1 },
1302 { 0x12002, 0x6209 },
1303 { 0x120b2, 0x1 },
1304 { 0x121b4, 0x1 },
1305 { 0x122b4, 0x1 },
1306 { 0x123b4, 0x1 },
1307 { 0x124b4, 0x1 },
1308 { 0x125b4, 0x1 },
1309 { 0x126b4, 0x1 },
1310 { 0x127b4, 0x1 },
1311 { 0x128b4, 0x1 },
1312 { 0x13011, 0x1 },
1313 { 0x13012, 0x1 },
1314 { 0x13013, 0x180 },
1315 { 0x13018, 0x1 },
1316 { 0x13002, 0x6209 },
1317 { 0x130b2, 0x1 },
1318 { 0x131b4, 0x1 },
1319 { 0x132b4, 0x1 },
1320 { 0x133b4, 0x1 },
1321 { 0x134b4, 0x1 },
1322 { 0x135b4, 0x1 },
1323 { 0x136b4, 0x1 },
1324 { 0x137b4, 0x1 },
1325 { 0x138b4, 0x1 },
1326 { 0x2003a, 0x2 },
1327 { 0xc0080, 0x2 },
1328 { 0xd0000, 0x1 },
1329};
1330
Tim Harvey5cc5e192022-02-18 15:19:33 -08001331static struct dram_cfg_param ddr_ddrc_cfg_512mb[] = {
1332 /** Initialize DDRC registers **/
1333 { 0x3d400304, 0x1 },
1334 { 0x3d400030, 0x1 },
1335 { 0x3d400000, 0xa1080020 },
1336 { 0x3d400020, 0x203 },
1337 { 0x3d400024, 0x3a980 },
1338 { 0x3d400064, 0x5b0062 },
1339 { 0x3d4000d0, 0xc00305ba },
1340 { 0x3d4000d4, 0x940000 },
1341 { 0x3d4000dc, 0xd4002d },
1342 { 0x3d4000e0, 0x310000 },
1343 { 0x3d4000e8, 0x66004d },
1344 { 0x3d4000ec, 0x16004d },
1345 { 0x3d400100, 0x191e1920 },
1346 { 0x3d400104, 0x60630 },
1347 { 0x3d40010c, 0xb0b000 },
1348 { 0x3d400110, 0xe04080e },
1349 { 0x3d400114, 0x2040c0c },
1350 { 0x3d400118, 0x1010007 },
1351 { 0x3d40011c, 0x401 },
1352 { 0x3d400130, 0x20600 },
1353 { 0x3d400134, 0xc100002 },
1354 { 0x3d400138, 0x68 },
1355 { 0x3d400144, 0x96004b },
1356 { 0x3d400180, 0x2ee0017 },
1357 { 0x3d400184, 0x2605b8e },
1358 { 0x3d400188, 0x0 },
1359 { 0x3d400190, 0x497820a },
1360 { 0x3d400194, 0x80303 },
1361 { 0x3d4001b4, 0x170a },
1362 { 0x3d4001a0, 0xe0400018 },
1363 { 0x3d4001a4, 0xdf00e4 },
1364 { 0x3d4001a8, 0x80000000 },
1365 { 0x3d4001b0, 0x11 },
1366 { 0x3d4001c0, 0x1 },
1367 { 0x3d4001c4, 0x1 },
1368 { 0x3d4000f4, 0xc99 },
1369 { 0x3d400108, 0x70e1617 },
1370 { 0x3d400200, 0x1f },
1371 { 0x3d40020c, 0x0 },
1372 { 0x3d400210, 0x1f1f },
1373 { 0x3d400204, 0x80808 },
1374 { 0x3d400214, 0x7070707 },
1375 { 0x3d400218, 0xf0f0707 },
1376 { 0x3d40021c, 0xf0f },
1377 { 0x3d400250, 0x29001701 },
1378 { 0x3d400254, 0x2c },
1379 { 0x3d40025c, 0x4000030 },
1380 { 0x3d400264, 0x900093e7 },
1381 { 0x3d40026c, 0x2005574 },
1382 { 0x3d400400, 0x111 },
1383 { 0x3d400408, 0x72ff },
1384 { 0x3d400494, 0x2100e07 },
1385 { 0x3d400498, 0x620096 },
1386 { 0x3d40049c, 0x1100e07 },
1387 { 0x3d4004a0, 0xc8012c },
1388 { 0x3d402020, 0x1 },
1389 { 0x3d402024, 0x7d00 },
1390 { 0x3d402050, 0x20d040 },
1391 { 0x3d402064, 0xc000d },
1392 { 0x3d4020dc, 0x840000 },
1393 { 0x3d4020e0, 0x310000 },
1394 { 0x3d4020e8, 0x66004d },
1395 { 0x3d4020ec, 0x16004d },
1396 { 0x3d402100, 0xa040305 },
1397 { 0x3d402104, 0x30407 },
1398 { 0x3d402108, 0x203060b },
1399 { 0x3d40210c, 0x505000 },
1400 { 0x3d402110, 0x2040202 },
1401 { 0x3d402114, 0x2030202 },
1402 { 0x3d402118, 0x1010004 },
1403 { 0x3d40211c, 0x301 },
1404 { 0x3d402130, 0x20300 },
1405 { 0x3d402134, 0xa100002 },
1406 { 0x3d402138, 0xe },
1407 { 0x3d402144, 0x14000a },
1408 { 0x3d402180, 0x640004 },
1409 { 0x3d402190, 0x3818200 },
1410 { 0x3d402194, 0x80303 },
1411 { 0x3d4021b4, 0x100 },
1412 { 0x3d4020f4, 0xc99 },
1413 { 0x3d403020, 0x1 },
1414 { 0x3d403024, 0x1f40 },
1415 { 0x3d403050, 0x20d040 },
1416 { 0x3d403064, 0x30004 },
1417 { 0x3d4030dc, 0x840000 },
1418 { 0x3d4030e0, 0x310000 },
1419 { 0x3d4030e8, 0x66004d },
1420 { 0x3d4030ec, 0x16004d },
1421 { 0x3d403100, 0xa010102 },
1422 { 0x3d403104, 0x30404 },
1423 { 0x3d403108, 0x203060b },
1424 { 0x3d40310c, 0x505000 },
1425 { 0x3d403110, 0x2040202 },
1426 { 0x3d403114, 0x2030202 },
1427 { 0x3d403118, 0x1010004 },
1428 { 0x3d40311c, 0x301 },
1429 { 0x3d403130, 0x20300 },
1430 { 0x3d403134, 0xa100002 },
1431 { 0x3d403138, 0x4 },
1432 { 0x3d403144, 0x50003 },
1433 { 0x3d403180, 0x190004 },
1434 { 0x3d403190, 0x3818200 },
1435 { 0x3d403194, 0x80303 },
1436 { 0x3d4031b4, 0x100 },
1437 { 0x3d4030f4, 0xc99 },
1438 { 0x3d400028, 0x0 },
1439};
1440
1441/* PHY Initialize Configuration */
1442static struct dram_cfg_param ddr_ddrphy_cfg_512mb[] = {
1443 { 0x100a0, 0x0 },
1444 { 0x100a1, 0x1 },
1445 { 0x100a2, 0x2 },
1446 { 0x100a3, 0x3 },
1447 { 0x100a4, 0x4 },
1448 { 0x100a5, 0x5 },
1449 { 0x100a6, 0x6 },
1450 { 0x100a7, 0x7 },
1451 { 0x110a0, 0x0 },
1452 { 0x110a1, 0x1 },
1453 { 0x110a2, 0x3 },
1454 { 0x110a3, 0x4 },
1455 { 0x110a4, 0x5 },
1456 { 0x110a5, 0x2 },
1457 { 0x110a6, 0x7 },
1458 { 0x110a7, 0x6 },
1459 { 0x120a0, 0x0 },
1460 { 0x120a1, 0x1 },
1461 { 0x120a2, 0x3 },
1462 { 0x120a3, 0x4 },
1463 { 0x120a4, 0x5 },
1464 { 0x120a5, 0x2 },
1465 { 0x120a6, 0x7 },
1466 { 0x120a7, 0x6 },
1467 { 0x130a0, 0x0 },
1468 { 0x130a1, 0x1 },
1469 { 0x130a2, 0x2 },
1470 { 0x130a3, 0x3 },
1471 { 0x130a4, 0x4 },
1472 { 0x130a5, 0x5 },
1473 { 0x130a6, 0x6 },
1474 { 0x130a7, 0x7 },
1475 { 0x1005f, 0x1ff },
1476 { 0x1015f, 0x1ff },
1477 { 0x1105f, 0x1ff },
1478 { 0x1115f, 0x1ff },
1479 { 0x1205f, 0x1ff },
1480 { 0x1215f, 0x1ff },
1481 { 0x1305f, 0x1ff },
1482 { 0x1315f, 0x1ff },
1483 { 0x11005f, 0x1ff },
1484 { 0x11015f, 0x1ff },
1485 { 0x11105f, 0x1ff },
1486 { 0x11115f, 0x1ff },
1487 { 0x11205f, 0x1ff },
1488 { 0x11215f, 0x1ff },
1489 { 0x11305f, 0x1ff },
1490 { 0x11315f, 0x1ff },
1491 { 0x21005f, 0x1ff },
1492 { 0x21015f, 0x1ff },
1493 { 0x21105f, 0x1ff },
1494 { 0x21115f, 0x1ff },
1495 { 0x21205f, 0x1ff },
1496 { 0x21215f, 0x1ff },
1497 { 0x21305f, 0x1ff },
1498 { 0x21315f, 0x1ff },
1499 { 0x55, 0x1ff },
1500 { 0x1055, 0x1ff },
1501 { 0x2055, 0x1ff },
1502 { 0x3055, 0x1ff },
1503 { 0x4055, 0x1ff },
1504 { 0x5055, 0x1ff },
1505 { 0x6055, 0x1ff },
1506 { 0x7055, 0x1ff },
1507 { 0x8055, 0x1ff },
1508 { 0x9055, 0x1ff },
1509 { 0x200c5, 0x19 },
1510 { 0x1200c5, 0x7 },
1511 { 0x2200c5, 0x7 },
1512 { 0x2002e, 0x2 },
1513 { 0x12002e, 0x2 },
1514 { 0x22002e, 0x2 },
1515 { 0x90204, 0x0 },
1516 { 0x190204, 0x0 },
1517 { 0x290204, 0x0 },
1518 { 0x20024, 0x1ab },
1519 { 0x2003a, 0x0 },
1520 { 0x120024, 0x1ab },
1521 { 0x2003a, 0x0 },
1522 { 0x220024, 0x1ab },
1523 { 0x2003a, 0x0 },
1524 { 0x20056, 0x3 },
1525 { 0x120056, 0x3 },
1526 { 0x220056, 0x3 },
1527 { 0x1004d, 0xe00 },
1528 { 0x1014d, 0xe00 },
1529 { 0x1104d, 0xe00 },
1530 { 0x1114d, 0xe00 },
1531 { 0x1204d, 0xe00 },
1532 { 0x1214d, 0xe00 },
1533 { 0x1304d, 0xe00 },
1534 { 0x1314d, 0xe00 },
1535 { 0x11004d, 0xe00 },
1536 { 0x11014d, 0xe00 },
1537 { 0x11104d, 0xe00 },
1538 { 0x11114d, 0xe00 },
1539 { 0x11204d, 0xe00 },
1540 { 0x11214d, 0xe00 },
1541 { 0x11304d, 0xe00 },
1542 { 0x11314d, 0xe00 },
1543 { 0x21004d, 0xe00 },
1544 { 0x21014d, 0xe00 },
1545 { 0x21104d, 0xe00 },
1546 { 0x21114d, 0xe00 },
1547 { 0x21204d, 0xe00 },
1548 { 0x21214d, 0xe00 },
1549 { 0x21304d, 0xe00 },
1550 { 0x21314d, 0xe00 },
1551 { 0x10049, 0xeba },
1552 { 0x10149, 0xeba },
1553 { 0x11049, 0xeba },
1554 { 0x11149, 0xeba },
1555 { 0x12049, 0xeba },
1556 { 0x12149, 0xeba },
1557 { 0x13049, 0xeba },
1558 { 0x13149, 0xeba },
1559 { 0x110049, 0xeba },
1560 { 0x110149, 0xeba },
1561 { 0x111049, 0xeba },
1562 { 0x111149, 0xeba },
1563 { 0x112049, 0xeba },
1564 { 0x112149, 0xeba },
1565 { 0x113049, 0xeba },
1566 { 0x113149, 0xeba },
1567 { 0x210049, 0xeba },
1568 { 0x210149, 0xeba },
1569 { 0x211049, 0xeba },
1570 { 0x211149, 0xeba },
1571 { 0x212049, 0xeba },
1572 { 0x212149, 0xeba },
1573 { 0x213049, 0xeba },
1574 { 0x213149, 0xeba },
1575 { 0x43, 0x63 },
1576 { 0x1043, 0x63 },
1577 { 0x2043, 0x63 },
1578 { 0x3043, 0x63 },
1579 { 0x4043, 0x63 },
1580 { 0x5043, 0x63 },
1581 { 0x6043, 0x63 },
1582 { 0x7043, 0x63 },
1583 { 0x8043, 0x63 },
1584 { 0x9043, 0x63 },
1585 { 0x20018, 0x3 },
1586 { 0x20075, 0x4 },
1587 { 0x20050, 0x0 },
1588 { 0x20008, 0x2ee },
1589 { 0x120008, 0x64 },
1590 { 0x220008, 0x19 },
1591 { 0x20088, 0x9 },
1592 { 0x200b2, 0xdc },
1593 { 0x10043, 0x5a1 },
1594 { 0x10143, 0x5a1 },
1595 { 0x11043, 0x5a1 },
1596 { 0x11143, 0x5a1 },
1597 { 0x12043, 0x5a1 },
1598 { 0x12143, 0x5a1 },
1599 { 0x13043, 0x5a1 },
1600 { 0x13143, 0x5a1 },
1601 { 0x1200b2, 0xdc },
1602 { 0x110043, 0x5a1 },
1603 { 0x110143, 0x5a1 },
1604 { 0x111043, 0x5a1 },
1605 { 0x111143, 0x5a1 },
1606 { 0x112043, 0x5a1 },
1607 { 0x112143, 0x5a1 },
1608 { 0x113043, 0x5a1 },
1609 { 0x113143, 0x5a1 },
1610 { 0x2200b2, 0xdc },
1611 { 0x210043, 0x5a1 },
1612 { 0x210143, 0x5a1 },
1613 { 0x211043, 0x5a1 },
1614 { 0x211143, 0x5a1 },
1615 { 0x212043, 0x5a1 },
1616 { 0x212143, 0x5a1 },
1617 { 0x213043, 0x5a1 },
1618 { 0x213143, 0x5a1 },
1619 { 0x200fa, 0x1 },
1620 { 0x1200fa, 0x1 },
1621 { 0x2200fa, 0x1 },
1622 { 0x20019, 0x1 },
1623 { 0x120019, 0x1 },
1624 { 0x220019, 0x1 },
1625 { 0x200f0, 0x660 },
1626 { 0x200f1, 0x0 },
1627 { 0x200f2, 0x4444 },
1628 { 0x200f3, 0x8888 },
1629 { 0x200f4, 0x5665 },
1630 { 0x200f5, 0x0 },
1631 { 0x200f6, 0x0 },
1632 { 0x200f7, 0xf000 },
1633 { 0x20025, 0x0 },
1634 { 0x2002d, 0x0 },
1635 { 0x12002d, 0x0 },
1636 { 0x22002d, 0x0 },
1637 { 0x200c7, 0x21 },
1638 { 0x1200c7, 0x21 },
1639 { 0x2200c7, 0x21 },
1640 { 0x200ca, 0x24 },
1641 { 0x1200ca, 0x24 },
1642 { 0x2200ca, 0x24 },
1643};
1644
1645/* P0 message block paremeter for training firmware */
1646static struct dram_cfg_param ddr_fsp0_cfg_512mb[] = {
1647 { 0xd0000, 0x0 },
1648 { 0x54003, 0xbb8 },
1649 { 0x54004, 0x2 },
1650 { 0x54005, 0x2228 },
1651 { 0x54006, 0x11 },
1652 { 0x54008, 0x131f },
1653 { 0x54009, 0xc8 },
1654 { 0x5400b, 0x2 },
1655 { 0x54012, 0x110 },
1656 { 0x54019, 0x2dd4 },
1657 { 0x5401a, 0x31 },
1658 { 0x5401b, 0x4d66 },
1659 { 0x5401c, 0x4d00 },
1660 { 0x5401e, 0x16 },
1661 { 0x5401f, 0x2dd4 },
1662 { 0x54020, 0x31 },
1663 { 0x54021, 0x4d66 },
1664 { 0x54022, 0x4d00 },
1665 { 0x54024, 0x16 },
1666 { 0x5402b, 0x1000 },
1667 { 0x5402c, 0x1 },
1668 { 0x54032, 0xd400 },
1669 { 0x54033, 0x312d },
1670 { 0x54034, 0x6600 },
1671 { 0x54035, 0x4d },
1672 { 0x54036, 0x4d },
1673 { 0x54037, 0x1600 },
1674 { 0x54038, 0xd400 },
1675 { 0x54039, 0x312d },
1676 { 0x5403a, 0x6600 },
1677 { 0x5403b, 0x4d },
1678 { 0x5403c, 0x4d },
1679 { 0x5403d, 0x1600 },
1680 { 0xd0000, 0x1 },
1681};
1682
1683/* P1 message block paremeter for training firmware */
1684static struct dram_cfg_param ddr_fsp1_cfg_512mb[] = {
1685 { 0xd0000, 0x0 },
1686 { 0x54002, 0x101 },
1687 { 0x54003, 0x190 },
1688 { 0x54004, 0x2 },
1689 { 0x54005, 0x2228 },
1690 { 0x54006, 0x11 },
1691 { 0x54008, 0x121f },
1692 { 0x54009, 0xc8 },
1693 { 0x5400b, 0x2 },
1694 { 0x54012, 0x110 },
1695 { 0x54019, 0x84 },
1696 { 0x5401a, 0x31 },
1697 { 0x5401b, 0x4d66 },
1698 { 0x5401c, 0x4d00 },
1699 { 0x5401e, 0x16 },
1700 { 0x5401f, 0x84 },
1701 { 0x54020, 0x31 },
1702 { 0x54021, 0x4d66 },
1703 { 0x54022, 0x4d00 },
1704 { 0x54024, 0x16 },
1705 { 0x5402b, 0x1000 },
1706 { 0x5402c, 0x1 },
1707 { 0x54032, 0x8400 },
1708 { 0x54033, 0x3100 },
1709 { 0x54034, 0x6600 },
1710 { 0x54035, 0x4d },
1711 { 0x54036, 0x4d },
1712 { 0x54037, 0x1600 },
1713 { 0x54038, 0x8400 },
1714 { 0x54039, 0x3100 },
1715 { 0x5403a, 0x6600 },
1716 { 0x5403b, 0x4d },
1717 { 0x5403c, 0x4d },
1718 { 0x5403d, 0x1600 },
1719 { 0xd0000, 0x1 },
1720};
1721
1722/* P2 message block paremeter for training firmware */
1723static struct dram_cfg_param ddr_fsp2_cfg_512mb[] = {
1724 { 0xd0000, 0x0 },
1725 { 0x54002, 0x102 },
1726 { 0x54003, 0x64 },
1727 { 0x54004, 0x2 },
1728 { 0x54005, 0x2228 },
1729 { 0x54006, 0x11 },
1730 { 0x54008, 0x121f },
1731 { 0x54009, 0xc8 },
1732 { 0x5400b, 0x2 },
1733 { 0x54012, 0x110 },
1734 { 0x54019, 0x84 },
1735 { 0x5401a, 0x31 },
1736 { 0x5401b, 0x4d66 },
1737 { 0x5401c, 0x4d00 },
1738 { 0x5401e, 0x16 },
1739 { 0x5401f, 0x84 },
1740 { 0x54020, 0x31 },
1741 { 0x54021, 0x4d66 },
1742 { 0x54022, 0x4d00 },
1743 { 0x54024, 0x16 },
1744 { 0x5402b, 0x1000 },
1745 { 0x5402c, 0x1 },
1746 { 0x54032, 0x8400 },
1747 { 0x54033, 0x3100 },
1748 { 0x54034, 0x6600 },
1749 { 0x54035, 0x4d },
1750 { 0x54036, 0x4d },
1751 { 0x54037, 0x1600 },
1752 { 0x54038, 0x8400 },
1753 { 0x54039, 0x3100 },
1754 { 0x5403a, 0x6600 },
1755 { 0x5403b, 0x4d },
1756 { 0x5403c, 0x4d },
1757 { 0x5403d, 0x1600 },
1758 { 0xd0000, 0x1 },
1759};
1760
1761/* P0 2D message block paremeter for training firmware */
1762static struct dram_cfg_param ddr_fsp0_2d_cfg_512mb[] = {
1763 { 0xd0000, 0x0 },
1764 { 0x54003, 0xbb8 },
1765 { 0x54004, 0x2 },
1766 { 0x54005, 0x2228 },
1767 { 0x54006, 0x11 },
1768 { 0x54008, 0x61 },
1769 { 0x54009, 0xc8 },
1770 { 0x5400b, 0x2 },
1771 { 0x5400f, 0x100 },
1772 { 0x54010, 0x1f7f },
1773 { 0x54012, 0x110 },
1774 { 0x54019, 0x2dd4 },
1775 { 0x5401a, 0x31 },
1776 { 0x5401b, 0x4d66 },
1777 { 0x5401c, 0x4d00 },
1778 { 0x5401e, 0x16 },
1779 { 0x5401f, 0x2dd4 },
1780 { 0x54020, 0x31 },
1781 { 0x54021, 0x4d66 },
1782 { 0x54022, 0x4d00 },
1783 { 0x54024, 0x16 },
1784 { 0x5402b, 0x1000 },
1785 { 0x5402c, 0x1 },
1786 { 0x54032, 0xd400 },
1787 { 0x54033, 0x312d },
1788 { 0x54034, 0x6600 },
1789 { 0x54035, 0x4d },
1790 { 0x54036, 0x4d },
1791 { 0x54037, 0x1600 },
1792 { 0x54038, 0xd400 },
1793 { 0x54039, 0x312d },
1794 { 0x5403a, 0x6600 },
1795 { 0x5403b, 0x4d },
1796 { 0x5403c, 0x4d },
1797 { 0x5403d, 0x1600 },
1798 { 0xd0000, 0x1 },
1799};
1800
1801static struct dram_fsp_msg ddr_dram_fsp_msg_512mb[] = {
1802 {
1803 /* P0 3000mts 1D */
1804 .drate = 3000,
1805 .fw_type = FW_1D_IMAGE,
1806 .fsp_cfg = ddr_fsp0_cfg_512mb,
1807 .fsp_cfg_num = ARRAY_SIZE(ddr_fsp0_cfg_512mb),
1808 },
1809 {
1810 /* P1 400mts 1D */
1811 .drate = 400,
1812 .fw_type = FW_1D_IMAGE,
1813 .fsp_cfg = ddr_fsp1_cfg_512mb,
1814 .fsp_cfg_num = ARRAY_SIZE(ddr_fsp1_cfg_512mb),
1815 },
1816 {
1817 /* P2 100mts 1D */
1818 .drate = 100,
1819 .fw_type = FW_1D_IMAGE,
1820 .fsp_cfg = ddr_fsp2_cfg_512mb,
1821 .fsp_cfg_num = ARRAY_SIZE(ddr_fsp2_cfg_512mb),
1822 },
1823 {
1824 /* P0 3000mts 2D */
1825 .drate = 3000,
1826 .fw_type = FW_2D_IMAGE,
1827 .fsp_cfg = ddr_fsp0_2d_cfg_512mb,
1828 .fsp_cfg_num = ARRAY_SIZE(ddr_fsp0_2d_cfg_512mb),
1829 },
1830};
1831
1832/* ddr timing config params */
1833struct dram_timing_info dram_timing_512mb = {
1834 .ddrc_cfg = ddr_ddrc_cfg_512mb,
1835 .ddrc_cfg_num = ARRAY_SIZE(ddr_ddrc_cfg_512mb),
1836 .ddrphy_cfg = ddr_ddrphy_cfg_512mb,
1837 .ddrphy_cfg_num = ARRAY_SIZE(ddr_ddrphy_cfg_512mb),
1838 .fsp_msg = ddr_dram_fsp_msg_512mb,
1839 .fsp_msg_num = ARRAY_SIZE(ddr_dram_fsp_msg_512mb),
1840 .ddrphy_trained_csr = lpddr4_ddrphy_trained_csr,
1841 .ddrphy_trained_csr_num = ARRAY_SIZE(lpddr4_ddrphy_trained_csr),
1842 .ddrphy_pie = lpddr4_phy_pie,
1843 .ddrphy_pie_num = ARRAY_SIZE(lpddr4_phy_pie),
1844 .fsp_table = { 3000, 400, 100, },
1845};
1846
1847static struct dram_cfg_param lpddr4_ddrc_cfg_1gb[] = {
1848 /** Initialize DDRC registers **/
1849 { 0x3d400304, 0x1 },
1850 { 0x3d400030, 0x1 },
1851 { 0x3d400000, 0xa1080020 },
1852 { 0x3d400020, 0x223 },
1853 { 0x3d400024, 0x3a980 },
1854 { 0x3d400064, 0x5b0087 },
1855 { 0x3d4000d0, 0xc00305ba },
1856 { 0x3d4000d4, 0x940000 },
1857 { 0x3d4000dc, 0xd4002d },
1858 { 0x3d4000e0, 0x310000 },
1859 { 0x3d4000e8, 0x66004d },
1860 { 0x3d4000ec, 0x16004d },
1861 { 0x3d400100, 0x191e1920 },
1862 { 0x3d400104, 0x60630 },
1863 { 0x3d40010c, 0xb0b000 },
1864 { 0x3d400110, 0xe04080e },
1865 { 0x3d400114, 0x2040c0c },
1866 { 0x3d400118, 0x1010007 },
1867 { 0x3d40011c, 0x401 },
1868 { 0x3d400130, 0x20600 },
1869 { 0x3d400134, 0xc100002 },
1870 { 0x3d400138, 0x8d },
1871 { 0x3d400144, 0x96004b },
1872 { 0x3d400180, 0x2ee0017 },
1873 { 0x3d400184, 0x2605b8e },
1874 { 0x3d400188, 0x0 },
1875 { 0x3d400190, 0x497820a },
1876 { 0x3d400194, 0x80303 },
1877 { 0x3d4001b4, 0x170a },
1878 { 0x3d4001a0, 0xe0400018 },
1879 { 0x3d4001a4, 0xdf00e4 },
1880 { 0x3d4001a8, 0x80000000 },
1881 { 0x3d4001b0, 0x11 },
1882 { 0x3d4001c0, 0x1 },
1883 { 0x3d4001c4, 0x1 },
1884 { 0x3d4000f4, 0xc99 },
1885 { 0x3d400108, 0x70e1617 },
1886 { 0x3d400200, 0x1f },
1887 { 0x3d40020c, 0x0 },
1888 { 0x3d400210, 0x1f1f },
1889 { 0x3d400204, 0x80808 },
1890 { 0x3d400214, 0x7070707 },
1891 { 0x3d400218, 0xf070707 },
1892 { 0x3d400250, 0x29001701 },
1893 { 0x3d400254, 0x2c },
1894 { 0x3d40025c, 0x4000030 },
1895 { 0x3d400264, 0x900093e7 },
1896 { 0x3d40026c, 0x2005574 },
1897 { 0x3d400400, 0x111 },
1898 { 0x3d400408, 0x72ff },
1899 { 0x3d400494, 0x2100e07 },
1900 { 0x3d400498, 0x620096 },
1901 { 0x3d40049c, 0x1100e07 },
1902 { 0x3d4004a0, 0xc8012c },
1903 { 0x3d402020, 0x21 },
1904 { 0x3d402024, 0x7d00 },
1905 { 0x3d402050, 0x20d040 },
1906 { 0x3d402064, 0xc0012 },
1907 { 0x3d4020dc, 0x840000 },
1908 { 0x3d4020e0, 0x310000 },
1909 { 0x3d4020e8, 0x66004d },
1910 { 0x3d4020ec, 0x16004d },
1911 { 0x3d402100, 0xa040305 },
1912 { 0x3d402104, 0x30407 },
1913 { 0x3d402108, 0x203060b },
1914 { 0x3d40210c, 0x505000 },
1915 { 0x3d402110, 0x2040202 },
1916 { 0x3d402114, 0x2030202 },
1917 { 0x3d402118, 0x1010004 },
1918 { 0x3d40211c, 0x301 },
1919 { 0x3d402130, 0x20300 },
1920 { 0x3d402134, 0xa100002 },
1921 { 0x3d402138, 0x13 },
1922 { 0x3d402144, 0x14000a },
1923 { 0x3d402180, 0x640004 },
1924 { 0x3d402190, 0x3818200 },
1925 { 0x3d402194, 0x80303 },
1926 { 0x3d4021b4, 0x100 },
1927 { 0x3d4020f4, 0xc99 },
1928 { 0x3d403020, 0x21 },
1929 { 0x3d403024, 0x1f40 },
1930 { 0x3d403050, 0x20d040 },
1931 { 0x3d403064, 0x30005 },
1932 { 0x3d4030dc, 0x840000 },
1933 { 0x3d4030e0, 0x310000 },
1934 { 0x3d4030e8, 0x66004d },
1935 { 0x3d4030ec, 0x16004d },
1936 { 0x3d403100, 0xa010102 },
1937 { 0x3d403104, 0x30404 },
1938 { 0x3d403108, 0x203060b },
1939 { 0x3d40310c, 0x505000 },
1940 { 0x3d403110, 0x2040202 },
1941 { 0x3d403114, 0x2030202 },
1942 { 0x3d403118, 0x1010004 },
1943 { 0x3d40311c, 0x301 },
1944 { 0x3d403130, 0x20300 },
1945 { 0x3d403134, 0xa100002 },
1946 { 0x3d403138, 0x5 },
1947 { 0x3d403144, 0x50003 },
1948 { 0x3d403180, 0x190004 },
1949 { 0x3d403190, 0x3818200 },
1950 { 0x3d403194, 0x80303 },
1951 { 0x3d4031b4, 0x100 },
1952 { 0x3d4030f4, 0xc99 },
1953 { 0x3d400028, 0x0 },
1954};
1955
1956/* PHY Initialize Configuration */
1957static struct dram_cfg_param lpddr4_ddrphy_cfg_1gb[] = {
1958 { 0x100a0, 0x0 },
1959 { 0x100a1, 0x1 },
1960 { 0x100a2, 0x2 },
1961 { 0x100a3, 0x3 },
1962 { 0x100a4, 0x4 },
1963 { 0x100a5, 0x5 },
1964 { 0x100a6, 0x6 },
1965 { 0x100a7, 0x7 },
1966 { 0x110a0, 0x0 },
1967 { 0x110a1, 0x1 },
1968 { 0x110a2, 0x3 },
1969 { 0x110a3, 0x4 },
1970 { 0x110a4, 0x5 },
1971 { 0x110a5, 0x2 },
1972 { 0x110a6, 0x7 },
1973 { 0x110a7, 0x6 },
1974 { 0x120a0, 0x0 },
1975 { 0x120a1, 0x1 },
1976 { 0x120a2, 0x3 },
1977 { 0x120a3, 0x2 },
1978 { 0x120a4, 0x5 },
1979 { 0x120a5, 0x4 },
1980 { 0x120a6, 0x7 },
1981 { 0x120a7, 0x6 },
1982 { 0x130a0, 0x0 },
1983 { 0x130a1, 0x1 },
1984 { 0x130a2, 0x2 },
1985 { 0x130a3, 0x3 },
1986 { 0x130a4, 0x4 },
1987 { 0x130a5, 0x5 },
1988 { 0x130a6, 0x6 },
1989 { 0x130a7, 0x7 },
1990 { 0x1005f, 0x1ff },
1991 { 0x1015f, 0x1ff },
1992 { 0x1105f, 0x1ff },
1993 { 0x1115f, 0x1ff },
1994 { 0x1205f, 0x1ff },
1995 { 0x1215f, 0x1ff },
1996 { 0x1305f, 0x1ff },
1997 { 0x1315f, 0x1ff },
1998 { 0x11005f, 0x1ff },
1999 { 0x11015f, 0x1ff },
2000 { 0x11105f, 0x1ff },
2001 { 0x11115f, 0x1ff },
2002 { 0x11205f, 0x1ff },
2003 { 0x11215f, 0x1ff },
2004 { 0x11305f, 0x1ff },
2005 { 0x11315f, 0x1ff },
2006 { 0x21005f, 0x1ff },
2007 { 0x21015f, 0x1ff },
2008 { 0x21105f, 0x1ff },
2009 { 0x21115f, 0x1ff },
2010 { 0x21205f, 0x1ff },
2011 { 0x21215f, 0x1ff },
2012 { 0x21305f, 0x1ff },
2013 { 0x21315f, 0x1ff },
2014 { 0x55, 0x1ff },
2015 { 0x1055, 0x1ff },
2016 { 0x2055, 0x1ff },
2017 { 0x3055, 0x1ff },
2018 { 0x4055, 0x1ff },
2019 { 0x5055, 0x1ff },
2020 { 0x6055, 0x1ff },
2021 { 0x7055, 0x1ff },
2022 { 0x8055, 0x1ff },
2023 { 0x9055, 0x1ff },
2024 { 0x200c5, 0x19 },
2025 { 0x1200c5, 0x7 },
2026 { 0x2200c5, 0x7 },
2027 { 0x2002e, 0x2 },
2028 { 0x12002e, 0x2 },
2029 { 0x22002e, 0x2 },
2030 { 0x90204, 0x0 },
2031 { 0x190204, 0x0 },
2032 { 0x290204, 0x0 },
2033 { 0x20024, 0x1ab },
2034 { 0x2003a, 0x0 },
2035 { 0x120024, 0x1ab },
2036 { 0x2003a, 0x0 },
2037 { 0x220024, 0x1ab },
2038 { 0x2003a, 0x0 },
2039 { 0x20056, 0x3 },
2040 { 0x120056, 0x3 },
2041 { 0x220056, 0x3 },
2042 { 0x1004d, 0xe00 },
2043 { 0x1014d, 0xe00 },
2044 { 0x1104d, 0xe00 },
2045 { 0x1114d, 0xe00 },
2046 { 0x1204d, 0xe00 },
2047 { 0x1214d, 0xe00 },
2048 { 0x1304d, 0xe00 },
2049 { 0x1314d, 0xe00 },
2050 { 0x11004d, 0xe00 },
2051 { 0x11014d, 0xe00 },
2052 { 0x11104d, 0xe00 },
2053 { 0x11114d, 0xe00 },
2054 { 0x11204d, 0xe00 },
2055 { 0x11214d, 0xe00 },
2056 { 0x11304d, 0xe00 },
2057 { 0x11314d, 0xe00 },
2058 { 0x21004d, 0xe00 },
2059 { 0x21014d, 0xe00 },
2060 { 0x21104d, 0xe00 },
2061 { 0x21114d, 0xe00 },
2062 { 0x21204d, 0xe00 },
2063 { 0x21214d, 0xe00 },
2064 { 0x21304d, 0xe00 },
2065 { 0x21314d, 0xe00 },
2066 { 0x10049, 0xeba },
2067 { 0x10149, 0xeba },
2068 { 0x11049, 0xeba },
2069 { 0x11149, 0xeba },
2070 { 0x12049, 0xeba },
2071 { 0x12149, 0xeba },
2072 { 0x13049, 0xeba },
2073 { 0x13149, 0xeba },
2074 { 0x110049, 0xeba },
2075 { 0x110149, 0xeba },
2076 { 0x111049, 0xeba },
2077 { 0x111149, 0xeba },
2078 { 0x112049, 0xeba },
2079 { 0x112149, 0xeba },
2080 { 0x113049, 0xeba },
2081 { 0x113149, 0xeba },
2082 { 0x210049, 0xeba },
2083 { 0x210149, 0xeba },
2084 { 0x211049, 0xeba },
2085 { 0x211149, 0xeba },
2086 { 0x212049, 0xeba },
2087 { 0x212149, 0xeba },
2088 { 0x213049, 0xeba },
2089 { 0x213149, 0xeba },
2090 { 0x43, 0x63 },
2091 { 0x1043, 0x63 },
2092 { 0x2043, 0x63 },
2093 { 0x3043, 0x63 },
2094 { 0x4043, 0x63 },
2095 { 0x5043, 0x63 },
2096 { 0x6043, 0x63 },
2097 { 0x7043, 0x63 },
2098 { 0x8043, 0x63 },
2099 { 0x9043, 0x63 },
2100 { 0x20018, 0x3 },
2101 { 0x20075, 0x4 },
2102 { 0x20050, 0x0 },
2103 { 0x20008, 0x2ee },
2104 { 0x120008, 0x64 },
2105 { 0x220008, 0x19 },
2106 { 0x20088, 0x9 },
2107 { 0x200b2, 0xdc },
2108 { 0x10043, 0x5a1 },
2109 { 0x10143, 0x5a1 },
2110 { 0x11043, 0x5a1 },
2111 { 0x11143, 0x5a1 },
2112 { 0x12043, 0x5a1 },
2113 { 0x12143, 0x5a1 },
2114 { 0x13043, 0x5a1 },
2115 { 0x13143, 0x5a1 },
2116 { 0x1200b2, 0xdc },
2117 { 0x110043, 0x5a1 },
2118 { 0x110143, 0x5a1 },
2119 { 0x111043, 0x5a1 },
2120 { 0x111143, 0x5a1 },
2121 { 0x112043, 0x5a1 },
2122 { 0x112143, 0x5a1 },
2123 { 0x113043, 0x5a1 },
2124 { 0x113143, 0x5a1 },
2125 { 0x2200b2, 0xdc },
2126 { 0x210043, 0x5a1 },
2127 { 0x210143, 0x5a1 },
2128 { 0x211043, 0x5a1 },
2129 { 0x211143, 0x5a1 },
2130 { 0x212043, 0x5a1 },
2131 { 0x212143, 0x5a1 },
2132 { 0x213043, 0x5a1 },
2133 { 0x213143, 0x5a1 },
2134 { 0x200fa, 0x1 },
2135 { 0x1200fa, 0x1 },
2136 { 0x2200fa, 0x1 },
2137 { 0x20019, 0x1 },
2138 { 0x120019, 0x1 },
2139 { 0x220019, 0x1 },
2140 { 0x200f0, 0x660 },
2141 { 0x200f1, 0x0 },
2142 { 0x200f2, 0x4444 },
2143 { 0x200f3, 0x8888 },
2144 { 0x200f4, 0x5665 },
2145 { 0x200f5, 0x0 },
2146 { 0x200f6, 0x0 },
2147 { 0x200f7, 0xf000 },
2148 { 0x20025, 0x0 },
2149 { 0x2002d, 0x0 },
2150 { 0x12002d, 0x0 },
2151 { 0x22002d, 0x0 },
2152 { 0x200c7, 0x21 },
2153 { 0x200ca, 0x24 },
2154 { 0x1200c7, 0x21 },
2155 { 0x1200ca, 0x24 },
2156 { 0x2200c7, 0x21 },
2157 { 0x2200ca, 0x24 },
2158};
2159
2160/* P0 message block paremeter for training firmware */
2161static struct dram_cfg_param lpddr4_fsp0_cfg_1gb[] = {
2162 { 0xd0000, 0x0 },
2163 { 0x54000, 0x0 },
2164 { 0x54001, 0x0 },
2165 { 0x54002, 0x0 },
2166 { 0x54003, 0xbb8 },
2167 { 0x54004, 0x2 },
2168 { 0x54005, 0x2228 },
2169 { 0x54006, 0x11 },
2170 { 0x54007, 0x0 },
2171 { 0x54008, 0x131f },
2172 { 0x54009, 0xc8 },
2173 { 0x5400a, 0x0 },
2174 { 0x5400b, 0x2 },
2175 { 0x5400c, 0x0 },
2176 { 0x5400d, 0x0 },
2177 { 0x5400e, 0x0 },
2178 { 0x5400f, 0x0 },
2179 { 0x54010, 0x0 },
2180 { 0x54011, 0x0 },
2181 { 0x54012, 0x110 },
2182 { 0x54013, 0x0 },
2183 { 0x54014, 0x0 },
2184 { 0x54015, 0x0 },
2185 { 0x54016, 0x0 },
2186 { 0x54017, 0x0 },
2187 { 0x54018, 0x0 },
2188 { 0x54019, 0x2dd4 },
2189 { 0x5401a, 0x31 },
2190 { 0x5401b, 0x4d66 },
2191 { 0x5401c, 0x4d00 },
2192 { 0x5401d, 0x0 },
2193 { 0x5401e, 0x16 },
2194 { 0x5401f, 0x2dd4 },
2195 { 0x54020, 0x31 },
2196 { 0x54021, 0x4d66 },
2197 { 0x54022, 0x4d00 },
2198 { 0x54023, 0x0 },
2199 { 0x54024, 0x16 },
2200 { 0x54025, 0x0 },
2201 { 0x54026, 0x0 },
2202 { 0x54027, 0x0 },
2203 { 0x54028, 0x0 },
2204 { 0x54029, 0x0 },
2205 { 0x5402a, 0x0 },
2206 { 0x5402b, 0x1000 },
2207 { 0x5402c, 0x1 },
2208 { 0x5402d, 0x0 },
2209 { 0x5402e, 0x0 },
2210 { 0x5402f, 0x0 },
2211 { 0x54030, 0x0 },
2212 { 0x54031, 0x0 },
2213 { 0x54032, 0xd400 },
2214 { 0x54033, 0x312d },
2215 { 0x54034, 0x6600 },
2216 { 0x54035, 0x4d },
2217 { 0x54036, 0x4d },
2218 { 0x54037, 0x1600 },
2219 { 0x54038, 0xd400 },
2220 { 0x54039, 0x312d },
2221 { 0x5403a, 0x6600 },
2222 { 0x5403b, 0x4d },
2223 { 0x5403c, 0x4d },
2224 { 0x5403d, 0x1600 },
2225 { 0x5403e, 0x0 },
2226 { 0x5403f, 0x0 },
2227 { 0x54040, 0x0 },
2228 { 0x54041, 0x0 },
2229 { 0x54042, 0x0 },
2230 { 0x54043, 0x0 },
2231 { 0x54044, 0x0 },
2232 { 0xd0000, 0x1 },
2233};
2234
2235/* P1 message block paremeter for training firmware */
2236static struct dram_cfg_param lpddr4_fsp1_cfg_1gb[] = {
2237 { 0xd0000, 0x0 },
2238 { 0x54000, 0x0 },
2239 { 0x54001, 0x0 },
2240 { 0x54002, 0x101 },
2241 { 0x54003, 0x190 },
2242 { 0x54004, 0x2 },
2243 { 0x54005, 0x2228 },
2244 { 0x54006, 0x11 },
2245 { 0x54007, 0x0 },
2246 { 0x54008, 0x121f },
2247 { 0x54009, 0xc8 },
2248 { 0x5400a, 0x0 },
2249 { 0x5400b, 0x2 },
2250 { 0x5400c, 0x0 },
2251 { 0x5400d, 0x0 },
2252 { 0x5400e, 0x0 },
2253 { 0x5400f, 0x0 },
2254 { 0x54010, 0x0 },
2255 { 0x54011, 0x0 },
2256 { 0x54012, 0x110 },
2257 { 0x54013, 0x0 },
2258 { 0x54014, 0x0 },
2259 { 0x54015, 0x0 },
2260 { 0x54016, 0x0 },
2261 { 0x54017, 0x0 },
2262 { 0x54018, 0x0 },
2263 { 0x54019, 0x84 },
2264 { 0x5401a, 0x31 },
2265 { 0x5401b, 0x4d66 },
2266 { 0x5401c, 0x4d00 },
2267 { 0x5401d, 0x0 },
2268 { 0x5401e, 0x16 },
2269 { 0x5401f, 0x84 },
2270 { 0x54020, 0x31 },
2271 { 0x54021, 0x4d66 },
2272 { 0x54022, 0x4d00 },
2273 { 0x54023, 0x0 },
2274 { 0x54024, 0x16 },
2275 { 0x54025, 0x0 },
2276 { 0x54026, 0x0 },
2277 { 0x54027, 0x0 },
2278 { 0x54028, 0x0 },
2279 { 0x54029, 0x0 },
2280 { 0x5402a, 0x0 },
2281 { 0x5402b, 0x1000 },
2282 { 0x5402c, 0x1 },
2283 { 0x5402d, 0x0 },
2284 { 0x5402e, 0x0 },
2285 { 0x5402f, 0x0 },
2286 { 0x54030, 0x0 },
2287 { 0x54031, 0x0 },
2288 { 0x54032, 0x8400 },
2289 { 0x54033, 0x3100 },
2290 { 0x54034, 0x6600 },
2291 { 0x54035, 0x4d },
2292 { 0x54036, 0x4d },
2293 { 0x54037, 0x1600 },
2294 { 0x54038, 0x8400 },
2295 { 0x54039, 0x3100 },
2296 { 0x5403a, 0x6600 },
2297 { 0x5403b, 0x4d },
2298 { 0x5403c, 0x4d },
2299 { 0x5403d, 0x1600 },
2300 { 0x5403e, 0x0 },
2301 { 0x5403f, 0x0 },
2302 { 0x54040, 0x0 },
2303 { 0x54041, 0x0 },
2304 { 0x54042, 0x0 },
2305 { 0x54043, 0x0 },
2306 { 0x54044, 0x0 },
2307 { 0xd0000, 0x1 },
2308};
2309
2310/* P2 message block paremeter for training firmware */
2311static struct dram_cfg_param lpddr4_fsp2_cfg_1gb[] = {
2312 { 0xd0000, 0x0 },
2313 { 0x54000, 0x0 },
2314 { 0x54001, 0x0 },
2315 { 0x54002, 0x102 },
2316 { 0x54003, 0x64 },
2317 { 0x54004, 0x2 },
2318 { 0x54005, 0x2228 },
2319 { 0x54006, 0x11 },
2320 { 0x54007, 0x0 },
2321 { 0x54008, 0x121f },
2322 { 0x54009, 0xc8 },
2323 { 0x5400a, 0x0 },
2324 { 0x5400b, 0x2 },
2325 { 0x5400c, 0x0 },
2326 { 0x5400d, 0x0 },
2327 { 0x5400e, 0x0 },
2328 { 0x5400f, 0x0 },
2329 { 0x54010, 0x0 },
2330 { 0x54011, 0x0 },
2331 { 0x54012, 0x110 },
2332 { 0x54013, 0x0 },
2333 { 0x54014, 0x0 },
2334 { 0x54015, 0x0 },
2335 { 0x54016, 0x0 },
2336 { 0x54017, 0x0 },
2337 { 0x54018, 0x0 },
2338 { 0x54019, 0x84 },
2339 { 0x5401a, 0x31 },
2340 { 0x5401b, 0x4d66 },
2341 { 0x5401c, 0x4d00 },
2342 { 0x5401d, 0x0 },
2343 { 0x5401e, 0x16 },
2344 { 0x5401f, 0x84 },
2345 { 0x54020, 0x31 },
2346 { 0x54021, 0x4d66 },
2347 { 0x54022, 0x4d00 },
2348 { 0x54023, 0x0 },
2349 { 0x54024, 0x16 },
2350 { 0x54025, 0x0 },
2351 { 0x54026, 0x0 },
2352 { 0x54027, 0x0 },
2353 { 0x54028, 0x0 },
2354 { 0x54029, 0x0 },
2355 { 0x5402a, 0x0 },
2356 { 0x5402b, 0x1000 },
2357 { 0x5402c, 0x1 },
2358 { 0x5402d, 0x0 },
2359 { 0x5402e, 0x0 },
2360 { 0x5402f, 0x0 },
2361 { 0x54030, 0x0 },
2362 { 0x54031, 0x0 },
2363 { 0x54032, 0x8400 },
2364 { 0x54033, 0x3100 },
2365 { 0x54034, 0x6600 },
2366 { 0x54035, 0x4d },
2367 { 0x54036, 0x4d },
2368 { 0x54037, 0x1600 },
2369 { 0x54038, 0x8400 },
2370 { 0x54039, 0x3100 },
2371 { 0x5403a, 0x6600 },
2372 { 0x5403b, 0x4d },
2373 { 0x5403c, 0x4d },
2374 { 0x5403d, 0x1600 },
2375 { 0x5403e, 0x0 },
2376 { 0x5403f, 0x0 },
2377 { 0x54040, 0x0 },
2378 { 0x54041, 0x0 },
2379 { 0x54042, 0x0 },
2380 { 0x54043, 0x0 },
2381 { 0x54044, 0x0 },
2382 { 0xd0000, 0x1 },
2383};
2384
2385/* P0 2D message block paremeter for training firmware */
2386static struct dram_cfg_param lpddr4_fsp0_2d_cfg_1gb[] = {
2387 { 0xd0000, 0x0 },
2388 { 0x54000, 0x0 },
2389 { 0x54001, 0x0 },
2390 { 0x54002, 0x0 },
2391 { 0x54003, 0xbb8 },
2392 { 0x54004, 0x2 },
2393 { 0x54005, 0x2228 },
2394 { 0x54006, 0x11 },
2395 { 0x54007, 0x0 },
2396 { 0x54008, 0x61 },
2397 { 0x54009, 0xc8 },
2398 { 0x5400a, 0x0 },
2399 { 0x5400b, 0x2 },
2400 { 0x5400c, 0x0 },
2401 { 0x5400d, 0x100 },
2402 { 0x5400e, 0x0 },
2403 { 0x5400f, 0x100 },
2404 { 0x54010, 0x1f7f },
2405 { 0x54011, 0x0 },
2406 { 0x54012, 0x110 },
2407 { 0x54013, 0x0 },
2408 { 0x54014, 0x0 },
2409 { 0x54015, 0x0 },
2410 { 0x54016, 0x0 },
2411 { 0x54017, 0x0 },
2412 { 0x54018, 0x0 },
2413 { 0x54019, 0x2dd4 },
2414 { 0x5401a, 0x31 },
2415 { 0x5401b, 0x4d66 },
2416 { 0x5401c, 0x4d00 },
2417 { 0x5401d, 0x0 },
2418 { 0x5401e, 0x16 },
2419 { 0x5401f, 0x2dd4 },
2420 { 0x54020, 0x31 },
2421 { 0x54021, 0x4d66 },
2422 { 0x54022, 0x4d00 },
2423 { 0x54023, 0x0 },
2424 { 0x54024, 0x16 },
2425 { 0x54025, 0x0 },
2426 { 0x54026, 0x0 },
2427 { 0x54027, 0x0 },
2428 { 0x54028, 0x0 },
2429 { 0x54029, 0x0 },
2430 { 0x5402a, 0x0 },
2431 { 0x5402b, 0x1000 },
2432 { 0x5402c, 0x1 },
2433 { 0x5402d, 0x0 },
2434 { 0x5402e, 0x0 },
2435 { 0x5402f, 0x0 },
2436 { 0x54030, 0x0 },
2437 { 0x54031, 0x0 },
2438 { 0x54032, 0xd400 },
2439 { 0x54033, 0x312d },
2440 { 0x54034, 0x6600 },
2441 { 0x54035, 0x4d },
2442 { 0x54036, 0x4d },
2443 { 0x54037, 0x1600 },
2444 { 0x54038, 0xd400 },
2445 { 0x54039, 0x312d },
2446 { 0x5403a, 0x6600 },
2447 { 0x5403b, 0x4d },
2448 { 0x5403c, 0x4d },
2449 { 0x5403d, 0x1600 },
2450 { 0x5403e, 0x0 },
2451 { 0x5403f, 0x0 },
2452 { 0x54040, 0x0 },
2453 { 0x54041, 0x0 },
2454 { 0x54042, 0x0 },
2455 { 0x54043, 0x0 },
2456 { 0x54044, 0x0 },
2457 { 0xd0000, 0x1 },
2458};
2459
Tim Harvey256dba02021-03-02 14:00:21 -08002460static struct dram_fsp_msg lpddr4_dram_fsp_msg_1gb[] = {
2461 {
2462 /* P0 3000mts 1D */
2463 .drate = 3000,
2464 .fw_type = FW_1D_IMAGE,
2465 .fsp_cfg = lpddr4_fsp0_cfg_1gb,
2466 .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp0_cfg_1gb),
2467 },
2468 {
2469 /* P1 400mts 1D */
2470 .drate = 400,
2471 .fw_type = FW_1D_IMAGE,
2472 .fsp_cfg = lpddr4_fsp1_cfg_1gb,
2473 .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp1_cfg_1gb),
2474 },
2475 {
2476 /* P2 100mts 1D */
2477 .drate = 100,
2478 .fw_type = FW_1D_IMAGE,
2479 .fsp_cfg = lpddr4_fsp2_cfg_1gb,
2480 .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp2_cfg_1gb),
2481 },
2482 {
2483 /* P0 3000mts 2D */
2484 .drate = 3000,
2485 .fw_type = FW_2D_IMAGE,
2486 .fsp_cfg = lpddr4_fsp0_2d_cfg_1gb,
2487 .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp0_2d_cfg_1gb),
2488 },
2489};
2490
2491/* lpddr4 timing config params */
2492struct dram_timing_info dram_timing_1gb = {
2493 .ddrc_cfg = lpddr4_ddrc_cfg_1gb,
2494 .ddrc_cfg_num = ARRAY_SIZE(lpddr4_ddrc_cfg_1gb),
2495 .ddrphy_cfg = lpddr4_ddrphy_cfg_1gb,
2496 .ddrphy_cfg_num = ARRAY_SIZE(lpddr4_ddrphy_cfg_1gb),
2497 .fsp_msg = lpddr4_dram_fsp_msg_1gb,
2498 .fsp_msg_num = ARRAY_SIZE(lpddr4_dram_fsp_msg_1gb),
2499 .ddrphy_trained_csr = lpddr4_ddrphy_trained_csr,
2500 .ddrphy_trained_csr_num = ARRAY_SIZE(lpddr4_ddrphy_trained_csr),
2501 .ddrphy_pie = lpddr4_phy_pie,
2502 .ddrphy_pie_num = ARRAY_SIZE(lpddr4_phy_pie),
2503 .fsp_table = { 3000, 400, 100, },
2504};
2505
2506static struct dram_cfg_param lpddr4_ddrc_cfg_4gb[] = {
2507 /** Initialize DDRC registers **/
2508 { 0x3d400304, 0x1 },
2509 { 0x3d400030, 0x1 },
2510 { 0x3d400000, 0xa3080020 },
2511 { 0x3d400020, 0x223 },
2512 { 0x3d400024, 0x3a980 },
2513 { 0x3d400064, 0x5b00d2 },
2514 { 0x3d4000d0, 0xc00305ba },
2515 { 0x3d4000d4, 0x940000 },
2516 { 0x3d4000dc, 0xd4002d },
2517 { 0x3d4000e0, 0x310000 },
2518 { 0x3d4000e8, 0x66004d },
2519 { 0x3d4000ec, 0x16004d },
2520 { 0x3d400100, 0x191e1920 },
2521 { 0x3d400104, 0x60630 },
2522 { 0x3d40010c, 0xb0b000 },
2523 { 0x3d400110, 0xe04080e },
2524 { 0x3d400114, 0x2040c0c },
2525 { 0x3d400118, 0x1010007 },
2526 { 0x3d40011c, 0x401 },
2527 { 0x3d400130, 0x20600 },
2528 { 0x3d400134, 0xc100002 },
2529 { 0x3d400138, 0xd8 },
2530 { 0x3d400144, 0x96004b },
2531 { 0x3d400180, 0x2ee0017 },
2532 { 0x3d400184, 0x2605b8e },
2533 { 0x3d400188, 0x0 },
2534 { 0x3d400190, 0x497820a },
2535 { 0x3d400194, 0x80303 },
2536 { 0x3d4001b4, 0x170a },
2537 { 0x3d4001a0, 0xe0400018 },
2538 { 0x3d4001a4, 0xdf00e4 },
2539 { 0x3d4001a8, 0x80000000 },
2540 { 0x3d4001b0, 0x11 },
2541 { 0x3d4001c0, 0x1 },
2542 { 0x3d4001c4, 0x1 },
2543 { 0x3d4000f4, 0xc99 },
2544 { 0x3d400108, 0x70e1617 },
2545 { 0x3d400200, 0x17 },
2546 { 0x3d40020c, 0x0 },
2547 { 0x3d400210, 0x1f1f },
2548 { 0x3d400204, 0x80808 },
2549 { 0x3d400214, 0x7070707 },
2550 { 0x3d400218, 0x7070707 },
2551 { 0x3d400250, 0x29001701 },
2552 { 0x3d400254, 0x2c },
2553 { 0x3d40025c, 0x4000030 },
2554 { 0x3d400264, 0x900093e7 },
2555 { 0x3d40026c, 0x2005574 },
2556 { 0x3d400400, 0x111 },
2557 { 0x3d400408, 0x72ff },
2558 { 0x3d400494, 0x2100e07 },
2559 { 0x3d400498, 0x620096 },
2560 { 0x3d40049c, 0x1100e07 },
2561 { 0x3d4004a0, 0xc8012c },
2562 { 0x3d402020, 0x21 },
2563 { 0x3d402024, 0x7d00 },
2564 { 0x3d402050, 0x20d040 },
2565 { 0x3d402064, 0xc001c },
2566 { 0x3d4020dc, 0x840000 },
2567 { 0x3d4020e0, 0x310000 },
2568 { 0x3d4020e8, 0x66004d },
2569 { 0x3d4020ec, 0x16004d },
2570 { 0x3d402100, 0xa040305 },
2571 { 0x3d402104, 0x30407 },
2572 { 0x3d402108, 0x203060b },
2573 { 0x3d40210c, 0x505000 },
2574 { 0x3d402110, 0x2040202 },
2575 { 0x3d402114, 0x2030202 },
2576 { 0x3d402118, 0x1010004 },
2577 { 0x3d40211c, 0x301 },
2578 { 0x3d402130, 0x20300 },
2579 { 0x3d402134, 0xa100002 },
2580 { 0x3d402138, 0x1d },
2581 { 0x3d402144, 0x14000a },
2582 { 0x3d402180, 0x640004 },
2583 { 0x3d402190, 0x3818200 },
2584 { 0x3d402194, 0x80303 },
2585 { 0x3d4021b4, 0x100 },
2586 { 0x3d4020f4, 0xc99 },
2587 { 0x3d403020, 0x21 },
2588 { 0x3d403024, 0x1f40 },
2589 { 0x3d403050, 0x20d040 },
2590 { 0x3d403064, 0x30007 },
2591 { 0x3d4030dc, 0x840000 },
2592 { 0x3d4030e0, 0x310000 },
2593 { 0x3d4030e8, 0x66004d },
2594 { 0x3d4030ec, 0x16004d },
2595 { 0x3d403100, 0xa010102 },
2596 { 0x3d403104, 0x30404 },
2597 { 0x3d403108, 0x203060b },
2598 { 0x3d40310c, 0x505000 },
2599 { 0x3d403110, 0x2040202 },
2600 { 0x3d403114, 0x2030202 },
2601 { 0x3d403118, 0x1010004 },
2602 { 0x3d40311c, 0x301 },
2603 { 0x3d403130, 0x20300 },
2604 { 0x3d403134, 0xa100002 },
2605 { 0x3d403138, 0x8 },
2606 { 0x3d403144, 0x50003 },
2607 { 0x3d403180, 0x190004 },
2608 { 0x3d403190, 0x3818200 },
2609 { 0x3d403194, 0x80303 },
2610 { 0x3d4031b4, 0x100 },
2611 { 0x3d4030f4, 0xc99 },
2612 { 0x3d400028, 0x0 },
2613};
2614
2615/* PHY Initialize Configuration */
2616static struct dram_cfg_param lpddr4_ddrphy_cfg_4gb[] = {
2617 { 0x100a0, 0x0 },
2618 { 0x100a1, 0x1 },
2619 { 0x100a2, 0x2 },
2620 { 0x100a3, 0x3 },
2621 { 0x100a4, 0x4 },
2622 { 0x100a5, 0x5 },
2623 { 0x100a6, 0x6 },
2624 { 0x100a7, 0x7 },
2625 { 0x110a0, 0x0 },
2626 { 0x110a1, 0x1 },
2627 { 0x110a2, 0x3 },
2628 { 0x110a3, 0x4 },
2629 { 0x110a4, 0x5 },
2630 { 0x110a5, 0x2 },
2631 { 0x110a6, 0x7 },
2632 { 0x110a7, 0x6 },
2633 { 0x120a0, 0x0 },
2634 { 0x120a1, 0x1 },
2635 { 0x120a2, 0x3 },
2636 { 0x120a3, 0x2 },
2637 { 0x120a4, 0x5 },
2638 { 0x120a5, 0x4 },
2639 { 0x120a6, 0x7 },
2640 { 0x120a7, 0x6 },
2641 { 0x130a0, 0x0 },
2642 { 0x130a1, 0x1 },
2643 { 0x130a2, 0x2 },
2644 { 0x130a3, 0x3 },
2645 { 0x130a4, 0x4 },
2646 { 0x130a5, 0x5 },
2647 { 0x130a6, 0x6 },
2648 { 0x130a7, 0x7 },
2649 { 0x1005f, 0x1ff },
2650 { 0x1015f, 0x1ff },
2651 { 0x1105f, 0x1ff },
2652 { 0x1115f, 0x1ff },
2653 { 0x1205f, 0x1ff },
2654 { 0x1215f, 0x1ff },
2655 { 0x1305f, 0x1ff },
2656 { 0x1315f, 0x1ff },
2657 { 0x11005f, 0x1ff },
2658 { 0x11015f, 0x1ff },
2659 { 0x11105f, 0x1ff },
2660 { 0x11115f, 0x1ff },
2661 { 0x11205f, 0x1ff },
2662 { 0x11215f, 0x1ff },
2663 { 0x11305f, 0x1ff },
2664 { 0x11315f, 0x1ff },
2665 { 0x21005f, 0x1ff },
2666 { 0x21015f, 0x1ff },
2667 { 0x21105f, 0x1ff },
2668 { 0x21115f, 0x1ff },
2669 { 0x21205f, 0x1ff },
2670 { 0x21215f, 0x1ff },
2671 { 0x21305f, 0x1ff },
2672 { 0x21315f, 0x1ff },
2673 { 0x55, 0x1ff },
2674 { 0x1055, 0x1ff },
2675 { 0x2055, 0x1ff },
2676 { 0x3055, 0x1ff },
2677 { 0x4055, 0x1ff },
2678 { 0x5055, 0x1ff },
2679 { 0x6055, 0x1ff },
2680 { 0x7055, 0x1ff },
2681 { 0x8055, 0x1ff },
2682 { 0x9055, 0x1ff },
2683 { 0x200c5, 0x19 },
2684 { 0x1200c5, 0x7 },
2685 { 0x2200c5, 0x7 },
2686 { 0x2002e, 0x2 },
2687 { 0x12002e, 0x2 },
2688 { 0x22002e, 0x2 },
2689 { 0x90204, 0x0 },
2690 { 0x190204, 0x0 },
2691 { 0x290204, 0x0 },
2692 { 0x20024, 0x1ab },
2693 { 0x2003a, 0x0 },
2694 { 0x120024, 0x1ab },
2695 { 0x2003a, 0x0 },
2696 { 0x220024, 0x1ab },
2697 { 0x2003a, 0x0 },
2698 { 0x20056, 0x3 },
2699 { 0x120056, 0x3 },
2700 { 0x220056, 0x3 },
2701 { 0x1004d, 0xe00 },
2702 { 0x1014d, 0xe00 },
2703 { 0x1104d, 0xe00 },
2704 { 0x1114d, 0xe00 },
2705 { 0x1204d, 0xe00 },
2706 { 0x1214d, 0xe00 },
2707 { 0x1304d, 0xe00 },
2708 { 0x1314d, 0xe00 },
2709 { 0x11004d, 0xe00 },
2710 { 0x11014d, 0xe00 },
2711 { 0x11104d, 0xe00 },
2712 { 0x11114d, 0xe00 },
2713 { 0x11204d, 0xe00 },
2714 { 0x11214d, 0xe00 },
2715 { 0x11304d, 0xe00 },
2716 { 0x11314d, 0xe00 },
2717 { 0x21004d, 0xe00 },
2718 { 0x21014d, 0xe00 },
2719 { 0x21104d, 0xe00 },
2720 { 0x21114d, 0xe00 },
2721 { 0x21204d, 0xe00 },
2722 { 0x21214d, 0xe00 },
2723 { 0x21304d, 0xe00 },
2724 { 0x21314d, 0xe00 },
2725 { 0x10049, 0xeba },
2726 { 0x10149, 0xeba },
2727 { 0x11049, 0xeba },
2728 { 0x11149, 0xeba },
2729 { 0x12049, 0xeba },
2730 { 0x12149, 0xeba },
2731 { 0x13049, 0xeba },
2732 { 0x13149, 0xeba },
2733 { 0x110049, 0xeba },
2734 { 0x110149, 0xeba },
2735 { 0x111049, 0xeba },
2736 { 0x111149, 0xeba },
2737 { 0x112049, 0xeba },
2738 { 0x112149, 0xeba },
2739 { 0x113049, 0xeba },
2740 { 0x113149, 0xeba },
2741 { 0x210049, 0xeba },
2742 { 0x210149, 0xeba },
2743 { 0x211049, 0xeba },
2744 { 0x211149, 0xeba },
2745 { 0x212049, 0xeba },
2746 { 0x212149, 0xeba },
2747 { 0x213049, 0xeba },
2748 { 0x213149, 0xeba },
2749 { 0x43, 0x63 },
2750 { 0x1043, 0x63 },
2751 { 0x2043, 0x63 },
2752 { 0x3043, 0x63 },
2753 { 0x4043, 0x63 },
2754 { 0x5043, 0x63 },
2755 { 0x6043, 0x63 },
2756 { 0x7043, 0x63 },
2757 { 0x8043, 0x63 },
2758 { 0x9043, 0x63 },
2759 { 0x20018, 0x3 },
2760 { 0x20075, 0x4 },
2761 { 0x20050, 0x0 },
2762 { 0x20008, 0x2ee },
2763 { 0x120008, 0x64 },
2764 { 0x220008, 0x19 },
2765 { 0x20088, 0x9 },
2766 { 0x200b2, 0xdc },
2767 { 0x10043, 0x5a1 },
2768 { 0x10143, 0x5a1 },
2769 { 0x11043, 0x5a1 },
2770 { 0x11143, 0x5a1 },
2771 { 0x12043, 0x5a1 },
2772 { 0x12143, 0x5a1 },
2773 { 0x13043, 0x5a1 },
2774 { 0x13143, 0x5a1 },
2775 { 0x1200b2, 0xdc },
2776 { 0x110043, 0x5a1 },
2777 { 0x110143, 0x5a1 },
2778 { 0x111043, 0x5a1 },
2779 { 0x111143, 0x5a1 },
2780 { 0x112043, 0x5a1 },
2781 { 0x112143, 0x5a1 },
2782 { 0x113043, 0x5a1 },
2783 { 0x113143, 0x5a1 },
2784 { 0x2200b2, 0xdc },
2785 { 0x210043, 0x5a1 },
2786 { 0x210143, 0x5a1 },
2787 { 0x211043, 0x5a1 },
2788 { 0x211143, 0x5a1 },
2789 { 0x212043, 0x5a1 },
2790 { 0x212143, 0x5a1 },
2791 { 0x213043, 0x5a1 },
2792 { 0x213143, 0x5a1 },
2793 { 0x200fa, 0x1 },
2794 { 0x1200fa, 0x1 },
2795 { 0x2200fa, 0x1 },
2796 { 0x20019, 0x1 },
2797 { 0x120019, 0x1 },
2798 { 0x220019, 0x1 },
2799 { 0x200f0, 0x660 },
2800 { 0x200f1, 0x0 },
2801 { 0x200f2, 0x4444 },
2802 { 0x200f3, 0x8888 },
2803 { 0x200f4, 0x5665 },
2804 { 0x200f5, 0x0 },
2805 { 0x200f6, 0x0 },
2806 { 0x200f7, 0xf000 },
2807 { 0x20025, 0x0 },
2808 { 0x2002d, 0x0 },
2809 { 0x12002d, 0x0 },
2810 { 0x22002d, 0x0 },
2811 { 0x200c7, 0x21 },
2812 { 0x1200c7, 0x21 },
2813 { 0x2200c7, 0x21 },
2814 { 0x200ca, 0x24 },
2815 { 0x1200ca, 0x24 },
2816 { 0x2200ca, 0x24 },
2817};
2818
2819/* P0 message block paremeter for training firmware */
2820static struct dram_cfg_param lpddr4_fsp0_cfg_4gb[] = {
2821 { 0xd0000, 0x0 },
2822 { 0x54003, 0xbb8 },
2823 { 0x54004, 0x2 },
2824 { 0x54005, 0x2228 },
2825 { 0x54006, 0x11 },
2826 { 0x54008, 0x131f },
2827 { 0x54009, 0xc8 },
2828 { 0x5400b, 0x2 },
2829 { 0x54012, 0x310 },
2830 { 0x54019, 0x2dd4 },
2831 { 0x5401a, 0x31 },
2832 { 0x5401b, 0x4d66 },
2833 { 0x5401c, 0x4d00 },
2834 { 0x5401e, 0x16 },
2835 { 0x5401f, 0x2dd4 },
2836 { 0x54020, 0x31 },
2837 { 0x54021, 0x4d66 },
2838 { 0x54022, 0x4d00 },
2839 { 0x54024, 0x16 },
2840 { 0x5402b, 0x1000 },
2841 { 0x5402c, 0x3 },
2842 { 0x54032, 0xd400 },
2843 { 0x54033, 0x312d },
2844 { 0x54034, 0x6600 },
2845 { 0x54035, 0x4d },
2846 { 0x54036, 0x4d },
2847 { 0x54037, 0x1600 },
2848 { 0x54038, 0xd400 },
2849 { 0x54039, 0x312d },
2850 { 0x5403a, 0x6600 },
2851 { 0x5403b, 0x4d },
2852 { 0x5403c, 0x4d },
2853 { 0x5403d, 0x1600 },
2854 { 0xd0000, 0x1 },
2855};
2856
2857/* P1 message block paremeter for training firmware */
2858static struct dram_cfg_param lpddr4_fsp1_cfg_4gb[] = {
2859 { 0xd0000, 0x0 },
2860 { 0x54002, 0x101 },
2861 { 0x54003, 0x190 },
2862 { 0x54004, 0x2 },
2863 { 0x54005, 0x2228 },
2864 { 0x54006, 0x11 },
2865 { 0x54008, 0x121f },
2866 { 0x54009, 0xc8 },
2867 { 0x5400b, 0x2 },
2868 { 0x54012, 0x310 },
2869 { 0x54019, 0x84 },
2870 { 0x5401a, 0x31 },
2871 { 0x5401b, 0x4d66 },
2872 { 0x5401c, 0x4d00 },
2873 { 0x5401e, 0x16 },
2874 { 0x5401f, 0x84 },
2875 { 0x54020, 0x31 },
2876 { 0x54021, 0x4d66 },
2877 { 0x54022, 0x4d00 },
2878 { 0x54024, 0x16 },
2879 { 0x5402b, 0x1000 },
2880 { 0x5402c, 0x3 },
2881 { 0x54032, 0x8400 },
2882 { 0x54033, 0x3100 },
2883 { 0x54034, 0x6600 },
2884 { 0x54035, 0x4d },
2885 { 0x54036, 0x4d },
2886 { 0x54037, 0x1600 },
2887 { 0x54038, 0x8400 },
2888 { 0x54039, 0x3100 },
2889 { 0x5403a, 0x6600 },
2890 { 0x5403b, 0x4d },
2891 { 0x5403c, 0x4d },
2892 { 0x5403d, 0x1600 },
2893 { 0xd0000, 0x1 },
2894};
2895
2896/* P2 message block paremeter for training firmware */
2897static struct dram_cfg_param lpddr4_fsp2_cfg_4gb[] = {
2898 { 0xd0000, 0x0 },
2899 { 0x54002, 0x102 },
2900 { 0x54003, 0x64 },
2901 { 0x54004, 0x2 },
2902 { 0x54005, 0x2228 },
2903 { 0x54006, 0x11 },
2904 { 0x54008, 0x121f },
2905 { 0x54009, 0xc8 },
2906 { 0x5400b, 0x2 },
2907 { 0x54012, 0x310 },
2908 { 0x54019, 0x84 },
2909 { 0x5401a, 0x31 },
2910 { 0x5401b, 0x4d66 },
2911 { 0x5401c, 0x4d00 },
2912 { 0x5401e, 0x16 },
2913 { 0x5401f, 0x84 },
2914 { 0x54020, 0x31 },
2915 { 0x54021, 0x4d66 },
2916 { 0x54022, 0x4d00 },
2917 { 0x54024, 0x16 },
2918 { 0x5402b, 0x1000 },
2919 { 0x5402c, 0x3 },
2920 { 0x54032, 0x8400 },
2921 { 0x54033, 0x3100 },
2922 { 0x54034, 0x6600 },
2923 { 0x54035, 0x4d },
2924 { 0x54036, 0x4d },
2925 { 0x54037, 0x1600 },
2926 { 0x54038, 0x8400 },
2927 { 0x54039, 0x3100 },
2928 { 0x5403a, 0x6600 },
2929 { 0x5403b, 0x4d },
2930 { 0x5403c, 0x4d },
2931 { 0x5403d, 0x1600 },
2932 { 0xd0000, 0x1 },
2933};
2934
2935/* P0 2D message block paremeter for training firmware */
2936static struct dram_cfg_param lpddr4_fsp0_2d_cfg_4gb[] = {
2937 { 0xd0000, 0x0 },
2938 { 0x54003, 0xbb8 },
2939 { 0x54004, 0x2 },
2940 { 0x54005, 0x2228 },
2941 { 0x54006, 0x11 },
2942 { 0x54008, 0x61 },
2943 { 0x54009, 0xc8 },
2944 { 0x5400b, 0x2 },
2945 { 0x5400d, 0x100 },
2946 { 0x5400f, 0x100 },
2947 { 0x54010, 0x1f7f },
2948 { 0x54012, 0x310 },
2949 { 0x54019, 0x2dd4 },
2950 { 0x5401a, 0x31 },
2951 { 0x5401b, 0x4d66 },
2952 { 0x5401c, 0x4d00 },
2953 { 0x5401e, 0x16 },
2954 { 0x5401f, 0x2dd4 },
2955 { 0x54020, 0x31 },
2956 { 0x54021, 0x4d66 },
2957 { 0x54022, 0x4d00 },
2958 { 0x54024, 0x16 },
2959 { 0x5402b, 0x1000 },
2960 { 0x5402c, 0x3 },
2961 { 0x54032, 0xd400 },
2962 { 0x54033, 0x312d },
2963 { 0x54034, 0x6600 },
2964 { 0x54035, 0x4d },
2965 { 0x54036, 0x4d },
2966 { 0x54037, 0x1600 },
2967 { 0x54038, 0xd400 },
2968 { 0x54039, 0x312d },
2969 { 0x5403a, 0x6600 },
2970 { 0x5403b, 0x4d },
2971 { 0x5403c, 0x4d },
2972 { 0x5403d, 0x1600 },
2973 { 0xd0000, 0x1 },
2974};
2975
2976static struct dram_fsp_msg lpddr4_dram_fsp_msg_4gb[] = {
2977 {
2978 /* P0 3000mts 1D */
2979 .drate = 3000,
2980 .fw_type = FW_1D_IMAGE,
2981 .fsp_cfg = lpddr4_fsp0_cfg_4gb,
2982 .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp0_cfg_4gb),
2983 },
2984 {
2985 /* P1 400mts 1D */
2986 .drate = 400,
2987 .fw_type = FW_1D_IMAGE,
2988 .fsp_cfg = lpddr4_fsp1_cfg_4gb,
2989 .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp1_cfg_4gb),
2990 },
2991 {
2992 /* P2 100mts 1D */
2993 .drate = 100,
2994 .fw_type = FW_1D_IMAGE,
2995 .fsp_cfg = lpddr4_fsp2_cfg_4gb,
2996 .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp2_cfg_4gb),
2997 },
2998 {
2999 /* P0 3000mts 2D */
3000 .drate = 3000,
3001 .fw_type = FW_2D_IMAGE,
3002 .fsp_cfg = lpddr4_fsp0_2d_cfg_4gb,
3003 .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp0_2d_cfg_4gb),
3004 },
3005};
3006
3007/* lpddr4 timing config params */
3008struct dram_timing_info dram_timing_4gb = {
3009 .ddrc_cfg = lpddr4_ddrc_cfg_4gb,
3010 .ddrc_cfg_num = ARRAY_SIZE(lpddr4_ddrc_cfg_4gb),
3011 .ddrphy_cfg = lpddr4_ddrphy_cfg_4gb,
3012 .ddrphy_cfg_num = ARRAY_SIZE(lpddr4_ddrphy_cfg_4gb),
3013 .fsp_msg = lpddr4_dram_fsp_msg_4gb,
3014 .fsp_msg_num = ARRAY_SIZE(lpddr4_dram_fsp_msg_4gb),
3015 .ddrphy_trained_csr = lpddr4_ddrphy_trained_csr,
3016 .ddrphy_trained_csr_num = ARRAY_SIZE(lpddr4_ddrphy_trained_csr),
3017 .ddrphy_pie = lpddr4_phy_pie,
3018 .ddrphy_pie_num = ARRAY_SIZE(lpddr4_phy_pie),
3019 .fsp_table = { 3000, 400, 100, },
3020};
Tim Harvey6603b5e2021-07-27 15:19:41 -07003021
3022static struct dram_cfg_param lpddr4_ddrc_cfg_2gb[] = {
3023 /** Initialize DDRC registers **/
3024 { 0x3d400304, 0x1 },
3025 { 0x3d400030, 0x1 },
3026 { 0x3d400000, 0xa1080020 },
3027 { 0x3d400020, 0x223 },
3028 { 0x3d400024, 0x3a980 },
3029 { 0x3d400064, 0x5b00d2 },
3030 { 0x3d4000d0, 0xc00305ba },
3031 { 0x3d4000d4, 0x940000 },
3032 { 0x3d4000dc, 0xd4002d },
3033 { 0x3d4000e0, 0x310000 },
3034 { 0x3d4000e8, 0x66004d },
3035 { 0x3d4000ec, 0x16004d },
3036 { 0x3d400100, 0x191e1920 },
3037 { 0x3d400104, 0x60630 },
3038 { 0x3d40010c, 0xb0b000 },
3039 { 0x3d400110, 0xe04080e },
3040 { 0x3d400114, 0x2040c0c },
3041 { 0x3d400118, 0x1010007 },
3042 { 0x3d40011c, 0x401 },
3043 { 0x3d400130, 0x20600 },
3044 { 0x3d400134, 0xc100002 },
3045 { 0x3d400138, 0xd8 },
3046 { 0x3d400144, 0x96004b },
3047 { 0x3d400180, 0x2ee0017 },
3048 { 0x3d400184, 0x2605b8e },
3049 { 0x3d400188, 0x0 },
3050 { 0x3d400190, 0x497820a },
3051 { 0x3d400194, 0x80303 },
3052 { 0x3d4001b4, 0x170a },
3053 { 0x3d4001a0, 0xe0400018 },
3054 { 0x3d4001a4, 0xdf00e4 },
3055 { 0x3d4001a8, 0x80000000 },
3056 { 0x3d4001b0, 0x11 },
3057 { 0x3d4001c0, 0x1 },
3058 { 0x3d4001c4, 0x1 },
3059 { 0x3d4000f4, 0xc99 },
3060 { 0x3d400108, 0x70e1617 },
3061 { 0x3d400200, 0x1f },
3062 { 0x3d40020c, 0x0 },
3063 { 0x3d400210, 0x1f1f },
3064 { 0x3d400204, 0x80808 },
3065 { 0x3d400214, 0x7070707 },
3066 { 0x3d400218, 0x7070707 },
3067 { 0x3d400250, 0x29001701 },
3068 { 0x3d400254, 0x2c },
3069 { 0x3d40025c, 0x4000030 },
3070 { 0x3d400264, 0x900093e7 },
3071 { 0x3d40026c, 0x2005574 },
3072 { 0x3d400400, 0x111 },
3073 { 0x3d400408, 0x72ff },
3074 { 0x3d400494, 0x2100e07 },
3075 { 0x3d400498, 0x620096 },
3076 { 0x3d40049c, 0x1100e07 },
3077 { 0x3d4004a0, 0xc8012c },
3078 { 0x3d402020, 0x21 },
3079 { 0x3d402024, 0x7d00 },
3080 { 0x3d402050, 0x20d040 },
3081 { 0x3d402064, 0xc001c },
3082 { 0x3d4020dc, 0x840000 },
3083 { 0x3d4020e0, 0x310000 },
3084 { 0x3d4020e8, 0x66004d },
3085 { 0x3d4020ec, 0x16004d },
3086 { 0x3d402100, 0xa040305 },
3087 { 0x3d402104, 0x30407 },
3088 { 0x3d402108, 0x203060b },
3089 { 0x3d40210c, 0x505000 },
3090 { 0x3d402110, 0x2040202 },
3091 { 0x3d402114, 0x2030202 },
3092 { 0x3d402118, 0x1010004 },
3093 { 0x3d40211c, 0x301 },
3094 { 0x3d402130, 0x20300 },
3095 { 0x3d402134, 0xa100002 },
3096 { 0x3d402138, 0x1d },
3097 { 0x3d402144, 0x14000a },
3098 { 0x3d402180, 0x640004 },
3099 { 0x3d402190, 0x3818200 },
3100 { 0x3d402194, 0x80303 },
3101 { 0x3d4021b4, 0x100 },
3102 { 0x3d4020f4, 0xc99 },
3103 { 0x3d403020, 0x21 },
3104 { 0x3d403024, 0x1f40 },
3105 { 0x3d403050, 0x20d040 },
3106 { 0x3d403064, 0x30007 },
3107 { 0x3d4030dc, 0x840000 },
3108 { 0x3d4030e0, 0x310000 },
3109 { 0x3d4030e8, 0x66004d },
3110 { 0x3d4030ec, 0x16004d },
3111 { 0x3d403100, 0xa010102 },
3112 { 0x3d403104, 0x30404 },
3113 { 0x3d403108, 0x203060b },
3114 { 0x3d40310c, 0x505000 },
3115 { 0x3d403110, 0x2040202 },
3116 { 0x3d403114, 0x2030202 },
3117 { 0x3d403118, 0x1010004 },
3118 { 0x3d40311c, 0x301 },
3119 { 0x3d403130, 0x20300 },
3120 { 0x3d403134, 0xa100002 },
3121 { 0x3d403138, 0x8 },
3122 { 0x3d403144, 0x50003 },
3123 { 0x3d403180, 0x190004 },
3124 { 0x3d403190, 0x3818200 },
3125 { 0x3d403194, 0x80303 },
3126 { 0x3d4031b4, 0x100 },
3127 { 0x3d4030f4, 0xc99 },
3128 { 0x3d400028, 0x0 },
3129};
3130
3131/* PHY Initialize Configuration */
3132static struct dram_cfg_param lpddr4_ddrphy_cfg_2gb[] = {
3133 { 0x100a0, 0x0 },
3134 { 0x100a1, 0x1 },
3135 { 0x100a2, 0x2 },
3136 { 0x100a3, 0x3 },
3137 { 0x100a4, 0x4 },
3138 { 0x100a5, 0x5 },
3139 { 0x100a6, 0x6 },
3140 { 0x100a7, 0x7 },
3141 { 0x110a0, 0x0 },
3142 { 0x110a1, 0x1 },
3143 { 0x110a2, 0x2 },
3144 { 0x110a3, 0x3 },
3145 { 0x110a4, 0x4 },
3146 { 0x110a5, 0x5 },
3147 { 0x110a6, 0x6 },
3148 { 0x110a7, 0x7 },
3149 { 0x120a0, 0x0 },
3150 { 0x120a1, 0x1 },
3151 { 0x120a2, 0x3 },
3152 { 0x120a3, 0x2 },
3153 { 0x120a4, 0x5 },
3154 { 0x120a5, 0x4 },
3155 { 0x120a6, 0x7 },
3156 { 0x120a7, 0x6 },
3157 { 0x130a0, 0x0 },
3158 { 0x130a1, 0x1 },
3159 { 0x130a2, 0x5 },
3160 { 0x130a3, 0x2 },
3161 { 0x130a4, 0x3 },
3162 { 0x130a5, 0x4 },
3163 { 0x130a6, 0x7 },
3164 { 0x130a7, 0x6 },
3165 { 0x1005f, 0x1ff },
3166 { 0x1015f, 0x1ff },
3167 { 0x1105f, 0x1ff },
3168 { 0x1115f, 0x1ff },
3169 { 0x1205f, 0x1ff },
3170 { 0x1215f, 0x1ff },
3171 { 0x1305f, 0x1ff },
3172 { 0x1315f, 0x1ff },
3173 { 0x11005f, 0x1ff },
3174 { 0x11015f, 0x1ff },
3175 { 0x11105f, 0x1ff },
3176 { 0x11115f, 0x1ff },
3177 { 0x11205f, 0x1ff },
3178 { 0x11215f, 0x1ff },
3179 { 0x11305f, 0x1ff },
3180 { 0x11315f, 0x1ff },
3181 { 0x21005f, 0x1ff },
3182 { 0x21015f, 0x1ff },
3183 { 0x21105f, 0x1ff },
3184 { 0x21115f, 0x1ff },
3185 { 0x21205f, 0x1ff },
3186 { 0x21215f, 0x1ff },
3187 { 0x21305f, 0x1ff },
3188 { 0x21315f, 0x1ff },
3189 { 0x55, 0x1ff },
3190 { 0x1055, 0x1ff },
3191 { 0x2055, 0x1ff },
3192 { 0x3055, 0x1ff },
3193 { 0x4055, 0x1ff },
3194 { 0x5055, 0x1ff },
3195 { 0x6055, 0x1ff },
3196 { 0x7055, 0x1ff },
3197 { 0x8055, 0x1ff },
3198 { 0x9055, 0x1ff },
3199 { 0x200c5, 0x19 },
3200 { 0x1200c5, 0x7 },
3201 { 0x2200c5, 0x7 },
3202 { 0x2002e, 0x2 },
3203 { 0x12002e, 0x2 },
3204 { 0x22002e, 0x2 },
3205 { 0x90204, 0x0 },
3206 { 0x190204, 0x0 },
3207 { 0x290204, 0x0 },
3208 { 0x20024, 0x1ab },
3209 { 0x2003a, 0x0 },
3210 { 0x120024, 0x1ab },
3211 { 0x2003a, 0x0 },
3212 { 0x220024, 0x1ab },
3213 { 0x2003a, 0x0 },
3214 { 0x20056, 0x3 },
3215 { 0x120056, 0x3 },
3216 { 0x220056, 0x3 },
3217 { 0x1004d, 0xe00 },
3218 { 0x1014d, 0xe00 },
3219 { 0x1104d, 0xe00 },
3220 { 0x1114d, 0xe00 },
3221 { 0x1204d, 0xe00 },
3222 { 0x1214d, 0xe00 },
3223 { 0x1304d, 0xe00 },
3224 { 0x1314d, 0xe00 },
3225 { 0x11004d, 0xe00 },
3226 { 0x11014d, 0xe00 },
3227 { 0x11104d, 0xe00 },
3228 { 0x11114d, 0xe00 },
3229 { 0x11204d, 0xe00 },
3230 { 0x11214d, 0xe00 },
3231 { 0x11304d, 0xe00 },
3232 { 0x11314d, 0xe00 },
3233 { 0x21004d, 0xe00 },
3234 { 0x21014d, 0xe00 },
3235 { 0x21104d, 0xe00 },
3236 { 0x21114d, 0xe00 },
3237 { 0x21204d, 0xe00 },
3238 { 0x21214d, 0xe00 },
3239 { 0x21304d, 0xe00 },
3240 { 0x21314d, 0xe00 },
3241 { 0x10049, 0xeba },
3242 { 0x10149, 0xeba },
3243 { 0x11049, 0xeba },
3244 { 0x11149, 0xeba },
3245 { 0x12049, 0xeba },
3246 { 0x12149, 0xeba },
3247 { 0x13049, 0xeba },
3248 { 0x13149, 0xeba },
3249 { 0x110049, 0xeba },
3250 { 0x110149, 0xeba },
3251 { 0x111049, 0xeba },
3252 { 0x111149, 0xeba },
3253 { 0x112049, 0xeba },
3254 { 0x112149, 0xeba },
3255 { 0x113049, 0xeba },
3256 { 0x113149, 0xeba },
3257 { 0x210049, 0xeba },
3258 { 0x210149, 0xeba },
3259 { 0x211049, 0xeba },
3260 { 0x211149, 0xeba },
3261 { 0x212049, 0xeba },
3262 { 0x212149, 0xeba },
3263 { 0x213049, 0xeba },
3264 { 0x213149, 0xeba },
3265 { 0x43, 0x63 },
3266 { 0x1043, 0x63 },
3267 { 0x2043, 0x63 },
3268 { 0x3043, 0x63 },
3269 { 0x4043, 0x63 },
3270 { 0x5043, 0x63 },
3271 { 0x6043, 0x63 },
3272 { 0x7043, 0x63 },
3273 { 0x8043, 0x63 },
3274 { 0x9043, 0x63 },
3275 { 0x20018, 0x3 },
3276 { 0x20075, 0x4 },
3277 { 0x20050, 0x0 },
3278 { 0x20008, 0x2ee },
3279 { 0x120008, 0x64 },
3280 { 0x220008, 0x19 },
3281 { 0x20088, 0x9 },
3282 { 0x200b2, 0xdc },
3283 { 0x10043, 0x5a1 },
3284 { 0x10143, 0x5a1 },
3285 { 0x11043, 0x5a1 },
3286 { 0x11143, 0x5a1 },
3287 { 0x12043, 0x5a1 },
3288 { 0x12143, 0x5a1 },
3289 { 0x13043, 0x5a1 },
3290 { 0x13143, 0x5a1 },
3291 { 0x1200b2, 0xdc },
3292 { 0x110043, 0x5a1 },
3293 { 0x110143, 0x5a1 },
3294 { 0x111043, 0x5a1 },
3295 { 0x111143, 0x5a1 },
3296 { 0x112043, 0x5a1 },
3297 { 0x112143, 0x5a1 },
3298 { 0x113043, 0x5a1 },
3299 { 0x113143, 0x5a1 },
3300 { 0x2200b2, 0xdc },
3301 { 0x210043, 0x5a1 },
3302 { 0x210143, 0x5a1 },
3303 { 0x211043, 0x5a1 },
3304 { 0x211143, 0x5a1 },
3305 { 0x212043, 0x5a1 },
3306 { 0x212143, 0x5a1 },
3307 { 0x213043, 0x5a1 },
3308 { 0x213143, 0x5a1 },
3309 { 0x200fa, 0x1 },
3310 { 0x1200fa, 0x1 },
3311 { 0x2200fa, 0x1 },
3312 { 0x20019, 0x1 },
3313 { 0x120019, 0x1 },
3314 { 0x220019, 0x1 },
3315 { 0x200f0, 0x660 },
3316 { 0x200f1, 0x0 },
3317 { 0x200f2, 0x4444 },
3318 { 0x200f3, 0x8888 },
3319 { 0x200f4, 0x5665 },
3320 { 0x200f5, 0x0 },
3321 { 0x200f6, 0x0 },
3322 { 0x200f7, 0xf000 },
3323 { 0x20025, 0x0 },
3324 { 0x2002d, 0x0 },
3325 { 0x12002d, 0x0 },
3326 { 0x22002d, 0x0 },
3327 { 0x200c7, 0x21 },
3328 { 0x1200c7, 0x21 },
3329 { 0x2200c7, 0x21 },
3330 { 0x200ca, 0x24 },
3331 { 0x1200ca, 0x24 },
3332 { 0x2200ca, 0x24 },
3333};
3334
3335/* P0 message block paremeter for training firmware */
3336static struct dram_cfg_param lpddr4_fsp0_cfg_2gb[] = {
3337 { 0xd0000, 0x0 },
3338 { 0x54003, 0xbb8 },
3339 { 0x54004, 0x2 },
3340 { 0x54005, 0x2228 },
3341 { 0x54006, 0x11 },
3342 { 0x54008, 0x131f },
3343 { 0x54009, 0xc8 },
3344 { 0x5400b, 0x2 },
3345 { 0x54012, 0x110 },
3346 { 0x54019, 0x2dd4 },
3347 { 0x5401a, 0x31 },
3348 { 0x5401b, 0x4d66 },
3349 { 0x5401c, 0x4d00 },
3350 { 0x5401e, 0x16 },
3351 { 0x5401f, 0x2dd4 },
3352 { 0x54020, 0x31 },
3353 { 0x54021, 0x4d66 },
3354 { 0x54022, 0x4d00 },
3355 { 0x54024, 0x16 },
3356 { 0x5402b, 0x1000 },
3357 { 0x5402c, 0x1 },
3358 { 0x54032, 0xd400 },
3359 { 0x54033, 0x312d },
3360 { 0x54034, 0x6600 },
3361 { 0x54035, 0x4d },
3362 { 0x54036, 0x4d },
3363 { 0x54037, 0x1600 },
3364 { 0x54038, 0xd400 },
3365 { 0x54039, 0x312d },
3366 { 0x5403a, 0x6600 },
3367 { 0x5403b, 0x4d },
3368 { 0x5403c, 0x4d },
3369 { 0x5403d, 0x1600 },
3370 { 0xd0000, 0x1 },
3371};
3372
3373/* P1 message block paremeter for training firmware */
3374static struct dram_cfg_param lpddr4_fsp1_cfg_2gb[] = {
3375 { 0xd0000, 0x0 },
3376 { 0x54002, 0x101 },
3377 { 0x54003, 0x190 },
3378 { 0x54004, 0x2 },
3379 { 0x54005, 0x2228 },
3380 { 0x54006, 0x11 },
3381 { 0x54008, 0x121f },
3382 { 0x54009, 0xc8 },
3383 { 0x5400b, 0x2 },
3384 { 0x54012, 0x110 },
3385 { 0x54019, 0x84 },
3386 { 0x5401a, 0x31 },
3387 { 0x5401b, 0x4d66 },
3388 { 0x5401c, 0x4d00 },
3389 { 0x5401e, 0x16 },
3390 { 0x5401f, 0x84 },
3391 { 0x54020, 0x31 },
3392 { 0x54021, 0x4d66 },
3393 { 0x54022, 0x4d00 },
3394 { 0x54024, 0x16 },
3395 { 0x5402b, 0x1000 },
3396 { 0x5402c, 0x1 },
3397 { 0x54032, 0x8400 },
3398 { 0x54033, 0x3100 },
3399 { 0x54034, 0x6600 },
3400 { 0x54035, 0x4d },
3401 { 0x54036, 0x4d },
3402 { 0x54037, 0x1600 },
3403 { 0x54038, 0x8400 },
3404 { 0x54039, 0x3100 },
3405 { 0x5403a, 0x6600 },
3406 { 0x5403b, 0x4d },
3407 { 0x5403c, 0x4d },
3408 { 0x5403d, 0x1600 },
3409 { 0xd0000, 0x1 },
3410};
3411
3412/* P2 message block paremeter for training firmware */
3413static struct dram_cfg_param lpddr4_fsp2_cfg_2gb[] = {
3414 { 0xd0000, 0x0 },
3415 { 0x54002, 0x102 },
3416 { 0x54003, 0x64 },
3417 { 0x54004, 0x2 },
3418 { 0x54005, 0x2228 },
3419 { 0x54006, 0x11 },
3420 { 0x54008, 0x121f },
3421 { 0x54009, 0xc8 },
3422 { 0x5400b, 0x2 },
3423 { 0x54012, 0x110 },
3424 { 0x54019, 0x84 },
3425 { 0x5401a, 0x31 },
3426 { 0x5401b, 0x4d66 },
3427 { 0x5401c, 0x4d00 },
3428 { 0x5401e, 0x16 },
3429 { 0x5401f, 0x84 },
3430 { 0x54020, 0x31 },
3431 { 0x54021, 0x4d66 },
3432 { 0x54022, 0x4d00 },
3433 { 0x54024, 0x16 },
3434 { 0x5402b, 0x1000 },
3435 { 0x5402c, 0x1 },
3436 { 0x54032, 0x8400 },
3437 { 0x54033, 0x3100 },
3438 { 0x54034, 0x6600 },
3439 { 0x54035, 0x4d },
3440 { 0x54036, 0x4d },
3441 { 0x54037, 0x1600 },
3442 { 0x54038, 0x8400 },
3443 { 0x54039, 0x3100 },
3444 { 0x5403a, 0x6600 },
3445 { 0x5403b, 0x4d },
3446 { 0x5403c, 0x4d },
3447 { 0x5403d, 0x1600 },
3448 { 0xd0000, 0x1 },
3449};
3450
3451/* P0 2D message block paremeter for training firmware */
3452static struct dram_cfg_param lpddr4_fsp0_2d_cfg_2gb[] = {
3453 { 0xd0000, 0x0 },
3454 { 0x54003, 0xbb8 },
3455 { 0x54004, 0x2 },
3456 { 0x54005, 0x2228 },
3457 { 0x54006, 0x11 },
3458 { 0x54008, 0x61 },
3459 { 0x54009, 0xc8 },
3460 { 0x5400b, 0x2 },
3461 { 0x5400d, 0x100 },
3462 { 0x5400f, 0x100 },
3463 { 0x54010, 0x1f7f },
3464 { 0x54012, 0x110 },
3465 { 0x54019, 0x2dd4 },
3466 { 0x5401a, 0x31 },
3467 { 0x5401b, 0x4d66 },
3468 { 0x5401c, 0x4d00 },
3469 { 0x5401e, 0x16 },
3470 { 0x5401f, 0x2dd4 },
3471 { 0x54020, 0x31 },
3472 { 0x54021, 0x4d66 },
3473 { 0x54022, 0x4d00 },
3474 { 0x54024, 0x16 },
3475 { 0x5402b, 0x1000 },
3476 { 0x5402c, 0x1 },
3477 { 0x54032, 0xd400 },
3478 { 0x54033, 0x312d },
3479 { 0x54034, 0x6600 },
3480 { 0x54035, 0x4d },
3481 { 0x54036, 0x4d },
3482 { 0x54037, 0x1600 },
3483 { 0x54038, 0xd400 },
3484 { 0x54039, 0x312d },
3485 { 0x5403a, 0x6600 },
3486 { 0x5403b, 0x4d },
3487 { 0x5403c, 0x4d },
3488 { 0x5403d, 0x1600 },
3489 { 0xd0000, 0x1 },
3490};
3491
3492static struct dram_fsp_msg lpddr4_dram_fsp_msg_2gb[] = {
3493 {
3494 /* P0 3000mts 1D */
3495 .drate = 3000,
3496 .fw_type = FW_1D_IMAGE,
3497 .fsp_cfg = lpddr4_fsp0_cfg_2gb,
3498 .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp0_cfg_2gb),
3499 },
3500 {
3501 /* P1 400mts 1D */
3502 .drate = 400,
3503 .fw_type = FW_1D_IMAGE,
3504 .fsp_cfg = lpddr4_fsp1_cfg_2gb,
3505 .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp1_cfg_2gb),
3506 },
3507 {
3508 /* P2 100mts 1D */
3509 .drate = 100,
3510 .fw_type = FW_1D_IMAGE,
3511 .fsp_cfg = lpddr4_fsp2_cfg_2gb,
3512 .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp2_cfg_2gb),
3513 },
3514 {
3515 /* P0 3000mts 2D */
3516 .drate = 3000,
3517 .fw_type = FW_2D_IMAGE,
3518 .fsp_cfg = lpddr4_fsp0_2d_cfg_2gb,
3519 .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp0_2d_cfg_2gb),
3520 },
3521};
3522
3523/* lpddr4 timing config params */
3524struct dram_timing_info dram_timing_2gb = {
3525 .ddrc_cfg = lpddr4_ddrc_cfg_2gb,
3526 .ddrc_cfg_num = ARRAY_SIZE(lpddr4_ddrc_cfg_2gb),
3527 .ddrphy_cfg = lpddr4_ddrphy_cfg_2gb,
3528 .ddrphy_cfg_num = ARRAY_SIZE(lpddr4_ddrphy_cfg_2gb),
3529 .fsp_msg = lpddr4_dram_fsp_msg_2gb,
3530 .fsp_msg_num = ARRAY_SIZE(lpddr4_dram_fsp_msg_2gb),
3531 .ddrphy_trained_csr = lpddr4_ddrphy_trained_csr,
3532 .ddrphy_trained_csr_num = ARRAY_SIZE(lpddr4_ddrphy_trained_csr),
3533 .ddrphy_pie = lpddr4_phy_pie,
3534 .ddrphy_pie_num = ARRAY_SIZE(lpddr4_phy_pie),
3535 .fsp_table = { 3000, 400, 100, },
3536};