blob: f7ea799343bc0dff6aed8cf3268790e51c69d6fc [file] [log] [blame]
Peng Fanaeb9c062018-11-20 10:20:00 +00001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2018 NXP
4 */
5
6#include <linux/kernel.h>
7#include <common.h>
8#include <asm/arch/ddr.h>
9#include <asm/arch/lpddr4_define.h>
10
11#define WR_POST_EXT_3200 /* recommened to define */
12
13struct dram_cfg_param lpddr4_ddrc_cfg[] = {
14 /* Start to config, default 3200mbps */
15 { DDRC_DBG1(0), 0x00000001 },
16 { DDRC_PWRCTL(0), 0x00000001 },
17 { DDRC_MSTR(0), 0xa3080020 },
18 { DDRC_MSTR2(0), 0x00000000 },
19 { DDRC_RFSHTMG(0), 0x006100E0 },
20 { DDRC_INIT0(0), 0xC003061B },
21 { DDRC_INIT1(0), 0x009D0000 },
22 { DDRC_INIT3(0), 0x00D4002D },
23#ifdef WR_POST_EXT_3200
24 { DDRC_INIT4(0), 0x00330008 },
25#else
26 { DDRC_INIT4(0), 0x00310008 },
27#endif
28 { DDRC_INIT6(0), 0x0066004a },
29 { DDRC_INIT7(0), 0x0006004a },
30
31 { DDRC_DRAMTMG0(0), 0x1A201B22 },
32 { DDRC_DRAMTMG1(0), 0x00060633 },
33 { DDRC_DRAMTMG3(0), 0x00C0C000 },
34 { DDRC_DRAMTMG4(0), 0x0F04080F },
35 { DDRC_DRAMTMG5(0), 0x02040C0C },
36 { DDRC_DRAMTMG6(0), 0x01010007 },
37 { DDRC_DRAMTMG7(0), 0x00000401 },
38 { DDRC_DRAMTMG12(0), 0x00020600 },
39 { DDRC_DRAMTMG13(0), 0x0C100002 },
40 { DDRC_DRAMTMG14(0), 0x000000E6 },
41 { DDRC_DRAMTMG17(0), 0x00A00050 },
42
43 { DDRC_ZQCTL0(0), 0x03200018 },
44 { DDRC_ZQCTL1(0), 0x028061A8 },
45 { DDRC_ZQCTL2(0), 0x00000000 },
46
47 { DDRC_DFITMG0(0), 0x0497820A },
48 { DDRC_DFITMG1(0), 0x00080303 },
49 { DDRC_DFIUPD0(0), 0xE0400018 },
50 { DDRC_DFIUPD1(0), 0x00DF00E4 },
51 { DDRC_DFIUPD2(0), 0x80000000 },
52 { DDRC_DFIMISC(0), 0x00000011 },
53 { DDRC_DFITMG2(0), 0x0000170A },
54
55 { DDRC_DBICTL(0), 0x00000001 },
56 { DDRC_DFIPHYMSTR(0), 0x00000001 },
57 { DDRC_RANKCTL(0), 0x00000c99 },
58 { DDRC_DRAMTMG2(0), 0x070E171a },
59
60 /* address mapping */
61 { DDRC_ADDRMAP0(0), 0x00000015 },
62 { DDRC_ADDRMAP3(0), 0x00000000 },
63 { DDRC_ADDRMAP4(0), 0x00001F1F },
64 /* bank interleave */
65 { DDRC_ADDRMAP1(0), 0x00080808 },
66 { DDRC_ADDRMAP5(0), 0x07070707 },
67 { DDRC_ADDRMAP6(0), 0x08080707 },
68
69 /* performance setting */
70 { DDRC_ODTCFG(0), 0x0b060908 },
71 { DDRC_ODTMAP(0), 0x00000000 },
72 { DDRC_SCHED(0), 0x29511505 },
73 { DDRC_SCHED1(0), 0x0000002c },
74 { DDRC_PERFHPR1(0), 0x5900575b },
75 { DDRC_PERFLPR1(0), 0x00000009 },
76 { DDRC_PERFWR1(0), 0x02005574 },
77 { DDRC_DBG0(0), 0x00000016 },
78 { DDRC_DBG1(0), 0x00000000 },
79 { DDRC_DBGCMD(0), 0x00000000 },
80 { DDRC_SWCTL(0), 0x00000001 },
81 { DDRC_POISONCFG(0), 0x00000011 },
82 { DDRC_PCCFG(0), 0x00000111 },
83 { DDRC_PCFGR_0(0), 0x000010f3 },
84 { DDRC_PCFGW_0(0), 0x000072ff },
85 { DDRC_PCTRL_0(0), 0x00000001 },
86 { DDRC_PCFGQOS0_0(0), 0x01110d00 },
87 { DDRC_PCFGQOS1_0(0), 0x00620790 },
88 { DDRC_PCFGWQOS0_0(0), 0x00100001 },
89 { DDRC_PCFGWQOS1_0(0), 0x0000041f },
90
91 /* Frequency 1: 400mbps */
92 { DDRC_FREQ1_DRAMTMG0(0), 0x0d0b010c },
93 { DDRC_FREQ1_DRAMTMG1(0), 0x00030410 },
94 { DDRC_FREQ1_DRAMTMG2(0), 0x0305090c },
95 { DDRC_FREQ1_DRAMTMG3(0), 0x00505006 },
96 { DDRC_FREQ1_DRAMTMG4(0), 0x05040305 },
97 { DDRC_FREQ1_DRAMTMG5(0), 0x0d0e0504 },
98 { DDRC_FREQ1_DRAMTMG6(0), 0x0a060004 },
99 { DDRC_FREQ1_DRAMTMG7(0), 0x0000090e },
100 { DDRC_FREQ1_DRAMTMG14(0), 0x00000032 },
101 { DDRC_FREQ1_DRAMTMG15(0), 0x00000000 },
102 { DDRC_FREQ1_DRAMTMG17(0), 0x0036001b },
103 { DDRC_FREQ1_DERATEINT(0), 0x7e9fbeb1 },
104 { DDRC_FREQ1_DFITMG0(0), 0x03818200 },
105 { DDRC_FREQ1_DFITMG2(0), 0x00000000 },
106 { DDRC_FREQ1_RFSHTMG(0), 0x000C001c },
107 { DDRC_FREQ1_INIT3(0), 0x00840000 },
108 { DDRC_FREQ1_INIT4(0), 0x00310008 },
109 { DDRC_FREQ1_INIT6(0), 0x0066004a },
110 { DDRC_FREQ1_INIT7(0), 0x0006004a },
111
112 /* Frequency 2: 100mbps */
113 { DDRC_FREQ2_DRAMTMG0(0), 0x0d0b010c },
114 { DDRC_FREQ2_DRAMTMG1(0), 0x00030410 },
115 { DDRC_FREQ2_DRAMTMG2(0), 0x0305090c },
116 { DDRC_FREQ2_DRAMTMG3(0), 0x00505006 },
117 { DDRC_FREQ2_DRAMTMG4(0), 0x05040305 },
118 { DDRC_FREQ2_DRAMTMG5(0), 0x0d0e0504 },
119 { DDRC_FREQ2_DRAMTMG6(0), 0x0a060004 },
120 { DDRC_FREQ2_DRAMTMG7(0), 0x0000090e },
121 { DDRC_FREQ2_DRAMTMG14(0), 0x00000032 },
122 { DDRC_FREQ2_DRAMTMG17(0), 0x0036001b },
123 { DDRC_FREQ2_DERATEINT(0), 0x7e9fbeb1 },
124 { DDRC_FREQ2_DFITMG0(0), 0x03818200 },
125 { DDRC_FREQ2_DFITMG2(0), 0x00000000 },
126 { DDRC_FREQ2_RFSHTMG(0), 0x00030007 },
127 { DDRC_FREQ2_INIT3(0), 0x00840000 },
128 { DDRC_FREQ2_INIT4(0), 0x00310008 },
129 { DDRC_FREQ2_INIT6(0), 0x0066004a },
130 { DDRC_FREQ2_INIT7(0), 0x0006004a },
131};
132
133/* PHY Initialize Configuration */
134struct dram_cfg_param lpddr4_ddrphy_cfg[] = {
135 { 0x20110, 0x02 },
136 { 0x20111, 0x03 },
137 { 0x20112, 0x04 },
138 { 0x20113, 0x05 },
139 { 0x20114, 0x00 },
140 { 0x20115, 0x01 },
141
142 { 0x1005f, 0x1ff },
143 { 0x1015f, 0x1ff },
144 { 0x1105f, 0x1ff },
145 { 0x1115f, 0x1ff },
146 { 0x1205f, 0x1ff },
147 { 0x1215f, 0x1ff },
148 { 0x1305f, 0x1ff },
149 { 0x1315f, 0x1ff },
150
151 { 0x11005f, 0x1ff },
152 { 0x11015f, 0x1ff },
153 { 0x11105f, 0x1ff },
154 { 0x11115f, 0x1ff },
155 { 0x11205f, 0x1ff },
156 { 0x11215f, 0x1ff },
157 { 0x11305f, 0x1ff },
158 { 0x11315f, 0x1ff },
159
160 { 0x21005f, 0x1ff },
161 { 0x21015f, 0x1ff },
162 { 0x21105f, 0x1ff },
163 { 0x21115f, 0x1ff },
164 { 0x21205f, 0x1ff },
165 { 0x21215f, 0x1ff },
166 { 0x21305f, 0x1ff },
167 { 0x21315f, 0x1ff },
168
169 { 0x55, 0x1ff },
170 { 0x1055, 0x1ff },
171 { 0x2055, 0x1ff },
172 { 0x3055, 0x1ff },
173 { 0x4055, 0x1ff },
174 { 0x5055, 0x1ff },
175 { 0x6055, 0x1ff },
176 { 0x7055, 0x1ff },
177 { 0x8055, 0x1ff },
178 { 0x9055, 0x1ff },
179
180 { 0x200c5, 0x19 },
181 { 0x1200c5, 0x7 },
182 { 0x2200c5, 0x7 },
183
184 { 0x2002e, 0x2 },
185 { 0x12002e, 0x2 },
186 { 0x22002e, 0x2 },
187
188 { 0x90204, 0x0 },
189 { 0x190204, 0x0 },
190 { 0x290204, 0x0 },
191
192#ifdef WR_POST_EXT_3200
193 { 0x20024, 0xeb },
194#else
195 { 0x20024, 0xab },
196#endif
197 { 0x2003a, 0x0 },
198 { 0x120024, 0xab },
199 { 0x2003a, 0x0 },
200 { 0x220024, 0xab },
201 { 0x2003a, 0x0 },
202 { 0x20056, 0x3 },
203 { 0x120056, 0xa },
204 { 0x220056, 0xa },
205 { 0x1004d, 0xe00 },
206 { 0x1014d, 0xe00 },
207 { 0x1104d, 0xe00 },
208 { 0x1114d, 0xe00 },
209 { 0x1204d, 0xe00 },
210 { 0x1214d, 0xe00 },
211 { 0x1304d, 0xe00 },
212 { 0x1314d, 0xe00 },
213 { 0x11004d, 0xe00 },
214 { 0x11014d, 0xe00 },
215 { 0x11104d, 0xe00 },
216 { 0x11114d, 0xe00 },
217 { 0x11204d, 0xe00 },
218 { 0x11214d, 0xe00 },
219 { 0x11304d, 0xe00 },
220 { 0x11314d, 0xe00 },
221 { 0x21004d, 0xe00 },
222 { 0x21014d, 0xe00 },
223 { 0x21104d, 0xe00 },
224 { 0x21114d, 0xe00 },
225 { 0x21204d, 0xe00 },
226 { 0x21214d, 0xe00 },
227 { 0x21304d, 0xe00 },
228 { 0x21314d, 0xe00 },
229
230 { 0x10049, 0xfbe },
231 { 0x10149, 0xfbe },
232 { 0x11049, 0xfbe },
233 { 0x11149, 0xfbe },
234 { 0x12049, 0xfbe },
235 { 0x12149, 0xfbe },
236 { 0x13049, 0xfbe },
237 { 0x13149, 0xfbe },
238 { 0x110049, 0xfbe },
239 { 0x110149, 0xfbe },
240 { 0x111049, 0xfbe },
241 { 0x111149, 0xfbe },
242 { 0x112049, 0xfbe },
243 { 0x112149, 0xfbe },
244 { 0x113049, 0xfbe },
245 { 0x113149, 0xfbe },
246 { 0x210049, 0xfbe },
247 { 0x210149, 0xfbe },
248 { 0x211049, 0xfbe },
249 { 0x211149, 0xfbe },
250 { 0x212049, 0xfbe },
251 { 0x212149, 0xfbe },
252 { 0x213049, 0xfbe },
253 { 0x213149, 0xfbe },
254
255 { 0x43, ((LPDDR4_PHY_ADDR_RON << 5) | LPDDR4_PHY_ADDR_RON) },
256 { 0x1043, ((LPDDR4_PHY_ADDR_RON << 5) | LPDDR4_PHY_ADDR_RON) },
257 { 0x2043, ((LPDDR4_PHY_ADDR_RON << 5) | LPDDR4_PHY_ADDR_RON) },
258 { 0x3043, ((LPDDR4_PHY_ADDR_RON << 5) | LPDDR4_PHY_ADDR_RON) },
259 { 0x4043, ((LPDDR4_PHY_ADDR_RON << 5) | LPDDR4_PHY_ADDR_RON) },
260 { 0x5043, ((LPDDR4_PHY_ADDR_RON << 5) | LPDDR4_PHY_ADDR_RON) },
261 { 0x6043, ((LPDDR4_PHY_ADDR_RON << 5) | LPDDR4_PHY_ADDR_RON) },
262 { 0x7043, ((LPDDR4_PHY_ADDR_RON << 5) | LPDDR4_PHY_ADDR_RON) },
263 { 0x8043, ((LPDDR4_PHY_ADDR_RON << 5) | LPDDR4_PHY_ADDR_RON) },
264 { 0x9043, ((LPDDR4_PHY_ADDR_RON << 5) | LPDDR4_PHY_ADDR_RON) },
265
266 { 0x20018, 0x3 },
267 { 0x20075, 0x4 },
268 { 0x20050, 0x0 },
269 { 0x20008, 0x320 },
270 { 0x120008, 0x64 },
271 { 0x220008, 0x19 },
272 { 0x20088, 0x9 },
273 { 0x200b2, 0x104 },
274 { 0x10043, 0x5a1 },
275 { 0x10143, 0x5a1 },
276 { 0x11043, 0x5a1 },
277 { 0x11143, 0x5a1 },
278 { 0x12043, 0x5a1 },
279 { 0x12143, 0x5a1 },
280 { 0x13043, 0x5a1 },
281 { 0x13143, 0x5a1 },
282 { 0x1200b2, 0x104 },
283 { 0x110043, 0x5a1 },
284 { 0x110143, 0x5a1 },
285 { 0x111043, 0x5a1 },
286 { 0x111143, 0x5a1 },
287 { 0x112043, 0x5a1 },
288 { 0x112143, 0x5a1 },
289 { 0x113043, 0x5a1 },
290 { 0x113143, 0x5a1 },
291 { 0x2200b2, 0x104 },
292 { 0x210043, 0x5a1 },
293 { 0x210143, 0x5a1 },
294 { 0x211043, 0x5a1 },
295 { 0x211143, 0x5a1 },
296 { 0x212043, 0x5a1 },
297 { 0x212143, 0x5a1 },
298 { 0x213043, 0x5a1 },
299 { 0x213143, 0x5a1 },
300 { 0x200fa, 0x1 },
301 { 0x1200fa, 0x1 },
302 { 0x2200fa, 0x1 },
303 { 0x20019, 0x1 },
304 { 0x120019, 0x1 },
305 { 0x220019, 0x1 },
306 { 0x200f0, 0x660 },
307 { 0x200f1, 0x0 },
308 { 0x200f2, 0x4444 },
309 { 0x200f3, 0x8888 },
310 { 0x200f4, 0x5665 },
311 { 0x200f5, 0x0 },
312 { 0x200f6, 0x0 },
313 { 0x200f7, 0xf000 },
314 { 0x20025, 0x0 },
315 { 0x2002d, 0x0 },
316 { 0x12002d, 0x0 },
317 { 0x22002d, 0x0 },
318
319 { 0x200c7, 0x80 },
320 { 0x1200c7, 0x80 },
321 { 0x2200c7, 0x80 },
322 { 0x200ca, 0x106 },
323 { 0x1200ca, 0x106 },
324 { 0x2200ca, 0x106 },
325};
326
327/* P0 message block paremeter for training firmware */
328struct dram_cfg_param lpddr4_fsp0_cfg[] = {
329 { 0xd0000, 0x0 },
330 { 0x54000, 0x0 },
331 { 0x54001, 0x0 },
332 { 0x54002, 0x0 },
333 { 0x54003, 0xc80 },
334 { 0x54004, 0x2 },
335 { 0x54005, ((LPDDR4_PHY_RON << 8) | LPDDR4_PHY_RTT) }, /* PHY Ron/Rtt */
336 { 0x54006, LPDDR4_PHY_VREF_VALUE },
337 { 0x54007, 0x0 },
338 { 0x54008, 0x131f },
339 { 0x54009, LPDDR4_HDT_CTL_3200_1D },
340 { 0x5400a, 0x0 },
341 { 0x5400b, 0x2 },
342 { 0x5400c, 0x0 },
343 { 0x5400d, (LPDDR4_CATRAIN_3200_1d << 8) },
344 { 0x5400e, 0x0 },
345 { 0x5400f, 0x0 },
346 { 0x54010, 0x0 },
347 { 0x54011, 0x0 },
348 { 0x54012, 0x310 },
349 { 0x54013, 0x0 },
350 { 0x54014, 0x0 },
351 { 0x54015, 0x0 },
352 { 0x54016, 0x0 },
353 { 0x54017, 0x0 },
354 { 0x54018, 0x0 },
355
356 { 0x54019, 0x2dd4 },
357#ifdef WR_POST_EXT_3200
358 { 0x5401a, (((LPDDR4_RON) << 3) | 0x3) },
359#else
360 { 0x5401a, (((LPDDR4_RON) << 3) | 0x1) },
361#endif
362 { 0x5401b, ((LPDDR4_VREF_VALUE_CA << 8) |
363 (LPDDR4_RTT_CA_BANK0 << 4) | LPDDR4_RTT_DQ) },
364 { 0x5401c, ((LPDDR4_VREF_VALUE_DQ_RANK0 << 8) | 0x08) },
365 { 0x5401d, 0x0 },
366 { 0x5401e, LPDDR4_MR22_RANK0 },
367 { 0x5401f, 0x2dd4 },
368#ifdef WR_POST_EXT_3200
369 { 0x54020, (((LPDDR4_RON) << 3) | 0x3) },
370#else
371 { 0x54020, (((LPDDR4_RON) << 3) | 0x1) },
372#endif
373 { 0x54021, ((LPDDR4_VREF_VALUE_CA << 8) |
374 (LPDDR4_RTT_CA_BANK1 << 4) | LPDDR4_RTT_DQ) },
375 { 0x54022, ((LPDDR4_VREF_VALUE_DQ_RANK1 << 8) | 0x08) },
376 { 0x54023, 0x0 },
377 { 0x54024, LPDDR4_MR22_RANK1 },
378
379 { 0x54025, 0x0 },
380 { 0x54026, 0x0 },
381 { 0x54027, 0x0 },
382 { 0x54028, 0x0 },
383 { 0x54029, 0x0 },
384 { 0x5402a, 0x0 },
385 { 0x5402b, 0x1000 },
386 { 0x5402c, 0x3 },
387 { 0x5402d, 0x0 },
388 { 0x5402e, 0x0 },
389 { 0x5402f, 0x0 },
390 { 0x54030, 0x0 },
391 { 0x54031, 0x0 },
392 { 0x54032, 0xd400 },
393 /* MR3/MR2 */
394#ifdef WR_POST_EXT_3200
395 { 0x54033, ((((LPDDR4_RON) << 3) | 0x3) << 8) | 0x2d /*0x312d*/ },
396#else
397 { 0x54033, ((((LPDDR4_RON) << 3) | 0x1) << 8) | 0x2d/*0x312d*/ },
398#endif
399 /* MR11/MR4 */
400 { 0x54034, (((LPDDR4_RTT_CA_BANK0 << 4) | LPDDR4_RTT_DQ) << 8) },
401 /* self:0x284d//MR13/MR12 */
402 { 0x54035, (0x0800 | LPDDR4_VREF_VALUE_CA)/*0x084d*/ },
403 /* MR16/MR14*/
404 { 0x54036, LPDDR4_VREF_VALUE_DQ_RANK0/*0x4d*/ },
405 { 0x54037, (LPDDR4_MR22_RANK0 << 8)/*0x500*/ },
406 /* MR1 */
407 { 0x54038, 0xd400 },
408 /* MR3/MR2 */
409#ifdef WR_POST_EXT_3200
410 { 0x54039, ((((LPDDR4_RON) << 3) | 0x3) << 8) | 0x2d/*0x312d*/ },
411#else
412 { 0x54039, ((((LPDDR4_RON) << 3) | 0x1) << 8) | 0x2d/*0x312d*/ },
413#endif
414 /* MR11/MR4 */
415 { 0x5403a, (((LPDDR4_RTT_CA_BANK1 << 4) | LPDDR4_RTT_DQ) << 8) },
416 /* self:0x284d//MR13/MR12 */
417 { 0x5403b, (0x0800 | LPDDR4_VREF_VALUE_CA)/*0x084d*/ },
418 /* MR16/MR14 */
419 { 0x5403c, LPDDR4_VREF_VALUE_DQ_RANK1/*0x4d*/ },
420 { 0x5403d, (LPDDR4_MR22_RANK1 << 8)/*0x500*/ },
421 /* { 0x5403d, 0x500 } */
422 { 0x5403d, (LPDDR4_MR22_RANK1 << 8)/*0x500*/ },
423 { 0x5403e, 0x0 },
424 { 0x5403f, 0x0 },
425 { 0x54040, 0x0 },
426 { 0x54041, 0x0 },
427 { 0x54042, 0x0 },
428 { 0x54043, 0x0 },
429 { 0x54044, 0x0 },
430 { 0xd0000, 0x1 },
431};
432
433/* P1 message block paremeter for training firmware */
434struct dram_cfg_param lpddr4_fsp1_cfg[] = {
435 { 0xd0000, 0x0 },
436 { 0x54000, 0x0 },
437 { 0x54001, 0x0 },
438 { 0x54002, 0x101 },
439 { 0x54003, 0x190 },
440 { 0x54004, 0x2 },
441 /* PHY Ron/Rtt */
442 { 0x54005, ((LPDDR4_PHY_RON << 8) | LPDDR4_PHY_RTT)/*0x2828*/ },
443 { 0x54006, LPDDR4_PHY_VREF_VALUE },
444 { 0x54007, 0x0 },
445 { 0x54008, LPDDR4_TRAIN_SEQ_400 },
446 { 0x54009, LPDDR4_HDT_CTL_400_1D },
447 { 0x5400a, 0x0 },
448 { 0x5400b, 0x2 },
449 { 0x5400c, 0x0 },
450 { 0x5400d, (LPDDR4_CATRAIN_400 << 8) },
451 { 0x5400e, 0x0 },
452 { 0x5400f, 0x0 },
453 { 0x54010, 0x0 },
454 { 0x54011, 0x0 },
455 { 0x54012, 0x310 },
456 { 0x54013, 0x0 },
457 { 0x54014, 0x0 },
458 { 0x54015, 0x0 },
459 { 0x54016, 0x0 },
460 { 0x54017, 0x0 },
461 { 0x54018, 0x0 },
462 { 0x54019, 0x84 },
463 /* MR4/MR3 */
464 { 0x5401a, (((LPDDR4_RON) << 3) | 0x1)/*0x31*/ },
465 /* MR12/MR11 */
466 { 0x5401b, ((LPDDR4_VREF_VALUE_CA << 8) | (LPDDR4_RTT_CA << 4) |
467 LPDDR4_RTT_DQ)/*0x4d46*/ },
468 /* self:0x4d28//MR14/MR13 */
469 { 0x5401c, ((LPDDR4_VREF_VALUE_DQ_RANK0 << 8) | 0x08)/*0x4d08*/ },
470 { 0x5401d, 0x0 },
471 { 0x5401e, LPDDR4_MR22_RANK0/*0x5*/ },
472 { 0x5401f, 0x84 },
473 { 0x54020, (((LPDDR4_RON) << 3) | 0x1)/*0x31*/ }, /* MR4/MR3 */
474 { 0x54021, ((LPDDR4_VREF_VALUE_CA << 8) | (LPDDR4_RTT_CA << 4) |
475 LPDDR4_RTT_DQ)/*0x4d46*/ },/* MR12/MR11 */
476 /* self:0x4d28//MR14/MR13 */
477 { 0x54022, ((LPDDR4_VREF_VALUE_DQ_RANK1 << 8) | 0x08)/*0x4d08*/ },
478 { 0x54023, 0x0 },
479 { 0x54024, LPDDR4_MR22_RANK1 },
480 { 0x54025, 0x0 },
481 { 0x54026, 0x0 },
482 { 0x54027, 0x0 },
483 { 0x54028, 0x0 },
484 { 0x54029, 0x0 },
485 { 0x5402a, 0x0 },
486 { 0x5402b, 0x1000 },
487 { 0x5402c, 0x3 },
488 { 0x5402d, 0x0 },
489 { 0x5402e, 0x0 },
490 { 0x5402f, 0x0 },
491 { 0x54030, 0x0 },
492 { 0x54031, 0x0 },
493 { 0x54032, 0x8400 },
494 { 0x54033, ((((LPDDR4_RON) << 3) | 0x1) << 8) | 0x00 },
495 { 0x54034, (((LPDDR4_RTT_CA << 4) | LPDDR4_RTT_DQ) << 8) },
496 { 0x54035, (0x0800 | LPDDR4_VREF_VALUE_CA) },
497 { 0x54036, LPDDR4_VREF_VALUE_DQ_RANK0 },
498 { 0x54037, (LPDDR4_MR22_RANK0 << 8) },
499 { 0x54038, 0x8400 },
500 { 0x54039, ((((LPDDR4_RON) << 3) | 0x1) << 8) | 0x00 },
501 { 0x5403a, (((LPDDR4_RTT_CA << 4) | LPDDR4_RTT_DQ) << 8) },
502 { 0x5403b, (0x0800 | LPDDR4_VREF_VALUE_CA) },
503 { 0x5403c, LPDDR4_VREF_VALUE_DQ_RANK1 },
504 { 0x5403d, (LPDDR4_MR22_RANK1 << 8) },
505 { 0x5403e, 0x0 },
506 { 0x5403f, 0x0 },
507 { 0x54040, 0x0 },
508 { 0x54041, 0x0 },
509 { 0x54042, 0x0 },
510 { 0x54043, 0x0 },
511 { 0x54044, 0x0 },
512 { 0xd0000, 0x1 },
513};
514
515/* P2 message block paremeter for training firmware */
516struct dram_cfg_param lpddr4_fsp2_cfg[] = {
517 { 0xd0000, 0x0 },
518 { 0x54000, 0x0 },
519 { 0x54001, 0x0 },
520 { 0x54002, 0x102 },
521 { 0x54003, 0x64 },
522 { 0x54004, 0x2 },
523 { 0x54005, ((LPDDR4_PHY_RON << 8) | LPDDR4_PHY_RTT) },
524 { 0x54006, LPDDR4_PHY_VREF_VALUE },
525 { 0x54007, 0x0 },
526 { 0x54008, LPDDR4_TRAIN_SEQ_100 },
527 { 0x54009, LPDDR4_HDT_CTL_100_1D },
528 { 0x5400a, 0x0 },
529 { 0x5400b, 0x2 },
530 { 0x5400c, 0x0 },
531 { 0x5400d, (LPDDR4_CATRAIN_100 << 8) },
532 { 0x5400e, 0x0 },
533 { 0x5400f, 0x0 },
534 { 0x54010, 0x0 },
535 { 0x54011, 0x0 },
536 { 0x54012, 0x310 },
537 { 0x54013, 0x0 },
538 { 0x54014, 0x0 },
539 { 0x54015, 0x0 },
540 { 0x54016, 0x0 },
541 { 0x54017, 0x0 },
542 { 0x54018, 0x0 },
543 { 0x54019, 0x84 },
544 { 0x5401a, (((LPDDR4_RON) << 3) | 0x1) },
545 { 0x5401b, ((LPDDR4_VREF_VALUE_CA << 8) | (LPDDR4_RTT_CA << 4) |
546 LPDDR4_RTT_DQ) },
547 { 0x5401c, ((LPDDR4_VREF_VALUE_DQ_RANK0 << 8) | 0x08) },
548 { 0x5401d, 0x0 },
549 { 0x5401e, LPDDR4_MR22_RANK0 },
550 { 0x5401f, 0x84 },
551 { 0x54020, (((LPDDR4_RON) << 3) | 0x1) },
552 { 0x54021, ((LPDDR4_VREF_VALUE_CA << 8) | (LPDDR4_RTT_CA << 4) |
553 LPDDR4_RTT_DQ) },
554 { 0x54022, ((LPDDR4_VREF_VALUE_DQ_RANK1 << 8) | 0x08) },
555 { 0x54023, 0x0 },
556 { 0x54024, LPDDR4_MR22_RANK1 },
557 { 0x54025, 0x0 },
558 { 0x54026, 0x0 },
559 { 0x54027, 0x0 },
560 { 0x54028, 0x0 },
561 { 0x54029, 0x0 },
562 { 0x5402a, 0x0 },
563 { 0x5402b, 0x1000 },
564 { 0x5402c, 0x3 },
565 { 0x5402d, 0x0 },
566 { 0x5402e, 0x0 },
567 { 0x5402f, 0x0 },
568 { 0x54030, 0x0 },
569 { 0x54031, 0x0 },
570 { 0x54032, 0x8400 },
571 { 0x54033, ((((LPDDR4_RON) << 3) | 0x1) << 8) | 0x00 },
572 { 0x54034, (((LPDDR4_RTT_CA << 4) | LPDDR4_RTT_DQ) << 8) },
573 { 0x54035, (0x0800 | LPDDR4_VREF_VALUE_CA) },
574 { 0x54036, LPDDR4_VREF_VALUE_DQ_RANK0 },
575 { 0x54037, (LPDDR4_MR22_RANK0 << 8) },
576 { 0x54038, 0x8400 },
577 { 0x54039, ((((LPDDR4_RON) << 3) | 0x1) << 8) | 0x00 },
578 { 0x5403a, (((LPDDR4_RTT_CA << 4) | LPDDR4_RTT_DQ) << 8) },
579 { 0x5403b, (0x0800 | LPDDR4_VREF_VALUE_CA) },
580 { 0x5403c, LPDDR4_VREF_VALUE_DQ_RANK1 },
581 { 0x5403d, (LPDDR4_MR22_RANK1 << 8) },
582 { 0x5403e, 0x0 },
583 { 0x5403f, 0x0 },
584 { 0x54040, 0x0 },
585 { 0x54041, 0x0 },
586 { 0x54042, 0x0 },
587 { 0x54043, 0x0 },
588 { 0x54044, 0x0 },
589 { 0xd0000, 0x1 },
590};
591
592/* P0 2D message block paremeter for training firmware */
593struct dram_cfg_param lpddr4_fsp0_2d_cfg[] = {
594 { 0xd0000, 0x0 },
595 { 0x54000, 0x0 },
596 { 0x54001, 0x0 },
597 { 0x54002, 0x0 },
598 { 0x54003, 0xc80 },
599 { 0x54004, 0x2 },
600 { 0x54005, ((LPDDR4_PHY_RON << 8) | LPDDR4_PHY_RTT) },
601 { 0x54006, LPDDR4_PHY_VREF_VALUE },
602 { 0x54007, 0x0 },
603 { 0x54008, 0x61 },
604 { 0x54009, LPDDR4_HDT_CTL_2D },
605 { 0x5400a, 0x0 },
606 { 0x5400b, 0x2 },
607 { 0x5400c, 0x0 },
608 { 0x5400d, (LPDDR4_CATRAIN_3200_2d << 8) },
609 { 0x5400e, 0x0 },
610 { 0x5400f, (LPDDR4_2D_SHARE << 8) | 0x00 },
611 { 0x54010, LPDDR4_2D_WEIGHT },
612 { 0x54011, 0x0 },
613 { 0x54012, 0x310 },
614 { 0x54013, 0x0 },
615 { 0x54014, 0x0 },
616 { 0x54015, 0x0 },
617 { 0x54016, 0x0 },
618 { 0x54017, 0x0 },
619 { 0x54018, 0x0 },
620 { 0x54019, 0x2dd4 },
621#ifdef WR_POST_EXT_3200
622 { 0x5401a, (((LPDDR4_RON) << 3) | 0x3) },
623#else
624 { 0x5401a, (((LPDDR4_RON) << 3) | 0x1) },
625#endif
626 { 0x5401b, ((LPDDR4_VREF_VALUE_CA << 8) |
627 (LPDDR4_RTT_CA_BANK0 << 4) | LPDDR4_RTT_DQ) },
628 { 0x5401c, ((LPDDR4_VREF_VALUE_DQ_RANK0 << 8) | 0x08) },
629 { 0x5401d, 0x0 },
630 { 0x5401e, LPDDR4_MR22_RANK0 },
631 { 0x5401f, 0x2dd4 },
632#ifdef WR_POST_EXT_3200
633 { 0x54020, (((LPDDR4_RON) << 3) | 0x3) },
634#else
635 { 0x54020, (((LPDDR4_RON) << 3) | 0x1) },
636#endif
637 { 0x54021, ((LPDDR4_VREF_VALUE_CA << 8) |
638 (LPDDR4_RTT_CA_BANK1 << 4) | LPDDR4_RTT_DQ) },
639 { 0x54022, ((LPDDR4_VREF_VALUE_DQ_RANK1 << 8) | 0x08) },
640 { 0x54023, 0x0 },
641 { 0x54024, LPDDR4_MR22_RANK1 },
642 { 0x54025, 0x0 },
643 { 0x54026, 0x0 },
644 { 0x54027, 0x0 },
645 { 0x54028, 0x0 },
646 { 0x54029, 0x0 },
647 { 0x5402a, 0x0 },
648 { 0x5402b, 0x1000 },
649 { 0x5402c, 0x3 },
650 { 0x5402d, 0x0 },
651 { 0x5402e, 0x0 },
652 { 0x5402f, 0x0 },
653 { 0x54030, 0x0 },
654 { 0x54031, 0x0 },
655
656 { 0x54032, 0xd400 },
657#ifdef WR_POST_EXT_3200
658 { 0x54033, ((((LPDDR4_RON) << 3) | 0x3) << 8) | 0x2d },
659#else
660 { 0x54033, ((((LPDDR4_RON) << 3) | 0x1) << 8) | 0x2d },
661#endif
662 { 0x54034, (((LPDDR4_RTT_CA_BANK0 << 4) | LPDDR4_RTT_DQ) << 8) },
663 { 0x54035, (0x0800 | LPDDR4_VREF_VALUE_CA) },
664 { 0x54036, LPDDR4_VREF_VALUE_DQ_RANK0 },
665 { 0x54037, (LPDDR4_MR22_RANK0 << 8) },
666 { 0x54038, 0xd400 },
667#ifdef WR_POST_EXT_3200
668 { 0x54039, ((((LPDDR4_RON) << 3) | 0x3) << 8) | 0x2d },
669#else
670 { 0x54039, ((((LPDDR4_RON) << 3) | 0x1) << 8) | 0x2d },
671#endif
672 { 0x5403a, (((LPDDR4_RTT_CA_BANK1 << 4) | LPDDR4_RTT_DQ) << 8) },
673 { 0x5403b, (0x0800 | LPDDR4_VREF_VALUE_CA) },
674 { 0x5403c, LPDDR4_VREF_VALUE_DQ_RANK1 },
675 { 0x5403d, (LPDDR4_MR22_RANK1 << 8) },
676 { 0x5403e, 0x0 },
677 { 0x5403f, 0x0 },
678 { 0x54040, 0x0 },
679 { 0x54041, 0x0 },
680 { 0x54042, 0x0 },
681 { 0x54043, 0x0 },
682 { 0x54044, 0x0 },
683 { 0xd0000, 0x1 },
684};
685
686/* DRAM PHY init engine image */
687struct dram_cfg_param lpddr4_phy_pie[] = {
688 { 0xd0000, 0x0 },
689 { 0x90000, 0x10 },
690 { 0x90001, 0x400 },
691 { 0x90002, 0x10e },
692 { 0x90003, 0x0 },
693 { 0x90004, 0x0 },
694 { 0x90005, 0x8 },
695 { 0x90029, 0xb },
696 { 0x9002a, 0x480 },
697 { 0x9002b, 0x109 },
698 { 0x9002c, 0x8 },
699 { 0x9002d, 0x448 },
700 { 0x9002e, 0x139 },
701 { 0x9002f, 0x8 },
702 { 0x90030, 0x478 },
703 { 0x90031, 0x109 },
704 { 0x90032, 0x0 },
705 { 0x90033, 0xe8 },
706 { 0x90034, 0x109 },
707 { 0x90035, 0x2 },
708 { 0x90036, 0x10 },
709 { 0x90037, 0x139 },
710 { 0x90038, 0xf },
711 { 0x90039, 0x7c0 },
712 { 0x9003a, 0x139 },
713 { 0x9003b, 0x44 },
714 { 0x9003c, 0x630 },
715 { 0x9003d, 0x159 },
716 { 0x9003e, 0x14f },
717 { 0x9003f, 0x630 },
718 { 0x90040, 0x159 },
719 { 0x90041, 0x47 },
720 { 0x90042, 0x630 },
721 { 0x90043, 0x149 },
722 { 0x90044, 0x4f },
723 { 0x90045, 0x630 },
724 { 0x90046, 0x179 },
725 { 0x90047, 0x8 },
726 { 0x90048, 0xe0 },
727 { 0x90049, 0x109 },
728 { 0x9004a, 0x0 },
729 { 0x9004b, 0x7c8 },
730 { 0x9004c, 0x109 },
731 { 0x9004d, 0x0 },
732 { 0x9004e, 0x1 },
733 { 0x9004f, 0x8 },
734 { 0x90050, 0x0 },
735 { 0x90051, 0x45a },
736 { 0x90052, 0x9 },
737 { 0x90053, 0x0 },
738 { 0x90054, 0x448 },
739 { 0x90055, 0x109 },
740 { 0x90056, 0x40 },
741 { 0x90057, 0x630 },
742 { 0x90058, 0x179 },
743 { 0x90059, 0x1 },
744 { 0x9005a, 0x618 },
745 { 0x9005b, 0x109 },
746 { 0x9005c, 0x40c0 },
747 { 0x9005d, 0x630 },
748 { 0x9005e, 0x149 },
749 { 0x9005f, 0x8 },
750 { 0x90060, 0x4 },
751 { 0x90061, 0x48 },
752 { 0x90062, 0x4040 },
753 { 0x90063, 0x630 },
754 { 0x90064, 0x149 },
755 { 0x90065, 0x0 },
756 { 0x90066, 0x4 },
757 { 0x90067, 0x48 },
758 { 0x90068, 0x40 },
759 { 0x90069, 0x630 },
760 { 0x9006a, 0x149 },
761 { 0x9006b, 0x10 },
762 { 0x9006c, 0x4 },
763 { 0x9006d, 0x18 },
764 { 0x9006e, 0x0 },
765 { 0x9006f, 0x4 },
766 { 0x90070, 0x78 },
767 { 0x90071, 0x549 },
768 { 0x90072, 0x630 },
769 { 0x90073, 0x159 },
770 { 0x90074, 0xd49 },
771 { 0x90075, 0x630 },
772 { 0x90076, 0x159 },
773 { 0x90077, 0x94a },
774 { 0x90078, 0x630 },
775 { 0x90079, 0x159 },
776 { 0x9007a, 0x441 },
777 { 0x9007b, 0x630 },
778 { 0x9007c, 0x149 },
779 { 0x9007d, 0x42 },
780 { 0x9007e, 0x630 },
781 { 0x9007f, 0x149 },
782 { 0x90080, 0x1 },
783 { 0x90081, 0x630 },
784 { 0x90082, 0x149 },
785 { 0x90083, 0x0 },
786 { 0x90084, 0xe0 },
787 { 0x90085, 0x109 },
788 { 0x90086, 0xa },
789 { 0x90087, 0x10 },
790 { 0x90088, 0x109 },
791 { 0x90089, 0x9 },
792 { 0x9008a, 0x3c0 },
793 { 0x9008b, 0x149 },
794 { 0x9008c, 0x9 },
795 { 0x9008d, 0x3c0 },
796 { 0x9008e, 0x159 },
797 { 0x9008f, 0x18 },
798 { 0x90090, 0x10 },
799 { 0x90091, 0x109 },
800 { 0x90092, 0x0 },
801 { 0x90093, 0x3c0 },
802 { 0x90094, 0x109 },
803 { 0x90095, 0x18 },
804 { 0x90096, 0x4 },
805 { 0x90097, 0x48 },
806 { 0x90098, 0x18 },
807 { 0x90099, 0x4 },
808 { 0x9009a, 0x58 },
809 { 0x9009b, 0xa },
810 { 0x9009c, 0x10 },
811 { 0x9009d, 0x109 },
812 { 0x9009e, 0x2 },
813 { 0x9009f, 0x10 },
814 { 0x900a0, 0x109 },
815 { 0x900a1, 0x5 },
816 { 0x900a2, 0x7c0 },
817 { 0x900a3, 0x109 },
818 { 0x900a4, 0x10 },
819 { 0x900a5, 0x10 },
820 { 0x900a6, 0x109 },
821 { 0x40000, 0x811 },
822 { 0x40020, 0x880 },
823 { 0x40040, 0x0 },
824 { 0x40060, 0x0 },
825 { 0x40001, 0x4008 },
826 { 0x40021, 0x83 },
827 { 0x40041, 0x4f },
828 { 0x40061, 0x0 },
829 { 0x40002, 0x4040 },
830 { 0x40022, 0x83 },
831 { 0x40042, 0x51 },
832 { 0x40062, 0x0 },
833 { 0x40003, 0x811 },
834 { 0x40023, 0x880 },
835 { 0x40043, 0x0 },
836 { 0x40063, 0x0 },
837 { 0x40004, 0x720 },
838 { 0x40024, 0xf },
839 { 0x40044, 0x1740 },
840 { 0x40064, 0x0 },
841 { 0x40005, 0x16 },
842 { 0x40025, 0x83 },
843 { 0x40045, 0x4b },
844 { 0x40065, 0x0 },
845 { 0x40006, 0x716 },
846 { 0x40026, 0xf },
847 { 0x40046, 0x2001 },
848 { 0x40066, 0x0 },
849 { 0x40007, 0x716 },
850 { 0x40027, 0xf },
851 { 0x40047, 0x2800 },
852 { 0x40067, 0x0 },
853 { 0x40008, 0x716 },
854 { 0x40028, 0xf },
855 { 0x40048, 0xf00 },
856 { 0x40068, 0x0 },
857 { 0x40009, 0x720 },
858 { 0x40029, 0xf },
859 { 0x40049, 0x1400 },
860 { 0x40069, 0x0 },
861 { 0x4000a, 0xe08 },
862 { 0x4002a, 0xc15 },
863 { 0x4004a, 0x0 },
864 { 0x4006a, 0x0 },
865 { 0x4000b, 0x623 },
866 { 0x4002b, 0x15 },
867 { 0x4004b, 0x0 },
868 { 0x4006b, 0x0 },
869 { 0x4000c, 0x4028 },
870 { 0x4002c, 0x80 },
871 { 0x4004c, 0x0 },
872 { 0x4006c, 0x0 },
873 { 0x4000d, 0xe08 },
874 { 0x4002d, 0xc1a },
875 { 0x4004d, 0x0 },
876 { 0x4006d, 0x0 },
877 { 0x4000e, 0x623 },
878 { 0x4002e, 0x1a },
879 { 0x4004e, 0x0 },
880 { 0x4006e, 0x0 },
881 { 0x4000f, 0x4040 },
882 { 0x4002f, 0x80 },
883 { 0x4004f, 0x0 },
884 { 0x4006f, 0x0 },
885 { 0x40010, 0x2604 },
886 { 0x40030, 0x15 },
887 { 0x40050, 0x0 },
888 { 0x40070, 0x0 },
889 { 0x40011, 0x708 },
890 { 0x40031, 0x5 },
891 { 0x40051, 0x0 },
892 { 0x40071, 0x2002 },
893 { 0x40012, 0x8 },
894 { 0x40032, 0x80 },
895 { 0x40052, 0x0 },
896 { 0x40072, 0x0 },
897 { 0x40013, 0x2604 },
898 { 0x40033, 0x1a },
899 { 0x40053, 0x0 },
900 { 0x40073, 0x0 },
901 { 0x40014, 0x708 },
902 { 0x40034, 0xa },
903 { 0x40054, 0x0 },
904 { 0x40074, 0x2002 },
905 { 0x40015, 0x4040 },
906 { 0x40035, 0x80 },
907 { 0x40055, 0x0 },
908 { 0x40075, 0x0 },
909 { 0x40016, 0x60a },
910 { 0x40036, 0x15 },
911 { 0x40056, 0x1200 },
912 { 0x40076, 0x0 },
913 { 0x40017, 0x61a },
914 { 0x40037, 0x15 },
915 { 0x40057, 0x1300 },
916 { 0x40077, 0x0 },
917 { 0x40018, 0x60a },
918 { 0x40038, 0x1a },
919 { 0x40058, 0x1200 },
920 { 0x40078, 0x0 },
921 { 0x40019, 0x642 },
922 { 0x40039, 0x1a },
923 { 0x40059, 0x1300 },
924 { 0x40079, 0x0 },
925 { 0x4001a, 0x4808 },
926 { 0x4003a, 0x880 },
927 { 0x4005a, 0x0 },
928 { 0x4007a, 0x0 },
929 { 0x900a7, 0x0 },
930 { 0x900a8, 0x790 },
931 { 0x900a9, 0x11a },
932 { 0x900aa, 0x8 },
933 { 0x900ab, 0x7aa },
934 { 0x900ac, 0x2a },
935 { 0x900ad, 0x10 },
936 { 0x900ae, 0x7b2 },
937 { 0x900af, 0x2a },
938 { 0x900b0, 0x0 },
939 { 0x900b1, 0x7c8 },
940 { 0x900b2, 0x109 },
941 { 0x900b3, 0x10 },
942 { 0x900b4, 0x2a8 },
943 { 0x900b5, 0x129 },
944 { 0x900b6, 0x8 },
945 { 0x900b7, 0x370 },
946 { 0x900b8, 0x129 },
947 { 0x900b9, 0xa },
948 { 0x900ba, 0x3c8 },
949 { 0x900bb, 0x1a9 },
950 { 0x900bc, 0xc },
951 { 0x900bd, 0x408 },
952 { 0x900be, 0x199 },
953 { 0x900bf, 0x14 },
954 { 0x900c0, 0x790 },
955 { 0x900c1, 0x11a },
956 { 0x900c2, 0x8 },
957 { 0x900c3, 0x4 },
958 { 0x900c4, 0x18 },
959 { 0x900c5, 0xe },
960 { 0x900c6, 0x408 },
961 { 0x900c7, 0x199 },
962 { 0x900c8, 0x8 },
963 { 0x900c9, 0x8568 },
964 { 0x900ca, 0x108 },
965 { 0x900cb, 0x18 },
966 { 0x900cc, 0x790 },
967 { 0x900cd, 0x16a },
968 { 0x900ce, 0x8 },
969 { 0x900cf, 0x1d8 },
970 { 0x900d0, 0x169 },
971 { 0x900d1, 0x10 },
972 { 0x900d2, 0x8558 },
973 { 0x900d3, 0x168 },
974 { 0x900d4, 0x70 },
975 { 0x900d5, 0x788 },
976 { 0x900d6, 0x16a },
977 { 0x900d7, 0x1ff8 },
978 { 0x900d8, 0x85a8 },
979 { 0x900d9, 0x1e8 },
980 { 0x900da, 0x50 },
981 { 0x900db, 0x798 },
982 { 0x900dc, 0x16a },
983 { 0x900dd, 0x60 },
984 { 0x900de, 0x7a0 },
985 { 0x900df, 0x16a },
986 { 0x900e0, 0x8 },
987 { 0x900e1, 0x8310 },
988 { 0x900e2, 0x168 },
989 { 0x900e3, 0x8 },
990 { 0x900e4, 0xa310 },
991 { 0x900e5, 0x168 },
992 { 0x900e6, 0xa },
993 { 0x900e7, 0x408 },
994 { 0x900e8, 0x169 },
995 { 0x900e9, 0x6e },
996 { 0x900ea, 0x0 },
997 { 0x900eb, 0x68 },
998 { 0x900ec, 0x0 },
999 { 0x900ed, 0x408 },
1000 { 0x900ee, 0x169 },
1001 { 0x900ef, 0x0 },
1002 { 0x900f0, 0x8310 },
1003 { 0x900f1, 0x168 },
1004 { 0x900f2, 0x0 },
1005 { 0x900f3, 0xa310 },
1006 { 0x900f4, 0x168 },
1007 { 0x900f5, 0x1ff8 },
1008 { 0x900f6, 0x85a8 },
1009 { 0x900f7, 0x1e8 },
1010 { 0x900f8, 0x68 },
1011 { 0x900f9, 0x798 },
1012 { 0x900fa, 0x16a },
1013 { 0x900fb, 0x78 },
1014 { 0x900fc, 0x7a0 },
1015 { 0x900fd, 0x16a },
1016 { 0x900fe, 0x68 },
1017 { 0x900ff, 0x790 },
1018 { 0x90100, 0x16a },
1019 { 0x90101, 0x8 },
1020 { 0x90102, 0x8b10 },
1021 { 0x90103, 0x168 },
1022 { 0x90104, 0x8 },
1023 { 0x90105, 0xab10 },
1024 { 0x90106, 0x168 },
1025 { 0x90107, 0xa },
1026 { 0x90108, 0x408 },
1027 { 0x90109, 0x169 },
1028 { 0x9010a, 0x58 },
1029 { 0x9010b, 0x0 },
1030 { 0x9010c, 0x68 },
1031 { 0x9010d, 0x0 },
1032 { 0x9010e, 0x408 },
1033 { 0x9010f, 0x169 },
1034 { 0x90110, 0x0 },
1035 { 0x90111, 0x8b10 },
1036 { 0x90112, 0x168 },
1037 { 0x90113, 0x0 },
1038 { 0x90114, 0xab10 },
1039 { 0x90115, 0x168 },
1040 { 0x90116, 0x0 },
1041 { 0x90117, 0x1d8 },
1042 { 0x90118, 0x169 },
1043 { 0x90119, 0x80 },
1044 { 0x9011a, 0x790 },
1045 { 0x9011b, 0x16a },
1046 { 0x9011c, 0x18 },
1047 { 0x9011d, 0x7aa },
1048 { 0x9011e, 0x6a },
1049 { 0x9011f, 0xa },
1050 { 0x90120, 0x0 },
1051 { 0x90121, 0x1e9 },
1052 { 0x90122, 0x8 },
1053 { 0x90123, 0x8080 },
1054 { 0x90124, 0x108 },
1055 { 0x90125, 0xf },
1056 { 0x90126, 0x408 },
1057 { 0x90127, 0x169 },
1058 { 0x90128, 0xc },
1059 { 0x90129, 0x0 },
1060 { 0x9012a, 0x68 },
1061 { 0x9012b, 0x9 },
1062 { 0x9012c, 0x0 },
1063 { 0x9012d, 0x1a9 },
1064 { 0x9012e, 0x0 },
1065 { 0x9012f, 0x408 },
1066 { 0x90130, 0x169 },
1067 { 0x90131, 0x0 },
1068 { 0x90132, 0x8080 },
1069 { 0x90133, 0x108 },
1070 { 0x90134, 0x8 },
1071 { 0x90135, 0x7aa },
1072 { 0x90136, 0x6a },
1073 { 0x90137, 0x0 },
1074 { 0x90138, 0x8568 },
1075 { 0x90139, 0x108 },
1076 { 0x9013a, 0xb7 },
1077 { 0x9013b, 0x790 },
1078 { 0x9013c, 0x16a },
1079 { 0x9013d, 0x1f },
1080 { 0x9013e, 0x0 },
1081 { 0x9013f, 0x68 },
1082 { 0x90140, 0x8 },
1083 { 0x90141, 0x8558 },
1084 { 0x90142, 0x168 },
1085 { 0x90143, 0xf },
1086 { 0x90144, 0x408 },
1087 { 0x90145, 0x169 },
1088 { 0x90146, 0xc },
1089 { 0x90147, 0x0 },
1090 { 0x90148, 0x68 },
1091 { 0x90149, 0x0 },
1092 { 0x9014a, 0x408 },
1093 { 0x9014b, 0x169 },
1094 { 0x9014c, 0x0 },
1095 { 0x9014d, 0x8558 },
1096 { 0x9014e, 0x168 },
1097 { 0x9014f, 0x8 },
1098 { 0x90150, 0x3c8 },
1099 { 0x90151, 0x1a9 },
1100 { 0x90152, 0x3 },
1101 { 0x90153, 0x370 },
1102 { 0x90154, 0x129 },
1103 { 0x90155, 0x20 },
1104 { 0x90156, 0x2aa },
1105 { 0x90157, 0x9 },
1106 { 0x90158, 0x0 },
1107 { 0x90159, 0x400 },
1108 { 0x9015a, 0x10e },
1109 { 0x9015b, 0x8 },
1110 { 0x9015c, 0xe8 },
1111 { 0x9015d, 0x109 },
1112 { 0x9015e, 0x0 },
1113 { 0x9015f, 0x8140 },
1114 { 0x90160, 0x10c },
1115 { 0x90161, 0x10 },
1116 { 0x90162, 0x8138 },
1117 { 0x90163, 0x10c },
1118 { 0x90164, 0x8 },
1119 { 0x90165, 0x7c8 },
1120 { 0x90166, 0x101 },
1121 { 0x90167, 0x8 },
1122 { 0x90168, 0x0 },
1123 { 0x90169, 0x8 },
1124 { 0x9016a, 0x8 },
1125 { 0x9016b, 0x448 },
1126 { 0x9016c, 0x109 },
1127 { 0x9016d, 0xf },
1128 { 0x9016e, 0x7c0 },
1129 { 0x9016f, 0x109 },
1130 { 0x90170, 0x0 },
1131 { 0x90171, 0xe8 },
1132 { 0x90172, 0x109 },
1133 { 0x90173, 0x47 },
1134 { 0x90174, 0x630 },
1135 { 0x90175, 0x109 },
1136 { 0x90176, 0x8 },
1137 { 0x90177, 0x618 },
1138 { 0x90178, 0x109 },
1139 { 0x90179, 0x8 },
1140 { 0x9017a, 0xe0 },
1141 { 0x9017b, 0x109 },
1142 { 0x9017c, 0x0 },
1143 { 0x9017d, 0x7c8 },
1144 { 0x9017e, 0x109 },
1145 { 0x9017f, 0x8 },
1146 { 0x90180, 0x8140 },
1147 { 0x90181, 0x10c },
1148 { 0x90182, 0x0 },
1149 { 0x90183, 0x1 },
1150 { 0x90184, 0x8 },
1151 { 0x90185, 0x8 },
1152 { 0x90186, 0x4 },
1153 { 0x90187, 0x8 },
1154 { 0x90188, 0x8 },
1155 { 0x90189, 0x7c8 },
1156 { 0x9018a, 0x101 },
1157 { 0x90006, 0x0 },
1158 { 0x90007, 0x0 },
1159 { 0x90008, 0x8 },
1160 { 0x90009, 0x0 },
1161 { 0x9000a, 0x0 },
1162 { 0x9000b, 0x0 },
1163 { 0xd00e7, 0x400 },
1164 { 0x90017, 0x0 },
1165 { 0x9001f, 0x2a },
1166 { 0x90026, 0x6a },
1167 { 0x400d0, 0x0 },
1168 { 0x400d1, 0x101 },
1169 { 0x400d2, 0x105 },
1170 { 0x400d3, 0x107 },
1171 { 0x400d4, 0x10f },
1172 { 0x400d5, 0x202 },
1173 { 0x400d6, 0x20a },
1174 { 0x400d7, 0x20b },
1175 { 0x2003a, 0x2 },
1176 { 0x2000b, 0x64 },
1177 { 0x2000c, 0xc8 },
1178 { 0x2000d, 0x7d0 },
1179 { 0x2000e, 0x2c },
1180 { 0x12000b, 0xc },
1181 { 0x12000c, 0x19 },
1182 { 0x12000d, 0xfa },
1183 { 0x12000e, 0x10 },
1184 { 0x22000b, 0x3 },
1185 { 0x22000c, 0x6 },
1186 { 0x22000d, 0x3e },
1187 { 0x22000e, 0x10 },
1188 { 0x9000c, 0x0 },
1189 { 0x9000d, 0x173 },
1190 { 0x9000e, 0x60 },
1191 { 0x9000f, 0x6110 },
1192 { 0x90010, 0x2152 },
1193 { 0x90011, 0xdfbd },
1194 { 0x90012, 0x60 },
1195 { 0x90013, 0x6152 },
1196 { 0x20010, 0x5a },
1197 { 0x20011, 0x3 },
1198 { 0x40080, 0xe0 },
1199 { 0x40081, 0x12 },
1200 { 0x40082, 0xe0 },
1201 { 0x40083, 0x12 },
1202 { 0x40084, 0xe0 },
1203 { 0x40085, 0x12 },
1204 { 0x140080, 0xe0 },
1205 { 0x140081, 0x12 },
1206 { 0x140082, 0xe0 },
1207 { 0x140083, 0x12 },
1208 { 0x140084, 0xe0 },
1209 { 0x140085, 0x12 },
1210 { 0x240080, 0xe0 },
1211 { 0x240081, 0x12 },
1212 { 0x240082, 0xe0 },
1213 { 0x240083, 0x12 },
1214 { 0x240084, 0xe0 },
1215 { 0x240085, 0x12 },
1216 { 0x400fd, 0xf },
1217 { 0x10011, 0x1 },
1218 { 0x10012, 0x1 },
1219 { 0x10013, 0x180 },
1220 { 0x10018, 0x1 },
1221 { 0x10002, 0x6209 },
1222 { 0x100b2, 0x1 },
1223 { 0x101b4, 0x1 },
1224 { 0x102b4, 0x1 },
1225 { 0x103b4, 0x1 },
1226 { 0x104b4, 0x1 },
1227 { 0x105b4, 0x1 },
1228 { 0x106b4, 0x1 },
1229 { 0x107b4, 0x1 },
1230 { 0x108b4, 0x1 },
1231 { 0x11011, 0x1 },
1232 { 0x11012, 0x1 },
1233 { 0x11013, 0x180 },
1234 { 0x11018, 0x1 },
1235 { 0x11002, 0x6209 },
1236 { 0x110b2, 0x1 },
1237 { 0x111b4, 0x1 },
1238 { 0x112b4, 0x1 },
1239 { 0x113b4, 0x1 },
1240 { 0x114b4, 0x1 },
1241 { 0x115b4, 0x1 },
1242 { 0x116b4, 0x1 },
1243 { 0x117b4, 0x1 },
1244 { 0x118b4, 0x1 },
1245 { 0x12011, 0x1 },
1246 { 0x12012, 0x1 },
1247 { 0x12013, 0x180 },
1248 { 0x12018, 0x1 },
1249 { 0x12002, 0x6209 },
1250 { 0x120b2, 0x1 },
1251 { 0x121b4, 0x1 },
1252 { 0x122b4, 0x1 },
1253 { 0x123b4, 0x1 },
1254 { 0x124b4, 0x1 },
1255 { 0x125b4, 0x1 },
1256 { 0x126b4, 0x1 },
1257 { 0x127b4, 0x1 },
1258 { 0x128b4, 0x1 },
1259 { 0x13011, 0x1 },
1260 { 0x13012, 0x1 },
1261 { 0x13013, 0x180 },
1262 { 0x13018, 0x1 },
1263 { 0x13002, 0x6209 },
1264 { 0x130b2, 0x1 },
1265 { 0x131b4, 0x1 },
1266 { 0x132b4, 0x1 },
1267 { 0x133b4, 0x1 },
1268 { 0x134b4, 0x1 },
1269 { 0x135b4, 0x1 },
1270 { 0x136b4, 0x1 },
1271 { 0x137b4, 0x1 },
1272 { 0x138b4, 0x1 },
1273 { 0x2003a, 0x2 },
1274 { 0xc0080, 0x2 },
1275 { 0xd0000, 0x1 },
1276};
1277
1278struct dram_fsp_msg lpddr4_dram_fsp_msg[] = {
1279 {
1280 /* P0 3200mts 1D */
1281 .drate = 3200,
1282 .fw_type = FW_1D_IMAGE,
1283 .fsp_cfg = lpddr4_fsp0_cfg,
1284 .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp0_cfg),
1285 },
1286 {
1287 /* P1 400mts 1D */
1288 .drate = 400,
1289 .fw_type = FW_1D_IMAGE,
1290 .fsp_cfg = lpddr4_fsp1_cfg,
1291 .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp1_cfg),
1292 },
1293 {
1294 /* P1 100mts 1D */
1295 .drate = 100,
1296 .fw_type = FW_1D_IMAGE,
1297 .fsp_cfg = lpddr4_fsp2_cfg,
1298 .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp2_cfg),
1299 },
1300 {
1301 /* P0 3200mts 2D */
1302 .drate = 3200,
1303 .fw_type = FW_2D_IMAGE,
1304 .fsp_cfg = lpddr4_fsp0_2d_cfg,
1305 .fsp_cfg_num = ARRAY_SIZE(lpddr4_fsp0_2d_cfg),
1306 },
1307};
1308
1309/* lpddr4 timing config params on EVK board */
1310struct dram_timing_info dram_timing = {
1311 .ddrc_cfg = lpddr4_ddrc_cfg,
1312 .ddrc_cfg_num = ARRAY_SIZE(lpddr4_ddrc_cfg),
1313 .ddrphy_cfg = lpddr4_ddrphy_cfg,
1314 .ddrphy_cfg_num = ARRAY_SIZE(lpddr4_ddrphy_cfg),
1315 .fsp_msg = lpddr4_dram_fsp_msg,
1316 .fsp_msg_num = ARRAY_SIZE(lpddr4_dram_fsp_msg),
1317 .ddrphy_pie = lpddr4_phy_pie,
1318 .ddrphy_pie_num = ARRAY_SIZE(lpddr4_phy_pie),
1319 .fsp_table = { 3200, 400, 100, },
1320};