• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2015-2020, Renesas Electronics Corporation.
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #define BOARDNUM 22
9 #define BOARD_JUDGE_AUTO
10 
11 #ifdef BOARD_JUDGE_AUTO
12 static uint32_t _board_judge(void);
13 
boardcnf_get_brd_type(void)14 static uint32_t boardcnf_get_brd_type(void)
15 {
16 	return _board_judge();
17 }
18 #else
boardcnf_get_brd_type(void)19 static uint32_t boardcnf_get_brd_type(void)
20 {
21 	return 1;
22 }
23 #endif
24 
25 #define DDR_FAST_INIT
26 
27 struct _boardcnf_ch {
28 	uint8_t ddr_density[CS_CNT];
29 	uint64_t ca_swap;
30 	uint16_t dqs_swap;
31 	uint32_t dq_swap[SLICE_CNT];
32 	uint8_t dm_swap[SLICE_CNT];
33 	uint16_t wdqlvl_patt[16];
34 	int8_t cacs_adj[16];
35 	int8_t dm_adj_w[SLICE_CNT];
36 	int8_t dq_adj_w[SLICE_CNT * 8];
37 	int8_t dm_adj_r[SLICE_CNT];
38 	int8_t dq_adj_r[SLICE_CNT * 8];
39 };
40 
41 struct _boardcnf {
42 	uint8_t phyvalid;
43 	uint8_t dbi_en;
44 	uint16_t cacs_dly;
45 	int16_t cacs_dly_adj;
46 	uint16_t dqdm_dly_w;
47 	uint16_t dqdm_dly_r;
48 	struct _boardcnf_ch ch[DRAM_CH_CNT];
49 };
50 
51 #define WDQLVL_PAT {\
52 	0x00AA,\
53 	0x0055,\
54 	0x00AA,\
55 	0x0155,\
56 	0x01CC,\
57 	0x0133,\
58 	0x00CC,\
59 	0x0033,\
60 	0x00F0,\
61 	0x010F,\
62 	0x01F0,\
63 	0x010F,\
64 	0x00F0,\
65 	0x00F0,\
66 	0x000F,\
67 	0x010F}
68 
69 static const struct _boardcnf boardcnfs[BOARDNUM] = {
70 	{
71 /* boardcnf[0] RENESAS SALVATOR-X board with M3-W/SIP */
72 	 .phyvalid = 0x03,
73 	 .dbi_en = 0x01,
74 	 .cacs_dly = 0x02c0,
75 	 .cacs_dly_adj = 0,
76 	 .dqdm_dly_w = 0x0300,
77 	 .dqdm_dly_r = 0x00a0,
78 	 .ch = {
79 		{
80 		 {0x02, 0x02},
81 		 0x00543210U,
82 		 0x3201U,
83 		 {0x70612543, 0x43251670, 0x45326170, 0x10672534},
84 		 {0x08, 0x08, 0x08, 0x08},
85 		 WDQLVL_PAT,
86 		 {0, 0, 0, 0, 0, 0, 0, 0,
87 		  0, 0},
88 		 {0, 0, 0, 0},
89 		 {0, 0, 0, 0, 0, 0, 0, 0,
90 		  0, 0, 0, 0, 0, 0, 0, 0,
91 		  0, 0, 0, 0, 0, 0, 0, 0,
92 		  0, 0, 0, 0, 0, 0, 0, 0},
93 		 {0, 0, 0, 0},
94 		 {0, 0, 0, 0, 0, 0, 0, 0,
95 		  0, 0, 0, 0, 0, 0, 0, 0,
96 		  0, 0, 0, 0, 0, 0, 0, 0,
97 		  0, 0, 0, 0, 0, 0, 0, 0}
98 		 },
99 
100 		{
101 		 {0x02, 0x02},
102 		 0x00543210,
103 		 0x2310,
104 		 {0x01327654, 0x34526107, 0x35421670, 0x70615324},
105 		 {0x08, 0x08, 0x08, 0x08},
106 		 WDQLVL_PAT,
107 		 {0, 0, 0, 0, 0, 0, 0, 0,
108 		  0, 0},
109 		 {0, 0, 0, 0},
110 		 {0, 0, 0, 0, 0, 0, 0, 0,
111 		  0, 0, 0, 0, 0, 0, 0, 0,
112 		  0, 0, 0, 0, 0, 0, 0, 0,
113 		  0, 0, 0, 0, 0, 0, 0, 0},
114 		 {0, 0, 0, 0},
115 		 {0, 0, 0, 0, 0, 0, 0, 0,
116 		  0, 0, 0, 0, 0, 0, 0, 0,
117 		  0, 0, 0, 0, 0, 0, 0, 0,
118 		  0, 0, 0, 0, 0, 0, 0, 0}
119 		}
120 		}
121 	 },
122 /* boardcnf[1] RENESAS KRIEK board with M3-W/SoC */
123 	{
124 	 0x03,
125 	 0x01,
126 	 0x2c0,
127 	 0,
128 	 0x300,
129 	 0x0a0,
130 	{
131 	{
132 	   {0x02, 0x02},
133 	   0x00345201,
134 	   0x3201,
135 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
136 	   {0x08, 0x08, 0x08, 0x08},
137 	   WDQLVL_PAT,
138 	   {0, 0, 0, 0, 0, 0, 0, 0,
139 	    0, 0},
140 	   {0, 0, 0, 0},
141 	   {0, 0, 0, 0, 0, 0, 0, 0,
142 	    0, 0, 0, 0, 0, 0, 0, 0,
143 	    0, 0, 0, 0, 0, 0, 0, 0,
144 	    0, 0, 0, 0, 0, 0, 0, 0},
145 	   {0, 0, 0, 0},
146 	   {0, 0, 0, 0, 0, 0, 0, 0,
147 	    0, 0, 0, 0, 0, 0, 0, 0,
148 	    0, 0, 0, 0, 0, 0, 0, 0,
149 	    0, 0, 0, 0, 0, 0, 0, 0}
150 	   },
151 	{
152 	   {0x02, 0x02},
153 	   0x00302154,
154 	   0x2310,
155 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
156 	   {0x08, 0x08, 0x08, 0x08},
157 	   WDQLVL_PAT,
158 	   {0, 0, 0, 0, 0, 0, 0, 0,
159 	    0, 0},
160 	   {0, 0, 0, 0},
161 	   {0, 0, 0, 0, 0, 0, 0, 0,
162 	    0, 0, 0, 0, 0, 0, 0, 0,
163 	    0, 0, 0, 0, 0, 0, 0, 0,
164 	    0, 0, 0, 0, 0, 0, 0, 0},
165 	   {0, 0, 0, 0},
166 	   {0, 0, 0, 0, 0, 0, 0, 0,
167 	    0, 0, 0, 0, 0, 0, 0, 0,
168 	    0, 0, 0, 0, 0, 0, 0, 0,
169 	    0, 0, 0, 0, 0, 0, 0, 0}
170 	}
171 	}
172 	 },
173 /* boardcnf[2] RENESAS SALVATOR-X board with H3 Ver.1.x/SIP(8Gbit 1rank) */
174 	{
175 	 0x0f,
176 	 0x00,
177 	 0x300,
178 	 -320,
179 	 0x300,
180 	 0x0a0,
181 	{
182 	{
183 	   {0x02, 0xff},
184 	   0x00543210,
185 	   0x3210,
186 	   {0x20741365, 0x34256107, 0x57460321, 0x70614532},
187 	   {0x08, 0x08, 0x08, 0x08},
188 	   WDQLVL_PAT,
189 	   {0, 0, 0, 0, 0, 0, 0, 0,
190 	    0, 0},
191 	   {0, 0, 0, 0},
192 	   {0, 0, 0, 0, 0, 0, 0, 0,
193 	    0, 0, 0, 0, 0, 0, 0, 0,
194 	    0, 0, 0, 0, 0, 0, 0, 0,
195 	    0, 0, 0, 0, 0, 0, 0, 0},
196 	   {0, 0, 0, 0},
197 	   {0, 0, 0, 0, 0, 0, 0, 0,
198 	    0, 0, 0, 0, 0, 0, 0, 0,
199 	    0, 0, 0, 0, 0, 0, 0, 0,
200 	    0, 0, 0, 0, 0, 0, 0, 0}
201 	   },
202 	{
203 	   {0x02, 0xff},
204 	   0x00543210,
205 	   0x3102,
206 	   {0x23547610, 0x34526107, 0x67452310, 0x32106754},
207 	   {0x08, 0x08, 0x08, 0x08},
208 	   WDQLVL_PAT,
209 	   {0, 0, 0, 0, 0, 0, 0, 0,
210 	    0, 0},
211 	   {0, 0, 0, 0},
212 	   {0, 0, 0, 0, 0, 0, 0, 0,
213 	    0, 0, 0, 0, 0, 0, 0, 0,
214 	    0, 0, 0, 0, 0, 0, 0, 0,
215 	    0, 0, 0, 0, 0, 0, 0, 0},
216 	   {0, 0, 0, 0},
217 	   {0, 0, 0, 0, 0, 0, 0, 0,
218 	    0, 0, 0, 0, 0, 0, 0, 0,
219 	    0, 0, 0, 0, 0, 0, 0, 0,
220 	    0, 0, 0, 0, 0, 0, 0, 0}
221 	   },
222 	{
223 	   {0x02, 0xff},
224 	   0x00543210,
225 	   0x0213,
226 	   {0x30216754, 0x67453210, 0x70165243, 0x07162345},
227 	   {0x08, 0x08, 0x08, 0x08},
228 	   WDQLVL_PAT,
229 	   {0, 0, 0, 0, 0, 0, 0, 0,
230 	    0, 0},
231 	   {0, 0, 0, 0},
232 	   {0, 0, 0, 0, 0, 0, 0, 0,
233 	    0, 0, 0, 0, 0, 0, 0, 0,
234 	    0, 0, 0, 0, 0, 0, 0, 0,
235 	    0, 0, 0, 0, 0, 0, 0, 0},
236 	   {0, 0, 0, 0},
237 	   {0, 0, 0, 0, 0, 0, 0, 0,
238 	    0, 0, 0, 0, 0, 0, 0, 0,
239 	    0, 0, 0, 0, 0, 0, 0, 0,
240 	    0, 0, 0, 0, 0, 0, 0, 0}
241 	   },
242 	{
243 	   {0x02, 0xff},
244 	   0x00543210,
245 	   0x0213,
246 	   {0x01327654, 0x70615432, 0x54760123, 0x07162345},
247 	   {0x08, 0x08, 0x08, 0x08},
248 	   WDQLVL_PAT,
249 	   {0, 0, 0, 0, 0, 0, 0, 0,
250 	    0, 0},
251 	   {0, 0, 0, 0},
252 	   {0, 0, 0, 0, 0, 0, 0, 0,
253 	    0, 0, 0, 0, 0, 0, 0, 0,
254 	    0, 0, 0, 0, 0, 0, 0, 0,
255 	    0, 0, 0, 0, 0, 0, 0, 0},
256 	   {0, 0, 0, 0},
257 	   {0, 0, 0, 0, 0, 0, 0, 0,
258 	    0, 0, 0, 0, 0, 0, 0, 0,
259 	    0, 0, 0, 0, 0, 0, 0, 0,
260 	    0, 0, 0, 0, 0, 0, 0, 0}
261 	}
262 	}
263 	 },
264 /* boardcnf[3] RENESAS Starter Kit board with M3-W/SIP(8Gbit 1rank) */
265 	{
266 	 0x03,
267 	 0x01,
268 	 0x02c0,
269 	 0,
270 	 0x0300,
271 	 0x00a0,
272 	{
273 	{
274 	   {0x02, 0xFF},
275 	   0x00543210U,
276 	   0x3201,
277 	   {0x70612543, 0x43251670, 0x45326170, 0x10672534},
278 	   {0x08, 0x08, 0x08, 0x08},
279 	   WDQLVL_PAT,
280 	   {0, 0, 0, 0, 0, 0, 0, 0,
281 	    0, 0},
282 	   {0, 0, 0, 0},
283 	   {0, 0, 0, 0, 0, 0, 0, 0,
284 	    0, 0, 0, 0, 0, 0, 0, 0,
285 	    0, 0, 0, 0, 0, 0, 0, 0,
286 	    0, 0, 0, 0, 0, 0, 0, 0},
287 	   {0, 0, 0, 0},
288 	   {0, 0, 0, 0, 0, 0, 0, 0,
289 	    0, 0, 0, 0, 0, 0, 0, 0,
290 	    0, 0, 0, 0, 0, 0, 0, 0,
291 	    0, 0, 0, 0, 0, 0, 0, 0}
292 	   },
293 	{
294 	   {0x02, 0xFF},
295 	   0x00543210,
296 	   0x2310,
297 	   {0x01327654, 0x34526107, 0x35421670, 0x70615324},
298 	   {0x08, 0x08, 0x08, 0x08},
299 	   WDQLVL_PAT,
300 	   {0, 0, 0, 0, 0, 0, 0, 0,
301 	    0, 0},
302 	   {0, 0, 0, 0},
303 	   {0, 0, 0, 0, 0, 0, 0, 0,
304 	    0, 0, 0, 0, 0, 0, 0, 0,
305 	    0, 0, 0, 0, 0, 0, 0, 0,
306 	    0, 0, 0, 0, 0, 0, 0, 0},
307 	   {0, 0, 0, 0},
308 	   {0, 0, 0, 0, 0, 0, 0, 0,
309 	    0, 0, 0, 0, 0, 0, 0, 0,
310 	    0, 0, 0, 0, 0, 0, 0, 0,
311 	    0, 0, 0, 0, 0, 0, 0, 0}
312 	}
313 	}
314 	 },
315 /* boardcnf[4] RENESAS SALVATOR-M(1rank) board with H3 Ver.1.x/SoC */
316 	{
317 	 0x0f,
318 	 0x00,
319 	 0x2c0,
320 	 -320,
321 	 0x300,
322 	 0x0a0,
323 	{
324 	{
325 	   {0x02, 0xff},
326 	   0x00315024,
327 	   0x3120,
328 	   {0x30671254, 0x26541037, 0x17054623, 0x12307645},
329 	   {0x08, 0x08, 0x08, 0x08},
330 	   WDQLVL_PAT,
331 	   {0, 0, 0, 0, 0, 0, 0, 0,
332 	    0, 0},
333 	   {0, 0, 0, 0},
334 	   {0, 0, 0, 0, 0, 0, 0, 0,
335 	    0, 0, 0, 0, 0, 0, 0, 0,
336 	    0, 0, 0, 0, 0, 0, 0, 0,
337 	    0, 0, 0, 0, 0, 0, 0, 0},
338 	   {0, 0, 0, 0},
339 	   {0, 0, 0, 0, 0, 0, 0, 0,
340 	    0, 0, 0, 0, 0, 0, 0, 0,
341 	    0, 0, 0, 0, 0, 0, 0, 0,
342 	    0, 0, 0, 0, 0, 0, 0, 0}
343 	   },
344 	{
345 	   {0x02, 0xff},
346 	   0x00025143,
347 	   0x3210,
348 	   {0x70613542, 0x16245307, 0x30712645, 0x21706354},
349 	   {0x08, 0x08, 0x08, 0x08},
350 	   WDQLVL_PAT,
351 	   {0, 0, 0, 0, 0, 0, 0, 0,
352 	    0, 0},
353 	   {0, 0, 0, 0},
354 	   {0, 0, 0, 0, 0, 0, 0, 0,
355 	    0, 0, 0, 0, 0, 0, 0, 0,
356 	    0, 0, 0, 0, 0, 0, 0, 0,
357 	    0, 0, 0, 0, 0, 0, 0, 0},
358 	   {0, 0, 0, 0},
359 	   {0, 0, 0, 0, 0, 0, 0, 0,
360 	    0, 0, 0, 0, 0, 0, 0, 0,
361 	    0, 0, 0, 0, 0, 0, 0, 0,
362 	    0, 0, 0, 0, 0, 0, 0, 0}
363 	   },
364 	{
365 	   {0x02, 0xff},
366 	   0x00523104,
367 	   0x2301,
368 	   {0x70613542, 0x16245307, 0x30712645, 0x21706354},
369 	   {0x08, 0x08, 0x08, 0x08},
370 	   WDQLVL_PAT,
371 	   {0, 0, 0, 0, 0, 0, 0, 0,
372 	    0, 0},
373 	   {0, 0, 0, 0},
374 	   {0, 0, 0, 0, 0, 0, 0, 0,
375 	    0, 0, 0, 0, 0, 0, 0, 0,
376 	    0, 0, 0, 0, 0, 0, 0, 0,
377 	    0, 0, 0, 0, 0, 0, 0, 0},
378 	   {0, 0, 0, 0},
379 	   {0, 0, 0, 0, 0, 0, 0, 0,
380 	    0, 0, 0, 0, 0, 0, 0, 0,
381 	    0, 0, 0, 0, 0, 0, 0, 0,
382 	    0, 0, 0, 0, 0, 0, 0, 0}
383 	   },
384 	{
385 	   {0x02, 0xff},
386 	   0x00153402,
387 	   0x2031,
388 	   {0x30671254, 0x26541037, 0x17054623, 0x12307645},
389 	   {0x08, 0x08, 0x08, 0x08},
390 	   WDQLVL_PAT,
391 	   {0, 0, 0, 0, 0, 0, 0, 0,
392 	    0, 0},
393 	   {0, 0, 0, 0},
394 	   {0, 0, 0, 0, 0, 0, 0, 0,
395 	    0, 0, 0, 0, 0, 0, 0, 0,
396 	    0, 0, 0, 0, 0, 0, 0, 0,
397 	    0, 0, 0, 0, 0, 0, 0, 0},
398 	   {0, 0, 0, 0},
399 	   {0, 0, 0, 0, 0, 0, 0, 0,
400 	    0, 0, 0, 0, 0, 0, 0, 0,
401 	    0, 0, 0, 0, 0, 0, 0, 0,
402 	    0, 0, 0, 0, 0, 0, 0, 0}
403 	}
404 	}
405 	 },
406 /* boardcnf[5] RENESAS KRIEK-1rank board with M3-W/SoC */
407 	{
408 	 0x03,
409 	 0x01,
410 	 0x2c0,
411 	 0,
412 	 0x300,
413 	 0x0a0,
414 	{
415 	{
416 	   {0x02, 0xff},
417 	   0x00345201,
418 	   0x3201,
419 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
420 	   {0x08, 0x08, 0x08, 0x08},
421 	   WDQLVL_PAT,
422 	   {0, 0, 0, 0, 0, 0, 0, 0,
423 	    0, 0},
424 	   {0, 0, 0, 0},
425 	   {0, 0, 0, 0, 0, 0, 0, 0,
426 	    0, 0, 0, 0, 0, 0, 0, 0,
427 	    0, 0, 0, 0, 0, 0, 0, 0,
428 	    0, 0, 0, 0, 0, 0, 0, 0},
429 	   {0, 0, 0, 0},
430 	   {0, 0, 0, 0, 0, 0, 0, 0,
431 	    0, 0, 0, 0, 0, 0, 0, 0,
432 	    0, 0, 0, 0, 0, 0, 0, 0,
433 	    0, 0, 0, 0, 0, 0, 0, 0}
434 	   },
435 	{
436 	   {0x02, 0xff},
437 	   0x00302154,
438 	   0x2310,
439 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
440 	   {0x08, 0x08, 0x08, 0x08},
441 	   WDQLVL_PAT,
442 	   {0, 0, 0, 0, 0, 0, 0, 0,
443 	    0, 0},
444 	   {0, 0, 0, 0},
445 	   {0, 0, 0, 0, 0, 0, 0, 0,
446 	    0, 0, 0, 0, 0, 0, 0, 0,
447 	    0, 0, 0, 0, 0, 0, 0, 0,
448 	    0, 0, 0, 0, 0, 0, 0, 0},
449 	   {0, 0, 0, 0},
450 	   {0, 0, 0, 0, 0, 0, 0, 0,
451 	    0, 0, 0, 0, 0, 0, 0, 0,
452 	    0, 0, 0, 0, 0, 0, 0, 0,
453 	    0, 0, 0, 0, 0, 0, 0, 0}
454 	}
455 	}
456 	 },
457 /* boardcnf[6] RENESAS SALVATOR-X board with H3 Ver.1.x/SIP(8Gbit 2rank) */
458 	{
459 	 0x0f,
460 	 0x00,
461 	 0x300,
462 	 -320,
463 	 0x300,
464 	 0x0a0,
465 	{
466 	{
467 	   {0x02, 0x02},
468 	   0x00543210,
469 	   0x3210,
470 	   {0x20741365, 0x34256107, 0x57460321, 0x70614532},
471 	   {0x08, 0x08, 0x08, 0x08},
472 	   WDQLVL_PAT,
473 	   {0, 0, 0, 0, 0, 0, 0, 0,
474 	    0, 0},
475 	   {0, 0, 0, 0},
476 	   {0, 0, 0, 0, 0, 0, 0, 0,
477 	    0, 0, 0, 0, 0, 0, 0, 0,
478 	    0, 0, 0, 0, 0, 0, 0, 0,
479 	    0, 0, 0, 0, 0, 0, 0, 0},
480 	   {0, 0, 0, 0},
481 	   {0, 0, 0, 0, 0, 0, 0, 0,
482 	    0, 0, 0, 0, 0, 0, 0, 0,
483 	    0, 0, 0, 0, 0, 0, 0, 0,
484 	    0, 0, 0, 0, 0, 0, 0, 0}
485 	   },
486 	{
487 	   {0x02, 0x02},
488 	   0x00543210,
489 	   0x3102,
490 	   {0x23547610, 0x34526107, 0x67452310, 0x32106754},
491 	   {0x08, 0x08, 0x08, 0x08},
492 	   WDQLVL_PAT,
493 	   {0, 0, 0, 0, 0, 0, 0, 0,
494 	    0, 0},
495 	   {0, 0, 0, 0},
496 	   {0, 0, 0, 0, 0, 0, 0, 0,
497 	    0, 0, 0, 0, 0, 0, 0, 0,
498 	    0, 0, 0, 0, 0, 0, 0, 0,
499 	    0, 0, 0, 0, 0, 0, 0, 0},
500 	   {0, 0, 0, 0},
501 	   {0, 0, 0, 0, 0, 0, 0, 0,
502 	    0, 0, 0, 0, 0, 0, 0, 0,
503 	    0, 0, 0, 0, 0, 0, 0, 0,
504 	    0, 0, 0, 0, 0, 0, 0, 0}
505 	   },
506 	{
507 	   {0x02, 0x02},
508 	   0x00543210,
509 	   0x0213,
510 	   {0x30216754, 0x67453210, 0x70165243, 0x07162345},
511 	   {0x08, 0x08, 0x08, 0x08},
512 	   WDQLVL_PAT,
513 	   {0, 0, 0, 0, 0, 0, 0, 0,
514 	    0, 0},
515 	   {0, 0, 0, 0},
516 	   {0, 0, 0, 0, 0, 0, 0, 0,
517 	    0, 0, 0, 0, 0, 0, 0, 0,
518 	    0, 0, 0, 0, 0, 0, 0, 0,
519 	    0, 0, 0, 0, 0, 0, 0, 0},
520 	   {0, 0, 0, 0},
521 	   {0, 0, 0, 0, 0, 0, 0, 0,
522 	    0, 0, 0, 0, 0, 0, 0, 0,
523 	    0, 0, 0, 0, 0, 0, 0, 0,
524 	    0, 0, 0, 0, 0, 0, 0, 0}
525 	   },
526 	{
527 	   {0x02, 0x02},
528 	   0x00543210,
529 	   0x0213,
530 	   {0x01327654, 0x70615432, 0x54760123, 0x07162345},
531 	   {0x08, 0x08, 0x08, 0x08},
532 	   WDQLVL_PAT,
533 	   {0, 0, 0, 0, 0, 0, 0, 0,
534 	    0, 0},
535 	   {0, 0, 0, 0},
536 	   {0, 0, 0, 0, 0, 0, 0, 0,
537 	    0, 0, 0, 0, 0, 0, 0, 0,
538 	    0, 0, 0, 0, 0, 0, 0, 0,
539 	    0, 0, 0, 0, 0, 0, 0, 0},
540 	   {0, 0, 0, 0},
541 	   {0, 0, 0, 0, 0, 0, 0, 0,
542 	    0, 0, 0, 0, 0, 0, 0, 0,
543 	    0, 0, 0, 0, 0, 0, 0, 0,
544 	    0, 0, 0, 0, 0, 0, 0, 0}
545 	}
546 	}
547 	 },
548 /*
549  * boardcnf[7] RENESAS SALVATOR-X board with
550  * H3 Ver.2.0 or later/SIP(8Gbit 1rank)
551  */
552 	{
553 	 0x0f,
554 	 0x01,
555 	 0x300,
556 	 0,
557 	 0x300,
558 	 0x0a0,
559 	{
560 	{
561 	   {0x02, 0xff},
562 	   0x00543210,
563 	   0x2310,
564 	   {0x70631425, 0x34527016, 0x43527610, 0x32104567},
565 	   {0x08, 0x08, 0x08, 0x08},
566 	   WDQLVL_PAT,
567 	   {0, 0, 0, 0, 0, 0, 0, 0,
568 	    0, 0},
569 	   {0, 0, 0, 0},
570 	   {0, 0, 0, 0, 0, 0, 0, 0,
571 	    0, 0, 0, 0, 0, 0, 0, 0,
572 	    0, 0, 0, 0, 0, 0, 0, 0,
573 	    0, 0, 0, 0, 0, 0, 0, 0},
574 	   {0, 0, 0, 0},
575 	   {0, 0, 0, 0, 0, 0, 0, 0,
576 	    0, 0, 0, 0, 0, 0, 0, 0,
577 	    0, 0, 0, 0, 0, 0, 0, 0,
578 	    0, 0, 0, 0, 0, 0, 0, 0}
579 	   },
580 	{
581 	   {0x02, 0xff},
582 	   0x00105432,
583 	   0x3210,
584 	   {0x43256107, 0x07162354, 0x10234567, 0x01235467},
585 	   {0x08, 0x08, 0x08, 0x08},
586 	   WDQLVL_PAT,
587 	   {0, 0, 0, 0, 0, 0, 0, 0,
588 	    0, 0},
589 	   {0, 0, 0, 0},
590 	   {0, 0, 0, 0, 0, 0, 0, 0,
591 	    0, 0, 0, 0, 0, 0, 0, 0,
592 	    0, 0, 0, 0, 0, 0, 0, 0,
593 	    0, 0, 0, 0, 0, 0, 0, 0},
594 	   {0, 0, 0, 0},
595 	   {0, 0, 0, 0, 0, 0, 0, 0,
596 	    0, 0, 0, 0, 0, 0, 0, 0,
597 	    0, 0, 0, 0, 0, 0, 0, 0,
598 	    0, 0, 0, 0, 0, 0, 0, 0}
599 	   },
600 	{
601 	   {0x02, 0xff},
602 	   0x00543210,
603 	   0x2301,
604 	   {0x01327654, 0x02316457, 0x10234567, 0x01325467},
605 	   {0x08, 0x08, 0x08, 0x08},
606 	   WDQLVL_PAT,
607 	   {0, 0, 0, 0, 0, 0, 0, 0,
608 	    0, 0},
609 	   {0, 0, 0, 0},
610 	   {0, 0, 0, 0, 0, 0, 0, 0,
611 	    0, 0, 0, 0, 0, 0, 0, 0,
612 	    0, 0, 0, 0, 0, 0, 0, 0,
613 	    0, 0, 0, 0, 0, 0, 0, 0},
614 	   {0, 0, 0, 0},
615 	   {0, 0, 0, 0, 0, 0, 0, 0,
616 	    0, 0, 0, 0, 0, 0, 0, 0,
617 	    0, 0, 0, 0, 0, 0, 0, 0,
618 	    0, 0, 0, 0, 0, 0, 0, 0}
619 	   },
620 	{
621 	   {0x02, 0xff},
622 	   0x00543210,
623 	   0x2301,
624 	   {0x12034765, 0x23105467, 0x23017645, 0x32106745},
625 	   {0x08, 0x08, 0x08, 0x08},
626 	   WDQLVL_PAT,
627 	   {0, 0, 0, 0, 0, 0, 0, 0,
628 	    0, 0},
629 	   {0, 0, 0, 0},
630 	   {0, 0, 0, 0, 0, 0, 0, 0,
631 	    0, 0, 0, 0, 0, 0, 0, 0,
632 	    0, 0, 0, 0, 0, 0, 0, 0,
633 	    0, 0, 0, 0, 0, 0, 0, 0},
634 	   {0, 0, 0, 0},
635 	   {0, 0, 0, 0, 0, 0, 0, 0,
636 	    0, 0, 0, 0, 0, 0, 0, 0,
637 	    0, 0, 0, 0, 0, 0, 0, 0,
638 	    0, 0, 0, 0, 0, 0, 0, 0}
639 	}
640 	}
641 	 },
642 /*
643  * boardcnf[8] RENESAS SALVATOR-X board with
644  * H3 Ver.2.0 or later/SIP(8Gbit 2rank)
645  */
646 	{
647 #if RCAR_DRAM_CHANNEL == 5
648 	 0x05,
649 #else
650 	 0x0f,
651 #endif
652 	 0x01,
653 	 0x300,
654 	 0,
655 	 0x300,
656 	 0x0a0,
657 	{
658 	{
659 	   {0x02, 0x02},
660 	   0x00543210,
661 	   0x2310,
662 	   {0x70631425, 0x34527016, 0x43527610, 0x32104567},
663 	   {0x08, 0x08, 0x08, 0x08},
664 	   WDQLVL_PAT,
665 	   {0, 0, 0, 0, 0, 0, 0, 0,
666 	    0, 0},
667 	   {0, 0, 0, 0},
668 	   {0, 0, 0, 0, 0, 0, 0, 0,
669 	    0, 0, 0, 0, 0, 0, 0, 0,
670 	    0, 0, 0, 0, 0, 0, 0, 0,
671 	    0, 0, 0, 0, 0, 0, 0, 0},
672 	   {0, 0, 0, 0},
673 	   {0, 0, 0, 0, 0, 0, 0, 0,
674 	    0, 0, 0, 0, 0, 0, 0, 0,
675 	    0, 0, 0, 0, 0, 0, 0, 0,
676 	    0, 0, 0, 0, 0, 0, 0, 0}
677 	   },
678 #if ((RCAR_DRAM_CHANNEL == 5) && (RCAR_DRAM_SPLIT == 2))
679 	{
680 	   {0x02, 0x02},
681 	   0x00543210,
682 	   0x2301,
683 	   {0x01327654, 0x02316457, 0x10234567, 0x01325467},
684 	   {0x08, 0x08, 0x08, 0x08},
685 	   WDQLVL_PAT,
686 	   {0, 0, 0, 0, 0, 0, 0, 0,
687 	    0, 0},
688 	   {0, 0, 0, 0},
689 	   {0, 0, 0, 0, 0, 0, 0, 0,
690 	    0, 0, 0, 0, 0, 0, 0, 0,
691 	    0, 0, 0, 0, 0, 0, 0, 0,
692 	    0, 0, 0, 0, 0, 0, 0, 0},
693 	   {0, 0, 0, 0},
694 	   {0, 0, 0, 0, 0, 0, 0, 0,
695 	    0, 0, 0, 0, 0, 0, 0, 0,
696 	    0, 0, 0, 0, 0, 0, 0, 0,
697 	    0, 0, 0, 0, 0, 0, 0, 0}
698 	   },
699 #else
700 	{
701 	   {0x02, 0x02},
702 	   0x00105432,
703 	   0x3210,
704 	   {0x43256107, 0x07162354, 0x10234567, 0x01235467},
705 	   {0x08, 0x08, 0x08, 0x08},
706 	   WDQLVL_PAT,
707 	   {0, 0, 0, 0, 0, 0, 0, 0,
708 	    0, 0},
709 	   {0, 0, 0, 0},
710 	   {0, 0, 0, 0, 0, 0, 0, 0,
711 	    0, 0, 0, 0, 0, 0, 0, 0,
712 	    0, 0, 0, 0, 0, 0, 0, 0,
713 	    0, 0, 0, 0, 0, 0, 0, 0},
714 	   {0, 0, 0, 0},
715 	   {0, 0, 0, 0, 0, 0, 0, 0,
716 	    0, 0, 0, 0, 0, 0, 0, 0,
717 	    0, 0, 0, 0, 0, 0, 0, 0,
718 	    0, 0, 0, 0, 0, 0, 0, 0}
719 	   },
720 #endif
721 	{
722 	   {0x02, 0x02},
723 	   0x00543210,
724 	   0x2301,
725 	   {0x01327654, 0x02316457, 0x10234567, 0x01325467},
726 	   {0x08, 0x08, 0x08, 0x08},
727 	   WDQLVL_PAT,
728 	   {0, 0, 0, 0, 0, 0, 0, 0,
729 	    0, 0},
730 	   {0, 0, 0, 0},
731 	   {0, 0, 0, 0, 0, 0, 0, 0,
732 	    0, 0, 0, 0, 0, 0, 0, 0,
733 	    0, 0, 0, 0, 0, 0, 0, 0,
734 	    0, 0, 0, 0, 0, 0, 0, 0},
735 	   {0, 0, 0, 0},
736 	   {0, 0, 0, 0, 0, 0, 0, 0,
737 	    0, 0, 0, 0, 0, 0, 0, 0,
738 	    0, 0, 0, 0, 0, 0, 0, 0,
739 	    0, 0, 0, 0, 0, 0, 0, 0}
740 	   },
741 	{
742 	   {0x02, 0x02},
743 	   0x00543210,
744 	   0x2301,
745 	   {0x12034765, 0x23105467, 0x23017645, 0x32106745},
746 	   {0x08, 0x08, 0x08, 0x08},
747 	   WDQLVL_PAT,
748 	   {0, 0, 0, 0, 0, 0, 0, 0,
749 	    0, 0},
750 	   {0, 0, 0, 0},
751 	   {0, 0, 0, 0, 0, 0, 0, 0,
752 	    0, 0, 0, 0, 0, 0, 0, 0,
753 	    0, 0, 0, 0, 0, 0, 0, 0,
754 	    0, 0, 0, 0, 0, 0, 0, 0},
755 	   {0, 0, 0, 0},
756 	   {0, 0, 0, 0, 0, 0, 0, 0,
757 	    0, 0, 0, 0, 0, 0, 0, 0,
758 	    0, 0, 0, 0, 0, 0, 0, 0,
759 	    0, 0, 0, 0, 0, 0, 0, 0}
760 	}
761 	}
762 	 },
763 /* boardcnf[9] RENESAS SALVATOR-MS(1rank) board with H3 Ver.2.0 or later/SoC */
764 	{
765 	 0x0f,
766 	 0x01,
767 	 0x300,
768 	 0,
769 	 0x300,
770 	 0x0a0,
771 	{
772 	{
773 	   {0x02, 0xff},
774 	   0x00543210,
775 	   0x3210,
776 	   {0x27645310, 0x75346210, 0x53467210, 0x23674510},
777 	   {0x08, 0x08, 0x08, 0x08},
778 	   WDQLVL_PAT,
779 	   {0, 0, 0, 0, 0, 0, 0, 0,
780 	    0, 0},
781 	   {0, 0, 0, 0},
782 	   {0, 0, 0, 0, 0, 0, 0, 0,
783 	    0, 0, 0, 0, 0, 0, 0, 0,
784 	    0, 0, 0, 0, 0, 0, 0, 0,
785 	    0, 0, 0, 0, 0, 0, 0, 0},
786 	   {0, 0, 0, 0},
787 	   {0, 0, 0, 0, 0, 0, 0, 0,
788 	    0, 0, 0, 0, 0, 0, 0, 0,
789 	    0, 0, 0, 0, 0, 0, 0, 0,
790 	    0, 0, 0, 0, 0, 0, 0, 0}
791 	   },
792 	{
793 	   {0x02, 0xff},
794 	   0x00543210,
795 	   0x2301,
796 	   {0x23764510, 0x43257610, 0x43752610, 0x37652401},
797 	   {0x08, 0x08, 0x08, 0x08},
798 	   WDQLVL_PAT,
799 	   {-128, -128, -128, -128, -128, -128, 0, 0,
800 	    0, 0},
801 	   {0, 0, 0, 0},
802 	   {0, 0, 0, 0, 0, 0, 0, 0,
803 	    0, 0, 0, 0, 0, 0, 0, 0,
804 	    0, 0, 0, 0, 0, 0, 0, 0,
805 	    0, 0, 0, 0, 0, 0, 0, 0},
806 	   {0, 0, 0, 0},
807 	   {0, 0, 0, 0, 0, 0, 0, 0,
808 	    0, 0, 0, 0, 0, 0, 0, 0,
809 	    0, 0, 0, 0, 0, 0, 0, 0,
810 	    0, 0, 0, 0, 0, 0, 0, 0}
811 	   },
812 	{
813 	   {0x02, 0xff},
814 	   0x00452103,
815 	   0x3210,
816 	   {0x32764510, 0x43257610, 0x43752610, 0x26573401},
817 	   {0x08, 0x08, 0x08, 0x08},
818 	   WDQLVL_PAT,
819 	   {0, 0, 0, 0, 0, 0, 0, 0,
820 	    0, 0},
821 	   {0, 0, 0, 0},
822 	   {0, 0, 0, 0, 0, 0, 0, 0,
823 	    0, 0, 0, 0, 0, 0, 0, 0,
824 	    0, 0, 0, 0, 0, 0, 0, 0,
825 	    0, 0, 0, 0, 0, 0, 0, 0},
826 	   {0, 0, 0, 0},
827 	   {0, 0, 0, 0, 0, 0, 0, 0,
828 	    0, 0, 0, 0, 0, 0, 0, 0,
829 	    0, 0, 0, 0, 0, 0, 0, 0,
830 	    0, 0, 0, 0, 0, 0, 0, 0}
831 	   },
832 	{
833 	   {0x02, 0xff},
834 	   0x00520413,
835 	   0x2301,
836 	   {0x47652301, 0x75346210, 0x53467210, 0x32674501},
837 	   {0x08, 0x08, 0x08, 0x08},
838 	   WDQLVL_PAT,
839 	   {30, 30, 30, 30, 30, 30, 30, 30,
840 	    30, 30},
841 	   {0, 0, 0, 0},
842 	   {0, 0, 0, 0, 0, 0, 0, 0,
843 	    0, 0, 0, 0, 0, 0, 0, 0,
844 	    0, 0, 0, 0, 0, 0, 0, 0,
845 	    0, 0, 0, 0, 0, 0, 0, 0},
846 	   {0, 0, 0, 0},
847 	   {0, 0, 0, 0, 0, 0, 0, 0,
848 	    0, 0, 0, 0, 0, 0, 0, 0,
849 	    0, 0, 0, 0, 0, 0, 0, 0,
850 	    0, 0, 0, 0, 0, 0, 0, 0}
851 	}
852 	}
853 	 },
854 /* boardcnf[10] RENESAS Kriek(2rank) board with M3-N/SoC */
855 	{
856 	 0x01,
857 	 0x01,
858 	 0x300,
859 	 0,
860 	 0x300,
861 	 0x0a0,
862 	{
863 	{
864 	   {0x02, 0x02},
865 	   0x00345201,
866 	   0x3201,
867 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
868 	   {0x08, 0x08, 0x08, 0x08},
869 	   WDQLVL_PAT,
870 	   {0, 0, 0, 0, 0, 0, 0, 0,
871 	    0, 0},
872 	   {0, 0, 0, 0},
873 	   {0, 0, 0, 0, 0, 0, 0, 0,
874 	    0, 0, 0, 0, 0, 0, 0, 0,
875 	    0, 0, 0, 0, 0, 0, 0, 0,
876 	    0, 0, 0, 0, 0, 0, 0, 0},
877 	   {0, 0, 0, 0},
878 	   {0, 0, 0, 0, 0, 0, 0, 0,
879 	    0, 0, 0, 0, 0, 0, 0, 0,
880 	    0, 0, 0, 0, 0, 0, 0, 0,
881 	    0, 0, 0, 0, 0, 0, 0, 0}
882 	}
883 	}
884 	 },
885 /* boardcnf[11] RENESAS SALVATOR-X board with M3-N/SIP(8Gbit 2rank) */
886 	{
887 	 0x01,
888 	 0x01,
889 	 0x300,
890 	 0,
891 	 0x300,
892 	 0x0a0,
893 	{
894 	{
895 #if (RCAR_DRAM_LPDDR4_MEMCONF == 2)
896 	   {0x04, 0x04},
897 #else
898 	   {0x02, 0x02},
899 #endif
900 	   0x00342501,
901 	   0x3201,
902 	   {0x10672534, 0x43257106, 0x34527601, 0x71605243},
903 	   {0x08, 0x08, 0x08, 0x08},
904 	   WDQLVL_PAT,
905 	   {0, 0, 0, 0, 0, 0, 0, 0,
906 	    0, 0},
907 	   {0, 0, 0, 0},
908 	   {0, 0, 0, 0, 0, 0, 0, 0,
909 	    0, 0, 0, 0, 0, 0, 0, 0,
910 	    0, 0, 0, 0, 0, 0, 0, 0,
911 	    0, 0, 0, 0, 0, 0, 0, 0},
912 	   {0, 0, 0, 0},
913 	   {0, 0, 0, 0, 0, 0, 0, 0,
914 	    0, 0, 0, 0, 0, 0, 0, 0,
915 	    0, 0, 0, 0, 0, 0, 0, 0,
916 	    0, 0, 0, 0, 0, 0, 0, 0}
917 	}
918 	}
919 	 },
920 /* boardcnf[12] RENESAS CONDOR board with V3H/SoC */
921 	{
922 	 0x01,
923 	 0x1,
924 	 0x300,
925 	 0,
926 	 0x300,
927 	 0x0a0,
928 	{
929 	{
930 	   {0x02, 0x02},
931 	   0x00501342,
932 	   0x3201,
933 	   {0x70562134, 0x34526071, 0x23147506, 0x12430567},
934 	   {0x08, 0x08, 0x08, 0x08},
935 	   WDQLVL_PAT,
936 	   {0, 0, 0, 0, 0, 0, 0, 0,
937 	    0, 0},
938 	   {0, 0, 0, 0},
939 	   {0, 0, 0, 0, 0, 0, 0, 0,
940 	    0, 0, 0, 0, 0, 0, 0, 0,
941 	    0, 0, 0, 0, 0, 0, 0, 0,
942 	    0, 0, 0, 0, 0, 0, 0, 0},
943 	   {0, 0, 0, 0},
944 	   {0, 0, 0, 0, 0, 0, 0, 0,
945 	    0, 0, 0, 0, 0, 0, 0, 0,
946 	    0, 0, 0, 0, 0, 0, 0, 0,
947 	    0, 0, 0, 0, 0, 0, 0, 0}
948 	}
949 	}
950 	 },
951 /* boardcnf[13] RENESAS KRIEK board with PM3/SoC */
952 	{
953 	 0x05,
954 	 0x00,
955 	 0x2c0,
956 	 -320,
957 	 0x300,
958 	 0x0a0,
959 	{
960 	{
961 	   {0x02, 0x02},
962 	   0x00345201,
963 	   0x3201,
964 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
965 	   {0x08, 0x08, 0x08, 0x08},
966 	   WDQLVL_PAT,
967 	   {0, 0, 0, 0, 0, 0, 0, 0,
968 	    0, 0},
969 	   {0, 0, 0, 0},
970 	   {0, 0, 0, 0, 0, 0, 0, 0,
971 	    0, 0, 0, 0, 0, 0, 0, 0,
972 	    0, 0, 0, 0, 0, 0, 0, 0,
973 	    0, 0, 0, 0, 0, 0, 0, 0},
974 	   {0, 0, 0, 0},
975 	   {0, 0, 0, 0, 0, 0, 0, 0,
976 	    0, 0, 0, 0, 0, 0, 0, 0,
977 	    0, 0, 0, 0, 0, 0, 0, 0,
978 	    0, 0, 0, 0, 0, 0, 0, 0}
979 	   },
980 	{
981 	   {0x02, 0x02},
982 	   0x00302154,
983 	   0x2310,
984 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
985 	   {0x08, 0x08, 0x08, 0x08},
986 	   WDQLVL_PAT,
987 	   {0, 0, 0, 0, 0, 0, 0, 0,
988 	    0, 0},
989 	   {0, 0, 0, 0},
990 	   {0, 0, 0, 0, 0, 0, 0, 0,
991 	    0, 0, 0, 0, 0, 0, 0, 0,
992 	    0, 0, 0, 0, 0, 0, 0, 0,
993 	    0, 0, 0, 0, 0, 0, 0, 0},
994 	   {0, 0, 0, 0},
995 	   {0, 0, 0, 0, 0, 0, 0, 0,
996 	    0, 0, 0, 0, 0, 0, 0, 0,
997 	    0, 0, 0, 0, 0, 0, 0, 0,
998 	    0, 0, 0, 0, 0, 0, 0, 0}
999 	   },
1000 	{
1001 	   {0x02, 0x02},
1002 	   0x00302154,
1003 	   0x2310,
1004 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1005 	   {0x08, 0x08, 0x08, 0x08},
1006 	   WDQLVL_PAT,
1007 	   {0, 0, 0, 0, 0, 0, 0, 0,
1008 	    0, 0},
1009 	   {0, 0, 0, 0},
1010 	   {0, 0, 0, 0, 0, 0, 0, 0,
1011 	    0, 0, 0, 0, 0, 0, 0, 0,
1012 	    0, 0, 0, 0, 0, 0, 0, 0,
1013 	    0, 0, 0, 0, 0, 0, 0, 0},
1014 	   {0, 0, 0, 0},
1015 	   {0, 0, 0, 0, 0, 0, 0, 0,
1016 	    0, 0, 0, 0, 0, 0, 0, 0,
1017 	    0, 0, 0, 0, 0, 0, 0, 0,
1018 	    0, 0, 0, 0, 0, 0, 0, 0}
1019 	   },
1020 	{
1021 	   {0xff, 0xff},
1022 	   0,
1023 	   0,
1024 	   {0, 0, 0, 0},
1025 	   {0, 0, 0, 0},
1026 	   WDQLVL_PAT,
1027 	   {0, 0, 0, 0, 0, 0, 0, 0,
1028 	    0, 0},
1029 	   {0, 0, 0, 0},
1030 	   {0, 0, 0, 0, 0, 0, 0, 0,
1031 	    0, 0, 0, 0, 0, 0, 0, 0,
1032 	    0, 0, 0, 0, 0, 0, 0, 0,
1033 	    0, 0, 0, 0, 0, 0, 0, 0},
1034 	   {0, 0, 0, 0},
1035 	   {0, 0, 0, 0, 0, 0, 0, 0,
1036 	    0, 0, 0, 0, 0, 0, 0, 0,
1037 	    0, 0, 0, 0, 0, 0, 0, 0,
1038 	    0, 0, 0, 0, 0, 0, 0, 0}
1039 	}
1040 	}
1041 	 },
1042 /* boardcnf[14] SALVATOR-X board with H3 Ver.2.0 or later/SIP(16Gbit 1rank) */
1043 	{
1044 #if RCAR_DRAM_CHANNEL == 5
1045 	 0x05,
1046 #else
1047 	 0x0f,
1048 #endif
1049 	 0x01,
1050 	 0x300,
1051 	 0,
1052 	 0x300,
1053 	 0x0a0,
1054 	{
1055 	{
1056 	   {0x04, 0xff},
1057 	   0x00543210,
1058 	   0x2310,
1059 	   {0x70631425, 0x34527016, 0x43527610, 0x32104567},
1060 	   {0x08, 0x08, 0x08, 0x08},
1061 	   WDQLVL_PAT,
1062 	   {0, 0, 0, 0, 0, 0, 0, 0,
1063 	    0, 0},
1064 	   {0, 0, 0, 0},
1065 	   {0, 0, 0, 0, 0, 0, 0, 0,
1066 	    0, 0, 0, 0, 0, 0, 0, 0,
1067 	    0, 0, 0, 0, 0, 0, 0, 0,
1068 	    0, 0, 0, 0, 0, 0, 0, 0},
1069 	   {0, 0, 0, 0},
1070 	   {0, 0, 0, 0, 0, 0, 0, 0,
1071 	    0, 0, 0, 0, 0, 0, 0, 0,
1072 	    0, 0, 0, 0, 0, 0, 0, 0,
1073 	    0, 0, 0, 0, 0, 0, 0, 0}
1074 	   },
1075 #if ((RCAR_DRAM_CHANNEL == 5) && (RCAR_DRAM_SPLIT == 2))
1076 	{
1077 	   {0x04, 0xff},
1078 	   0x00543210,
1079 	   0x2301,
1080 	   {0x01327654, 0x02316457, 0x10234567, 0x01325467},
1081 	   {0x08, 0x08, 0x08, 0x08},
1082 	   WDQLVL_PAT,
1083 	   {0, 0, 0, 0, 0, 0, 0, 0,
1084 	    0, 0},
1085 	   {0, 0, 0, 0},
1086 	   {0, 0, 0, 0, 0, 0, 0, 0,
1087 	    0, 0, 0, 0, 0, 0, 0, 0,
1088 	    0, 0, 0, 0, 0, 0, 0, 0,
1089 	    0, 0, 0, 0, 0, 0, 0, 0},
1090 	   {0, 0, 0, 0},
1091 	   {0, 0, 0, 0, 0, 0, 0, 0,
1092 	    0, 0, 0, 0, 0, 0, 0, 0,
1093 	    0, 0, 0, 0, 0, 0, 0, 0,
1094 	    0, 0, 0, 0, 0, 0, 0, 0}
1095 	   },
1096 #else
1097 	{
1098 	   {0x04, 0xff},
1099 	   0x00105432,
1100 	   0x3210,
1101 	   {0x43256107, 0x07162354, 0x10234567, 0x01235467},
1102 	   {0x08, 0x08, 0x08, 0x08},
1103 	   WDQLVL_PAT,
1104 	   {0, 0, 0, 0, 0, 0, 0, 0,
1105 	    0, 0},
1106 	   {0, 0, 0, 0},
1107 	   {0, 0, 0, 0, 0, 0, 0, 0,
1108 	    0, 0, 0, 0, 0, 0, 0, 0,
1109 	    0, 0, 0, 0, 0, 0, 0, 0,
1110 	    0, 0, 0, 0, 0, 0, 0, 0},
1111 	   {0, 0, 0, 0},
1112 	   {0, 0, 0, 0, 0, 0, 0, 0,
1113 	    0, 0, 0, 0, 0, 0, 0, 0,
1114 	    0, 0, 0, 0, 0, 0, 0, 0,
1115 	    0, 0, 0, 0, 0, 0, 0, 0}
1116 	   },
1117 #endif
1118 	{
1119 	   {0x04, 0xff},
1120 	   0x00543210,
1121 	   0x2301,
1122 	   {0x01327654, 0x02316457, 0x10234567, 0x01325467},
1123 	   {0x08, 0x08, 0x08, 0x08},
1124 	   WDQLVL_PAT,
1125 	   {0, 0, 0, 0, 0, 0, 0, 0,
1126 	    0, 0},
1127 	   {0, 0, 0, 0},
1128 	   {0, 0, 0, 0, 0, 0, 0, 0,
1129 	    0, 0, 0, 0, 0, 0, 0, 0,
1130 	    0, 0, 0, 0, 0, 0, 0, 0,
1131 	    0, 0, 0, 0, 0, 0, 0, 0},
1132 	   {0, 0, 0, 0},
1133 	   {0, 0, 0, 0, 0, 0, 0, 0,
1134 	    0, 0, 0, 0, 0, 0, 0, 0,
1135 	    0, 0, 0, 0, 0, 0, 0, 0,
1136 	    0, 0, 0, 0, 0, 0, 0, 0}
1137 	   },
1138 	{
1139 	   {0x04, 0xff},
1140 	   0x00543210,
1141 	   0x2301,
1142 	   {0x12034765, 0x23105467, 0x23017645, 0x32106745},
1143 	   {0x08, 0x08, 0x08, 0x08},
1144 	   WDQLVL_PAT,
1145 	   {0, 0, 0, 0, 0, 0, 0, 0,
1146 	    0, 0},
1147 	   {0, 0, 0, 0},
1148 	   {0, 0, 0, 0, 0, 0, 0, 0,
1149 	    0, 0, 0, 0, 0, 0, 0, 0,
1150 	    0, 0, 0, 0, 0, 0, 0, 0,
1151 	    0, 0, 0, 0, 0, 0, 0, 0},
1152 	   {0, 0, 0, 0},
1153 	   {0, 0, 0, 0, 0, 0, 0, 0,
1154 	    0, 0, 0, 0, 0, 0, 0, 0,
1155 	    0, 0, 0, 0, 0, 0, 0, 0,
1156 	    0, 0, 0, 0, 0, 0, 0, 0}
1157 	}
1158 	}
1159 	 },
1160 /* boardcnf[15] RENESAS KRIEK board with H3N */
1161 	{
1162 	 0x05,
1163 	 0x01,
1164 	 0x300,
1165 	 0,
1166 	 0x300,
1167 	 0x0a0,
1168 	{
1169 	{
1170 	   {0x02, 0x02},
1171 	   0x00345201,
1172 	   0x3201,
1173 	   {0x01672543, 0x45367012, 0x45632107, 0x60715234},
1174 	   {0x08, 0x08, 0x08, 0x08},
1175 	   WDQLVL_PAT,
1176 	   {0, 0, 0, 0, 0, 0, 0, 0,
1177 	    0, 0},
1178 	   {0, 0, 0, 0},
1179 	   {0, 0, 0, 0, 0, 0, 0, 0,
1180 	    0, 0, 0, 0, 0, 0, 0, 0,
1181 	    0, 0, 0, 0, 0, 0, 0, 0,
1182 	    0, 0, 0, 0, 0, 0, 0, 0},
1183 	   {0, 0, 0, 0},
1184 	   {0, 0, 0, 0, 0, 0, 0, 0,
1185 	    0, 0, 0, 0, 0, 0, 0, 0,
1186 	    0, 0, 0, 0, 0, 0, 0, 0,
1187 	    0, 0, 0, 0, 0, 0, 0, 0}
1188 	   },
1189 	{
1190 	   {0x02, 0x02},
1191 	   0x00302154,
1192 	   0x2310,
1193 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1194 	   {0x08, 0x08, 0x08, 0x08},
1195 	   WDQLVL_PAT,
1196 	   {0, 0, 0, 0, 0, 0, 0, 0,
1197 	    0, 0},
1198 	   {0, 0, 0, 0},
1199 	   {0, 0, 0, 0, 0, 0, 0, 0,
1200 	    0, 0, 0, 0, 0, 0, 0, 0,
1201 	    0, 0, 0, 0, 0, 0, 0, 0,
1202 	    0, 0, 0, 0, 0, 0, 0, 0},
1203 	   {0, 0, 0, 0},
1204 	   {0, 0, 0, 0, 0, 0, 0, 0,
1205 	    0, 0, 0, 0, 0, 0, 0, 0,
1206 	    0, 0, 0, 0, 0, 0, 0, 0,
1207 	    0, 0, 0, 0, 0, 0, 0, 0}
1208 	   },
1209 	{
1210 	   {0x02, 0x02},
1211 	   0x00302154,
1212 	   0x2310,
1213 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1214 	   {0x08, 0x08, 0x08, 0x08},
1215 	   WDQLVL_PAT,
1216 	   {0, 0, 0, 0, 0, 0, 0, 0,
1217 	    0, 0},
1218 	   {0, 0, 0, 0},
1219 	   {0, 0, 0, 0, 0, 0, 0, 0,
1220 	    0, 0, 0, 0, 0, 0, 0, 0,
1221 	    0, 0, 0, 0, 0, 0, 0, 0,
1222 	    0, 0, 0, 0, 0, 0, 0, 0},
1223 	   {0, 0, 0, 0},
1224 	   {0, 0, 0, 0, 0, 0, 0, 0,
1225 	    0, 0, 0, 0, 0, 0, 0, 0,
1226 	    0, 0, 0, 0, 0, 0, 0, 0,
1227 	    0, 0, 0, 0, 0, 0, 0, 0}
1228 	   },
1229 	{
1230 	   {0xff, 0xff},
1231 	   0,
1232 	   0,
1233 	   {0, 0, 0, 0},
1234 	   {0, 0, 0, 0},
1235 	   WDQLVL_PAT,
1236 	   {0, 0, 0, 0, 0, 0, 0, 0,
1237 	    0, 0},
1238 	   {0, 0, 0, 0},
1239 	   {0, 0, 0, 0, 0, 0, 0, 0,
1240 	    0, 0, 0, 0, 0, 0, 0, 0,
1241 	    0, 0, 0, 0, 0, 0, 0, 0,
1242 	    0, 0, 0, 0, 0, 0, 0, 0},
1243 	   {0, 0, 0, 0},
1244 	   {0, 0, 0, 0, 0, 0, 0, 0,
1245 	    0, 0, 0, 0, 0, 0, 0, 0,
1246 	    0, 0, 0, 0, 0, 0, 0, 0,
1247 	    0, 0, 0, 0, 0, 0, 0, 0}
1248 	}
1249 	}
1250 	 },
1251 /* boardcnf[16] RENESAS KRIEK-P2P board with M3-W/SoC */
1252 	{
1253 	 0x03,
1254 	 0x01,
1255 	 0x0320,
1256 	 0,
1257 	 0x0300,
1258 	 0x00a0,
1259 	{
1260 	{
1261 	   {0x04, 0x04},
1262 	    0x520314FFFF523041,
1263 	    0x3201,
1264 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1265 	   {0x08, 0x08, 0x08, 0x08},
1266 	    WDQLVL_PAT,
1267 	   {0, 0, 0, 0, 0, 0, 0, 0,
1268 	    0, 0, 0, 0, 0, 0, 0, 0},
1269 	   {0, 0, 0, 0},
1270 	   {0, 0, 0, 0, 0, 0, 0, 0,
1271 	    0, 0, 0, 0, 0, 0, 0, 0,
1272 	    0, 0, 0, 0, 0, 0, 0, 0,
1273 	    0, 0, 0, 0, 0, 0, 0, 0},
1274 	   {0, 0, 0, 0},
1275 	   {0, 0, 0, 0, 0, 0, 0, 0,
1276 	    0, 0, 0, 0, 0, 0, 0, 0,
1277 	    0, 0, 0, 0, 0, 0, 0, 0,
1278 	    0, 0, 0, 0, 0, 0, 0, 0}
1279 	   },
1280 	{
1281 	   {0x04, 0x04},
1282 	    0x314250FFFF312405,
1283 	    0x2310,
1284 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1285 	   {0x08, 0x08, 0x08, 0x08},
1286 	    WDQLVL_PAT,
1287 	   {0, 0, 0, 0, 0, 0, 0, 0,
1288 	    0, 0, 0, 0, 0, 0, 0, 0},
1289 	   {0, 0, 0, 0},
1290 	   {0, 0, 0, 0, 0, 0, 0, 0,
1291 	    0, 0, 0, 0, 0, 0, 0, 0,
1292 	    0, 0, 0, 0, 0, 0, 0, 0,
1293 	    0, 0, 0, 0, 0, 0, 0, 0},
1294 	   {0, 0, 0, 0},
1295 	   {0, 0, 0, 0, 0, 0, 0, 0,
1296 	    0, 0, 0, 0, 0, 0, 0, 0,
1297 	    0, 0, 0, 0, 0, 0, 0, 0,
1298 	    0, 0, 0, 0, 0, 0, 0, 0}
1299 	}
1300 	}
1301 	 },
1302 /* boardcnf[17] RENESAS KRIEK-P2P board with M3-N/SoC */
1303 	{
1304 	 0x01,
1305 	 0x01,
1306 	 0x0300,
1307 	 0,
1308 	 0x0300,
1309 	 0x00a0,
1310 	{
1311 	{
1312 	   {0x04, 0x04},
1313 	    0x520314FFFF523041,
1314 	    0x3201,
1315 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1316 	   {0x08, 0x08, 0x08, 0x08},
1317 	    WDQLVL_PAT,
1318 	   {0, 0, 0, 0, 0, 0, 0, 0,
1319 	    0, 0, 0, 0, 0, 0, 0, 0},
1320 	   {0, 0, 0, 0},
1321 	   {0, 0, 0, 0, 0, 0, 0, 0,
1322 	    0, 0, 0, 0, 0, 0, 0, 0,
1323 	    0, 0, 0, 0, 0, 0, 0, 0,
1324 	    0, 0, 0, 0, 0, 0, 0, 0},
1325 	   {0, 0, 0, 0},
1326 	   {0, 0, 0, 0, 0, 0, 0, 0,
1327 	    0, 0, 0, 0, 0, 0, 0, 0,
1328 	    0, 0, 0, 0, 0, 0, 0, 0,
1329 	    0, 0, 0, 0, 0, 0, 0, 0}
1330 	}
1331 	}
1332 	},
1333 /* boardcnf[18] RENESAS SALVATOR-X board with M3-W/SIP(16Gbit 2rank) */
1334 	{
1335 	 0x03,
1336 	 0x01,
1337 	 0x02c0,
1338 	 0,
1339 	 0x0300,
1340 	 0x00a0,
1341 	{
1342 	{
1343 	   {0x04, 0x04},
1344 	    0x00543210,
1345 	    0x3201,
1346 	   {0x70612543, 0x43251670, 0x45326170, 0x10672534},
1347 	   {0x08, 0x08, 0x08, 0x08},
1348 	   WDQLVL_PAT,
1349 	   {0, 0, 0, 0, 0, 0, 0, 0,
1350 	    0, 0},
1351 	   {0, 0, 0, 0},
1352 	   {0, 0, 0, 0, 0, 0, 0, 0,
1353 	    0, 0, 0, 0, 0, 0, 0, 0,
1354 	    0, 0, 0, 0, 0, 0, 0, 0,
1355 	    0, 0, 0, 0, 0, 0, 0, 0},
1356 	   {0, 0, 0, 0},
1357 	   {0, 0, 0, 0, 0, 0, 0, 0,
1358 	    0, 0, 0, 0, 0, 0, 0, 0,
1359 	    0, 0, 0, 0, 0, 0, 0, 0,
1360 	    0, 0, 0, 0, 0, 0, 0, 0}
1361 	   },
1362 	{
1363 	   {0x04, 0x04},
1364 	    0x00543210,
1365 	    0x2310,
1366 	   {0x01327654, 0x34526107, 0x35421670, 0x70615324},
1367 	   {0x08, 0x08, 0x08, 0x08},
1368 	   WDQLVL_PAT,
1369 	   {0, 0, 0, 0, 0, 0, 0, 0,
1370 	    0, 0},
1371 	   {0, 0, 0, 0},
1372 	   {0, 0, 0, 0, 0, 0, 0, 0,
1373 	    0, 0, 0, 0, 0, 0, 0, 0,
1374 	    0, 0, 0, 0, 0, 0, 0, 0,
1375 	    0, 0, 0, 0, 0, 0, 0, 0},
1376 	   {0, 0, 0, 0},
1377 	   {0, 0, 0, 0, 0, 0, 0, 0,
1378 	    0, 0, 0, 0, 0, 0, 0, 0,
1379 	    0, 0, 0, 0, 0, 0, 0, 0,
1380 	    0, 0, 0, 0, 0, 0, 0, 0}
1381 	}
1382 	}
1383 	},
1384 /* boardcnf[19] RENESAS SALVATOR-X board with M3-W/SIP(16Gbit 1rank) */
1385 	{
1386 	 0x03,
1387 	 0x01,
1388 	 0x02c0,
1389 	 0,
1390 	 0x0300,
1391 	 0x00a0,
1392 	{
1393 	{
1394 	   {0x04, 0xff},
1395 	    0x00543210,
1396 	    0x3201,
1397 	   {0x70612543, 0x43251670, 0x45326170, 0x10672534},
1398 	   {0x08, 0x08, 0x08, 0x08},
1399 	   WDQLVL_PAT,
1400 	   {0, 0, 0, 0, 0, 0, 0, 0,
1401 	    0, 0},
1402 	   {0, 0, 0, 0},
1403 	   {0, 0, 0, 0, 0, 0, 0, 0,
1404 	    0, 0, 0, 0, 0, 0, 0, 0,
1405 	    0, 0, 0, 0, 0, 0, 0, 0,
1406 	    0, 0, 0, 0, 0, 0, 0, 0},
1407 	   {0, 0, 0, 0},
1408 	   {0, 0, 0, 0, 0, 0, 0, 0,
1409 	    0, 0, 0, 0, 0, 0, 0, 0,
1410 	    0, 0, 0, 0, 0, 0, 0, 0,
1411 	    0, 0, 0, 0, 0, 0, 0, 0}
1412 	   },
1413 	{
1414 	   {0x04, 0xff},
1415 	    0x00543210,
1416 	    0x2310,
1417 	   {0x01327654, 0x34526107, 0x35421670, 0x70615324},
1418 	   {0x08, 0x08, 0x08, 0x08},
1419 	   WDQLVL_PAT,
1420 	   {0, 0, 0, 0, 0, 0, 0, 0,
1421 	    0, 0},
1422 	   {0, 0, 0, 0},
1423 	   {0, 0, 0, 0, 0, 0, 0, 0,
1424 	    0, 0, 0, 0, 0, 0, 0, 0,
1425 	    0, 0, 0, 0, 0, 0, 0, 0,
1426 	    0, 0, 0, 0, 0, 0, 0, 0},
1427 	   {0, 0, 0, 0},
1428 	   {0, 0, 0, 0, 0, 0, 0, 0,
1429 	    0, 0, 0, 0, 0, 0, 0, 0,
1430 	    0, 0, 0, 0, 0, 0, 0, 0,
1431 	    0, 0, 0, 0, 0, 0, 0, 0}
1432 	}
1433 	}
1434 	},
1435 /* boardcnf[20] RENESAS KRIEK 16Gbit/2rank/2ch board with M3-W/SoC */
1436 	{
1437 	 0x03,
1438 	 0x01,
1439 	 0x02c0,
1440 	 0,
1441 	 0x0300,
1442 	 0x00a0,
1443 	{
1444 	{
1445 	   {0x04, 0x04},
1446 	    0x00345201,
1447 	    0x3201,
1448 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1449 	   {0x08, 0x08, 0x08, 0x08},
1450 	    WDQLVL_PAT,
1451 	   {0, 0, 0, 0, 0, 0, 0, 0,
1452 	    0, 0},
1453 	   {0, 0, 0, 0},
1454 	   {0, 0, 0, 0, 0, 0, 0, 0,
1455 	    0, 0, 0, 0, 0, 0, 0, 0,
1456 	    0, 0, 0, 0, 0, 0, 0, 0,
1457 	    0, 0, 0, 0, 0, 0, 0, 0},
1458 	   {0, 0, 0, 0},
1459 	   {0, 0, 0, 0, 0, 0, 0, 0,
1460 	    0, 0, 0, 0, 0, 0, 0, 0,
1461 	    0, 0, 0, 0, 0, 0, 0, 0,
1462 	    0, 0, 0, 0, 0, 0, 0, 0}
1463 	   },
1464 	{
1465 	   {0x04, 0x04},
1466 	    0x00302154,
1467 	    0x2310,
1468 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1469 	   {0x08, 0x08, 0x08, 0x08},
1470 	   WDQLVL_PAT,
1471 	   {0, 0, 0, 0, 0, 0, 0, 0,
1472 	    0, 0},
1473 	   {0, 0, 0, 0},
1474 	   {0, 0, 0, 0, 0, 0, 0, 0,
1475 	    0, 0, 0, 0, 0, 0, 0, 0,
1476 	    0, 0, 0, 0, 0, 0, 0, 0,
1477 	    0, 0, 0, 0, 0, 0, 0, 0},
1478 	   {0, 0, 0, 0},
1479 	   {0, 0, 0, 0, 0, 0, 0, 0,
1480 	    0, 0, 0, 0, 0, 0, 0, 0,
1481 	    0, 0, 0, 0, 0, 0, 0, 0,
1482 	    0, 0, 0, 0, 0, 0, 0, 0}
1483 	}
1484 	}
1485 	},
1486 /* boardcnf[21] RENESAS KRIEK 16Gbit/1rank/2ch board with M3-W/SoC */
1487 	{
1488 	 0x03,
1489 	 0x01,
1490 	 0x02c0,
1491 	 0,
1492 	 0x0300,
1493 	 0x00a0,
1494 	{
1495 	{
1496 	   {0x04, 0xff},
1497 	    0x00345201,
1498 	    0x3201,
1499 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1500 	   {0x08, 0x08, 0x08, 0x08},
1501 	   WDQLVL_PAT,
1502 	   {0, 0, 0, 0, 0, 0, 0, 0,
1503 	    0, 0},
1504 	   {0, 0, 0, 0},
1505 	   {0, 0, 0, 0, 0, 0, 0, 0,
1506 	    0, 0, 0, 0, 0, 0, 0, 0,
1507 	    0, 0, 0, 0, 0, 0, 0, 0,
1508 	    0, 0, 0, 0, 0, 0, 0, 0},
1509 	   {0, 0, 0, 0},
1510 	   {0, 0, 0, 0, 0, 0, 0, 0,
1511 	    0, 0, 0, 0, 0, 0, 0, 0,
1512 	    0, 0, 0, 0, 0, 0, 0, 0,
1513 	    0, 0, 0, 0, 0, 0, 0, 0}
1514 	   },
1515 	{
1516 	   {0x04, 0xff},
1517 	    0x00302154,
1518 	    0x2310,
1519 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1520 	   {0x08, 0x08, 0x08, 0x08},
1521 	   WDQLVL_PAT,
1522 	   {0, 0, 0, 0, 0, 0, 0, 0,
1523 	    0, 0},
1524 	   {0, 0, 0, 0},
1525 	   {0, 0, 0, 0, 0, 0, 0, 0,
1526 	    0, 0, 0, 0, 0, 0, 0, 0,
1527 	    0, 0, 0, 0, 0, 0, 0, 0,
1528 	    0, 0, 0, 0, 0, 0, 0, 0},
1529 	   {0, 0, 0, 0},
1530 	   {0, 0, 0, 0, 0, 0, 0, 0,
1531 	    0, 0, 0, 0, 0, 0, 0, 0,
1532 	    0, 0, 0, 0, 0, 0, 0, 0,
1533 	    0, 0, 0, 0, 0, 0, 0, 0}
1534 	}
1535 	}
1536 	}
1537 };
1538 
boardcnf_get_brd_clk(uint32_t brd,uint32_t * clk,uint32_t * div)1539 void boardcnf_get_brd_clk(uint32_t brd, uint32_t *clk, uint32_t *div)
1540 {
1541 	uint32_t md;
1542 
1543 	if ((prr_product == PRR_PRODUCT_H3) && (prr_cut == PRR_PRODUCT_10)) {
1544 		*clk = 50;
1545 		*div = 3;
1546 	} else {
1547 		md = (mmio_read_32(RST_MODEMR) >> 13) & 0x3;
1548 		switch (md) {
1549 		case 0x0:
1550 			*clk = 50;
1551 			*div = 3;
1552 			break;
1553 		case 0x1:
1554 			*clk = 60;
1555 			*div = 3;
1556 			break;
1557 		case 0x2:
1558 			*clk = 75;
1559 			*div = 3;
1560 			break;
1561 		case 0x3:
1562 			*clk = 100;
1563 			*div = 3;
1564 			break;
1565 		}
1566 	}
1567 	(void)brd;
1568 }
1569 
boardcnf_get_ddr_mbps(uint32_t brd,uint32_t * mbps,uint32_t * div)1570 void boardcnf_get_ddr_mbps(uint32_t brd, uint32_t *mbps, uint32_t *div)
1571 {
1572 	uint32_t md;
1573 
1574 	if (prr_product == PRR_PRODUCT_V3H) {
1575 		md = (mmio_read_32(RST_MODEMR) >> 19) & 0x1;
1576 		md = (md | (md << 1)) & 0x3; /* 0 or 3 */
1577 	} else {
1578 		md = (mmio_read_32(RST_MODEMR) >> 17) & 0x5;
1579 		md = (md | (md >> 1)) & 0x3;
1580 	}
1581 	switch (md) {
1582 	case 0x0:
1583 		*mbps = 3200;
1584 		*div = 1;
1585 		break;
1586 	case 0x1:
1587 		*mbps = 2800;
1588 		*div = 1;
1589 		break;
1590 	case 0x2:
1591 		*mbps = 2400;
1592 		*div = 1;
1593 		break;
1594 	case 0x3:
1595 		*mbps = 1600;
1596 		*div = 1;
1597 		break;
1598 	}
1599 	(void)brd;
1600 }
1601 
1602 #define _def_REFPERIOD  1890
1603 
1604 #define M3_SAMPLE_TT_A84        0xB866CC10, 0x3B250421
1605 #define M3_SAMPLE_TT_A85        0xB866CC10, 0x3AA50421
1606 #define M3_SAMPLE_TT_A86        0xB866CC10, 0x3AA48421
1607 #define M3_SAMPLE_FF_B45        0xB866CC10, 0x3AB00C21
1608 #define M3_SAMPLE_FF_B49        0xB866CC10, 0x39B10C21
1609 #define M3_SAMPLE_FF_B56        0xB866CC10, 0x3AAF8C21
1610 #define M3_SAMPLE_SS_E24        0xB866CC10, 0x3BA39421
1611 #define M3_SAMPLE_SS_E28        0xB866CC10, 0x3C231421
1612 #define M3_SAMPLE_SS_E32        0xB866CC10, 0x3C241421
1613 
1614 static const uint32_t termcode_by_sample[20][3] = {
1615 	{M3_SAMPLE_TT_A84, 0x000158D5},
1616 	{M3_SAMPLE_TT_A85, 0x00015955},
1617 	{M3_SAMPLE_TT_A86, 0x00015955},
1618 	{M3_SAMPLE_FF_B45, 0x00015690},
1619 	{M3_SAMPLE_FF_B49, 0x00015753},
1620 	{M3_SAMPLE_FF_B56, 0x00015793},
1621 	{M3_SAMPLE_SS_E24, 0x00015996},
1622 	{M3_SAMPLE_SS_E28, 0x000159D7},
1623 	{M3_SAMPLE_SS_E32, 0x00015997},
1624 	{0xFFFFFFFF, 0xFFFFFFFF, 0x0001554F}
1625 };
1626 
1627 #ifdef BOARD_JUDGE_AUTO
1628 /*
1629  * SAMPLE board detect function
1630  */
1631 #define PFC_PMMR	0xE6060000U
1632 #define PFC_PUEN5	0xE6060414U
1633 #define PFC_PUEN6	0xE6060418U
1634 #define PFC_PUD5	0xE6060454U
1635 #define PFC_PUD6	0xE6060458U
1636 #define GPIO_INDT5	0xE605500CU
1637 #define GPIO_GPSR6	0xE6060118U
1638 
1639 #if (RCAR_GEN3_ULCB == 0)
pfc_write_and_poll(uint32_t a,uint32_t v)1640 static void pfc_write_and_poll(uint32_t a, uint32_t v)
1641 {
1642 	mmio_write_32(PFC_PMMR, ~v);
1643 	v = ~mmio_read_32(PFC_PMMR);
1644 	mmio_write_32(a, v);
1645 	while (v != mmio_read_32(a))
1646 		;
1647 	dsb_sev();
1648 }
1649 #endif
1650 
1651 #ifndef RCAR_GEN3_ULCB
1652 #define RCAR_GEN3_ULCB		0
1653 #endif
1654 
1655 #if (RCAR_GEN3_ULCB == 0)	/* non Starter Kit */
1656 
opencheck_SSI_WS6(void)1657 static uint32_t opencheck_SSI_WS6(void)
1658 {
1659 	uint32_t dataL, down, up;
1660 	uint32_t gpsr6_bak;
1661 	uint32_t puen5_bak;
1662 	uint32_t pud5_bak;
1663 
1664 	gpsr6_bak = mmio_read_32(GPIO_GPSR6);
1665 	puen5_bak = mmio_read_32(PFC_PUEN5);
1666 	pud5_bak = mmio_read_32(PFC_PUD5);
1667 	dsb_sev();
1668 
1669 	dataL = (gpsr6_bak & ~BIT(15));
1670 	pfc_write_and_poll(GPIO_GPSR6, dataL);
1671 
1672 	/* Pull-Up/Down Enable (PUEN5[22]=1) */
1673 	dataL = puen5_bak;
1674 	dataL |= (BIT(22));
1675 	pfc_write_and_poll(PFC_PUEN5, dataL);
1676 
1677 	/* Pull-Down-Enable (PUD5[22]=0, PUEN5[22]=1) */
1678 	dataL = pud5_bak;
1679 	dataL &= ~(BIT(22));
1680 	pfc_write_and_poll(PFC_PUD5, dataL);
1681 	/* GPSR6[15]=SSI_WS6 */
1682 	rcar_micro_delay(10);
1683 	down = (mmio_read_32(GPIO_INDT6) >> 15) & 0x1;
1684 	dsb_sev();
1685 
1686 	/* Pull-Up-Enable (PUD5[22]=1, PUEN5[22]=1) */
1687 	dataL = pud5_bak;
1688 	dataL |= (BIT(22));
1689 	pfc_write_and_poll(PFC_PUD5, dataL);
1690 
1691 	/* GPSR6[15]=SSI_WS6 */
1692 	rcar_micro_delay(10);
1693 	up = (mmio_read_32(GPIO_INDT6) >> 15) & 0x1;
1694 
1695 	dsb_sev();
1696 
1697 	pfc_write_and_poll(GPIO_GPSR6, gpsr6_bak);
1698 	pfc_write_and_poll(PFC_PUEN5, puen5_bak);
1699 	pfc_write_and_poll(PFC_PUD5, pud5_bak);
1700 
1701 	if (down == up) {
1702 		/* Same = Connect */
1703 		return 0;
1704 	}
1705 
1706 	/* Diff = Open */
1707 	return 1;
1708 }
1709 
1710 #endif
1711 
_board_judge(void)1712 static uint32_t _board_judge(void)
1713 {
1714 	uint32_t brd;
1715 #if (RCAR_GEN3_ULCB == 1)
1716 	/* Starter Kit */
1717 	if (prr_product == PRR_PRODUCT_H3) {
1718 		if (prr_cut <= PRR_PRODUCT_11) {
1719 			/* RENESAS Starter Kit(H3 Ver.1.x/SIP) board */
1720 			brd = 2;
1721 		} else {
1722 			/* RENESAS Starter Kit(H3 Ver.2.0 or later/SIP) board */
1723 #if (RCAR_DRAM_LPDDR4_MEMCONF == 0)
1724 			brd = 7;
1725 #else
1726 			brd = 8;
1727 #endif
1728 		}
1729 	} else if (prr_product == PRR_PRODUCT_M3) {
1730 		if (prr_cut >= PRR_PRODUCT_30) {
1731 			/* RENESAS Starter Kit (M3-W Ver.3.0/SIP) */
1732 			brd = 18;
1733 		} else {
1734 			/* RENESAS Starter Kit(M3-W/SIP 8Gbit 1rank) board */
1735 			brd = 3;
1736 		}
1737 	} else {
1738 		/* RENESAS Starter Kit(M3-N/SIP) board */
1739 		brd = 11;
1740 	}
1741 #else
1742 	uint32_t usb2_ovc_open;
1743 
1744 	usb2_ovc_open = opencheck_SSI_WS6();
1745 
1746 	/* RENESAS Eva-board */
1747 	brd = 99;
1748 	if (prr_product == PRR_PRODUCT_V3H) {
1749 		/* RENESAS Condor board */
1750 		brd = 12;
1751 	} else if (usb2_ovc_open) {
1752 		if (prr_product == PRR_PRODUCT_M3N) {
1753 			/* RENESAS Kriek board with M3-N */
1754 			brd = 10;
1755 		} else if (prr_product == PRR_PRODUCT_M3) {
1756 			/* RENESAS Kriek board with M3-W */
1757 			brd = 1;
1758 		} else if ((prr_product == PRR_PRODUCT_H3) &&
1759 			   (prr_cut <= PRR_PRODUCT_11)) {
1760 			/* RENESAS Kriek board with PM3 */
1761 			brd = 13;
1762 		} else if ((prr_product == PRR_PRODUCT_H3) &&
1763 			   (prr_cut > PRR_PRODUCT_20)) {
1764 			/* RENESAS Kriek board with H3N */
1765 			brd = 15;
1766 		}
1767 	} else {
1768 		if (prr_product == PRR_PRODUCT_H3) {
1769 			if (prr_cut <= PRR_PRODUCT_11) {
1770 				/* RENESAS SALVATOR-X (H3 Ver.1.x/SIP) */
1771 				brd = 2;
1772 			} else if (prr_cut < PRR_PRODUCT_30) {
1773 				/* RENESAS SALVATOR-X (H3 Ver.2.0/SIP) */
1774 				brd = 7;	//  8Gbit/1rank
1775 			} else {
1776 				/* RENESAS SALVATOR-X (H3 Ver.3.0/SIP) */
1777 #if (RCAR_DRAM_LPDDR4_MEMCONF == 0)
1778 				brd = 7;
1779 #else
1780 				brd = 8;
1781 #endif
1782 			}
1783 		} else if (prr_product == PRR_PRODUCT_M3N) {
1784 			/* RENESAS SALVATOR-X (M3-N/SIP) */
1785 			brd = 11;
1786 		} else if ((prr_product == PRR_PRODUCT_M3) &&
1787 			   (prr_cut <= PRR_PRODUCT_20)) {
1788 			/* RENESAS SALVATOR-X (M3-W/SIP) */
1789 			brd = 0;
1790 		} else if ((prr_product == PRR_PRODUCT_M3) &&
1791 			   (prr_cut < PRR_PRODUCT_30)) {
1792 			/* RENESAS SALVATOR-X (M3-W Ver.1.x/SIP) */
1793 			brd = 19;
1794 		} else if ((prr_product == PRR_PRODUCT_M3) &&
1795 			   (prr_cut >= PRR_PRODUCT_30)) {
1796 			/* RENESAS SALVATOR-X (M3-W ver.3.0/SIP) */
1797 			brd = 18;
1798 		}
1799 	}
1800 #endif
1801 
1802 	return brd;
1803 }
1804 #endif
1805