1 /*
2  * Copyright (c) 2015-2021, Renesas Electronics Corporation.
3  * All rights reserved.
4  *
5  * SPDX-License-Identifier: BSD-3-Clause
6  */
7 
8 #ifndef RZG_SOC
9 #define RZG_SOC		0
10 #endif
11 
12 #if (RZG_SOC == 1)
13 #define BOARDNUM 4
14 #else
15 
16 #include <board.h>
17 
18 #define BOARDNUM 22
19 #endif /* RZG_SOC == 1 */
20 #define BOARD_JUDGE_AUTO
21 
22 #ifdef BOARD_JUDGE_AUTO
23 static uint32_t _board_judge(void);
24 
boardcnf_get_brd_type(void)25 static uint32_t boardcnf_get_brd_type(void)
26 {
27 	return _board_judge();
28 }
29 #else
boardcnf_get_brd_type(void)30 static uint32_t boardcnf_get_brd_type(void)
31 {
32 	return 1;
33 }
34 #endif
35 
36 #define DDR_FAST_INIT
37 
38 struct _boardcnf_ch {
39 	uint8_t ddr_density[CS_CNT];
40 	uint64_t ca_swap;
41 	uint16_t dqs_swap;
42 	uint32_t dq_swap[SLICE_CNT];
43 	uint8_t dm_swap[SLICE_CNT];
44 	uint16_t wdqlvl_patt[16];
45 	int8_t cacs_adj[16];
46 	int8_t dm_adj_w[SLICE_CNT];
47 	int8_t dq_adj_w[SLICE_CNT * 8];
48 	int8_t dm_adj_r[SLICE_CNT];
49 	int8_t dq_adj_r[SLICE_CNT * 8];
50 };
51 
52 struct _boardcnf {
53 	uint8_t phyvalid;
54 	uint8_t dbi_en;
55 	uint16_t cacs_dly;
56 	int16_t cacs_dly_adj;
57 	uint16_t dqdm_dly_w;
58 	uint16_t dqdm_dly_r;
59 	struct _boardcnf_ch ch[DRAM_CH_CNT];
60 };
61 
62 #define WDQLVL_PAT {\
63 	0x00AA,\
64 	0x0055,\
65 	0x00AA,\
66 	0x0155,\
67 	0x01CC,\
68 	0x0133,\
69 	0x00CC,\
70 	0x0033,\
71 	0x00F0,\
72 	0x010F,\
73 	0x01F0,\
74 	0x010F,\
75 	0x00F0,\
76 	0x00F0,\
77 	0x000F,\
78 	0x010F}
79 
80 #if (RZG_SOC == 1)
81 static const struct _boardcnf boardcnfs[BOARDNUM] = {
82 	{
83 /* boardcnf[0] HopeRun HiHope RZ/G2M 16Gbit/1rank/2ch board with G2M SoC */
84 	 .phyvalid = 0x03U,
85 	 .dbi_en = 0x01U,
86 	 .cacs_dly = 0x02c0U,
87 	 .cacs_dly_adj = 0x0U,
88 	 .dqdm_dly_w = 0x0300U,
89 	 .dqdm_dly_r = 0x00a0U,
90 	 .ch = {
91 		{
92 		 { 0x04U, 0xffU },
93 		 0x00345201UL,
94 		 0x3201U,
95 		 { 0x01672543U, 0x45361207U, 0x45632107U, 0x60715234U },
96 		 { 0x08U, 0x08U, 0x08U, 0x08U },
97 		 WDQLVL_PAT,
98 		 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
99 		 { 0, 0, 0, 0 },
100 		 { 0, 0, 0, 0, 0, 0, 0, 0,
101 		   0, 0, 0, 0, 0, 0, 0, 0,
102 		   0, 0, 0, 0, 0, 0, 0, 0,
103 		   0, 0, 0, 0, 0, 0, 0, 0 },
104 		 { 0, 0, 0, 0 },
105 		 { 0, 0, 0, 0, 0, 0, 0, 0,
106 		   0, 0, 0, 0, 0, 0, 0, 0,
107 		   0, 0, 0, 0, 0, 0, 0, 0,
108 		   0, 0, 0, 0, 0, 0, 0, 0 }
109 		},
110 		{
111 		 { 0x04U, 0xffU },
112 		 0x00302154UL,
113 		 0x2310U,
114 		 { 0x01672543U, 0x45361207U, 0x45632107U, 0x60715234U },
115 		 { 0x08U, 0x08U, 0x08U, 0x08U },
116 		 WDQLVL_PAT,
117 		 { 0, 0, 0, 0, 0, 0, 0, 0,  0, 0 },
118 		 { 0, 0, 0, 0 },
119 		 { 0, 0, 0, 0, 0, 0, 0, 0,
120 		   0, 0, 0, 0, 0, 0, 0, 0,
121 		   0, 0, 0, 0, 0, 0, 0, 0,
122 		   0, 0, 0, 0, 0, 0, 0, 0 },
123 		 { 0, 0, 0, 0 },
124 		 { 0, 0, 0, 0, 0, 0, 0, 0,
125 		   0, 0, 0, 0, 0, 0, 0, 0,
126 		   0, 0, 0, 0, 0, 0, 0, 0,
127 		   0, 0, 0, 0, 0, 0, 0, 0 }
128 		}
129 		}
130 	},
131 /* boardcnf[1] HopeRun HiHope RZ/G2M 8Gbit/2rank/2ch board with G2M SoC */
132 	{
133 	 0x03U,
134 	 0x01U,
135 	 0x02c0U,
136 	 0x0U,
137 	 0x0300U,
138 	 0x00a0U,
139 	{
140 		{
141 		 { 0x02U, 0x02U },
142 		 0x00345201UL,
143 		 0x3201U,
144 		 { 0x01672543U, 0x45361207U, 0x45632107U, 0x60715234U },
145 		 { 0x08U, 0x08U, 0x08U, 0x08U },
146 		 WDQLVL_PAT,
147 		 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
148 		 { 0, 0, 0, 0 },
149 		 { 0, 0, 0, 0, 0, 0, 0, 0,
150 		   0, 0, 0, 0, 0, 0, 0, 0,
151 		   0, 0, 0, 0, 0, 0, 0, 0,
152 		   0, 0, 0, 0, 0, 0, 0, 0 },
153 		 { 0, 0, 0, 0 },
154 		 { 0, 0, 0, 0, 0, 0, 0, 0,
155 		   0, 0, 0, 0, 0, 0, 0, 0,
156 		   0, 0, 0, 0, 0, 0, 0, 0,
157 		   0, 0, 0, 0, 0, 0, 0, 0 }
158 		},
159 		{
160 		 { 0x02U, 0x02U },
161 		 0x00302154UL,
162 		 0x2310,
163 		 { 0x01672543U, 0x45361207U, 0x45632107U, 0x60715234U },
164 		 { 0x08U, 0x08U, 0x08U, 0x08U },
165 		 WDQLVL_PAT,
166 		 { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
167 		 { 0, 0, 0, 0 },
168 		 { 0, 0, 0, 0, 0, 0, 0, 0,
169 		   0, 0, 0, 0, 0, 0, 0, 0,
170 		   0, 0, 0, 0, 0, 0, 0, 0,
171 		   0, 0, 0, 0, 0, 0, 0, 0 },
172 		{ 0, 0, 0, 0 },
173 		{ 0, 0, 0, 0, 0, 0, 0, 0,
174 		  0, 0, 0, 0, 0, 0, 0, 0,
175 		  0, 0, 0, 0, 0, 0, 0, 0,
176 		  0, 0, 0, 0, 0, 0, 0, 0 }
177 		}
178 	}
179 	},
180 /* boardcnf[2] HopeRun HiHope RZ/G2H board 16Gbit/1rank/2ch */
181 	{
182 		0x05U,
183 		0x01U,
184 		0x0300U,
185 		0,
186 		0x0300U,
187 		0x00a0U,
188 		{
189 			{
190 				{ 0x04U, 0xffU },
191 				0x00345201UL,
192 				0x3201U,
193 				{ 0x01672543U, 0x45367012U, 0x45632107U, 0x60715234U },
194 				{ 0x08U, 0x08U, 0x08U, 0x08U },
195 				WDQLVL_PAT,
196 				{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
197 				{ 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 				  0, 0, 0, 0, 0, 0, 0, 0 },
202 				{ 0, 0, 0, 0 },
203 				{ 0, 0, 0, 0, 0, 0, 0, 0,
204 				  0, 0, 0, 0, 0, 0, 0, 0,
205 				  0, 0, 0, 0, 0, 0, 0, 0,
206 				  0, 0, 0, 0, 0, 0, 0, 0 }
207 			},
208 			{
209 				{ 0x04U, 0xffU },
210 				0x00302154UL,
211 				0x2310U,
212 				{ 0x01672543U, 0x45361207U, 0x45632107U, 0x60715234U },
213 				{ 0x08U, 0x08U, 0x08U, 0x08U },
214 				WDQLVL_PAT,
215 				{ 0, 0, 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 				{ 0, 0, 0, 0 },
222 				{ 0, 0, 0, 0, 0, 0, 0, 0,
223 				  0, 0, 0, 0, 0, 0, 0, 0,
224 				  0, 0, 0, 0, 0, 0, 0, 0,
225 				  0, 0, 0, 0, 0, 0, 0, 0 }
226 			},
227 			{
228 				{ 0x04U, 0xffU },
229 				0x00302154UL,
230 				0x2310U,
231 				{ 0x01672543U, 0x45361207U, 0x45632107U, 0x60715234U },
232 				{ 0x08U, 0x08U, 0x08U, 0x08U },
233 				WDQLVL_PAT,
234 				{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
235 				{ 0, 0, 0, 0 },
236 				{ 0, 0, 0, 0, 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 },
241 				{ 0, 0, 0, 0, 0, 0, 0, 0,
242 				  0, 0, 0, 0, 0, 0, 0, 0,
243 				  0, 0, 0, 0, 0, 0, 0, 0,
244 				  0, 0, 0, 0, 0, 0, 0, 0 }
245 			},
246 			{
247 				{ 0xffU, 0xffU },
248 				0UL,
249 				0U,
250 				{ 0U, 0U, 0U, 0U },
251 				{ 0U, 0U, 0U, 0U },
252 				WDQLVL_PAT,
253 				{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
254 				{ 0, 0, 0, 0 },
255 				{ 0, 0, 0, 0, 0, 0, 0, 0,
256 				  0, 0, 0, 0, 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 },
260 				{ 0, 0, 0, 0, 0, 0, 0, 0,
261 				  0, 0, 0, 0, 0, 0, 0, 0,
262 				  0, 0, 0, 0, 0, 0, 0, 0,
263 				  0, 0, 0, 0, 0, 0, 0, 0 }
264 			}
265 		}
266 	},
267 /* boardcnf[3] HopeRun HiHope RZ/G2N board 16Gbit/2rank/1ch */
268 	{
269 		0x01U,
270 		0x01U,
271 		0x0300U,
272 		0,
273 		0x0300U,
274 		0x00a0U,
275 		{
276 			{
277 				{ 0x04U, 0x04U },
278 				0x00345201UL,
279 				0x3201U,
280 				{ 0x01672543U, 0x45361207U, 0x45632107U, 0x60715234U },
281 				{ 0x08U, 0x08U, 0x08U, 0x08U },
282 				WDQLVL_PAT,
283 				{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
284 				{ 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, 0, 0, 0, 0,
288 				  0, 0, 0, 0, 0, 0, 0, 0 },
289 				{ 0, 0, 0, 0 },
290 				{ 0, 0, 0, 0, 0, 0, 0, 0,
291 				  0, 0, 0, 0, 0, 0, 0, 0,
292 				  0, 0, 0, 0, 0, 0, 0, 0,
293 				  0, 0, 0, 0, 0, 0, 0, 0 }
294 			}
295 		}
296 	},
297 };
298 #else
299 static const struct _boardcnf boardcnfs[BOARDNUM] = {
300 	{
301 /* boardcnf[0] RENESAS SALVATOR-X board with M3-W/SIP */
302 	 .phyvalid = 0x03,
303 	 .dbi_en = 0x01,
304 	 .cacs_dly = 0x02c0,
305 	 .cacs_dly_adj = 0,
306 	 .dqdm_dly_w = 0x0300,
307 	 .dqdm_dly_r = 0x00a0,
308 	 .ch = {
309 		{
310 		 {0x02, 0x02},
311 		 0x00543210U,
312 		 0x3201U,
313 		 {0x70612543, 0x43251670, 0x45326170, 0x10672534},
314 		 {0x08, 0x08, 0x08, 0x08},
315 		 WDQLVL_PAT,
316 		 {0, 0, 0, 0, 0, 0, 0, 0,
317 		  0, 0},
318 		 {0, 0, 0, 0},
319 		 {0, 0, 0, 0, 0, 0, 0, 0,
320 		  0, 0, 0, 0, 0, 0, 0, 0,
321 		  0, 0, 0, 0, 0, 0, 0, 0,
322 		  0, 0, 0, 0, 0, 0, 0, 0},
323 		 {0, 0, 0, 0},
324 		 {0, 0, 0, 0, 0, 0, 0, 0,
325 		  0, 0, 0, 0, 0, 0, 0, 0,
326 		  0, 0, 0, 0, 0, 0, 0, 0,
327 		  0, 0, 0, 0, 0, 0, 0, 0}
328 		 },
329 
330 		{
331 		 {0x02, 0x02},
332 		 0x00543210,
333 		 0x2310,
334 		 {0x01327654, 0x34526107, 0x35421670, 0x70615324},
335 		 {0x08, 0x08, 0x08, 0x08},
336 		 WDQLVL_PAT,
337 		 {0, 0, 0, 0, 0, 0, 0, 0,
338 		  0, 0},
339 		 {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 		  0, 0, 0, 0, 0, 0, 0, 0},
344 		 {0, 0, 0, 0},
345 		 {0, 0, 0, 0, 0, 0, 0, 0,
346 		  0, 0, 0, 0, 0, 0, 0, 0,
347 		  0, 0, 0, 0, 0, 0, 0, 0,
348 		  0, 0, 0, 0, 0, 0, 0, 0}
349 		}
350 		}
351 	 },
352 /* boardcnf[1] RENESAS KRIEK board with M3-W/SoC */
353 	{
354 	 0x03,
355 	 0x01,
356 	 0x2c0,
357 	 0,
358 	 0x300,
359 	 0x0a0,
360 	{
361 	{
362 	   {0x02, 0x02},
363 	   0x00345201,
364 	   0x3201,
365 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
366 	   {0x08, 0x08, 0x08, 0x08},
367 	   WDQLVL_PAT,
368 	   {0, 0, 0, 0, 0, 0, 0, 0,
369 	    0, 0},
370 	   {0, 0, 0, 0},
371 	   {0, 0, 0, 0, 0, 0, 0, 0,
372 	    0, 0, 0, 0, 0, 0, 0, 0,
373 	    0, 0, 0, 0, 0, 0, 0, 0,
374 	    0, 0, 0, 0, 0, 0, 0, 0},
375 	   {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, 0, 0, 0, 0,
379 	    0, 0, 0, 0, 0, 0, 0, 0}
380 	   },
381 	{
382 	   {0x02, 0x02},
383 	   0x00302154,
384 	   0x2310,
385 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
386 	   {0x08, 0x08, 0x08, 0x08},
387 	   WDQLVL_PAT,
388 	   {0, 0, 0, 0, 0, 0, 0, 0,
389 	    0, 0},
390 	   {0, 0, 0, 0},
391 	   {0, 0, 0, 0, 0, 0, 0, 0,
392 	    0, 0, 0, 0, 0, 0, 0, 0,
393 	    0, 0, 0, 0, 0, 0, 0, 0,
394 	    0, 0, 0, 0, 0, 0, 0, 0},
395 	   {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, 0, 0, 0, 0,
399 	    0, 0, 0, 0, 0, 0, 0, 0}
400 	}
401 	}
402 	 },
403 /* boardcnf[2] RENESAS SALVATOR-X board with H3 Ver.1.x/SIP(8Gbit 1rank) */
404 	{
405 	 0x0f,
406 	 0x00,
407 	 0x300,
408 	 -320,
409 	 0x300,
410 	 0x0a0,
411 	{
412 	{
413 	   {0x02, 0xff},
414 	   0x00543210,
415 	   0x3210,
416 	   {0x20741365, 0x34256107, 0x57460321, 0x70614532},
417 	   {0x08, 0x08, 0x08, 0x08},
418 	   WDQLVL_PAT,
419 	   {0, 0, 0, 0, 0, 0, 0, 0,
420 	    0, 0},
421 	   {0, 0, 0, 0},
422 	   {0, 0, 0, 0, 0, 0, 0, 0,
423 	    0, 0, 0, 0, 0, 0, 0, 0,
424 	    0, 0, 0, 0, 0, 0, 0, 0,
425 	    0, 0, 0, 0, 0, 0, 0, 0},
426 	   {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, 0, 0, 0, 0,
430 	    0, 0, 0, 0, 0, 0, 0, 0}
431 	   },
432 	{
433 	   {0x02, 0xff},
434 	   0x00543210,
435 	   0x3102,
436 	   {0x23547610, 0x34526107, 0x67452310, 0x32106754},
437 	   {0x08, 0x08, 0x08, 0x08},
438 	   WDQLVL_PAT,
439 	   {0, 0, 0, 0, 0, 0, 0, 0,
440 	    0, 0},
441 	   {0, 0, 0, 0},
442 	   {0, 0, 0, 0, 0, 0, 0, 0,
443 	    0, 0, 0, 0, 0, 0, 0, 0,
444 	    0, 0, 0, 0, 0, 0, 0, 0,
445 	    0, 0, 0, 0, 0, 0, 0, 0},
446 	   {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, 0, 0, 0, 0,
450 	    0, 0, 0, 0, 0, 0, 0, 0}
451 	   },
452 	{
453 	   {0x02, 0xff},
454 	   0x00543210,
455 	   0x0213,
456 	   {0x30216754, 0x67453210, 0x70165243, 0x07162345},
457 	   {0x08, 0x08, 0x08, 0x08},
458 	   WDQLVL_PAT,
459 	   {0, 0, 0, 0, 0, 0, 0, 0,
460 	    0, 0},
461 	   {0, 0, 0, 0},
462 	   {0, 0, 0, 0, 0, 0, 0, 0,
463 	    0, 0, 0, 0, 0, 0, 0, 0,
464 	    0, 0, 0, 0, 0, 0, 0, 0,
465 	    0, 0, 0, 0, 0, 0, 0, 0},
466 	   {0, 0, 0, 0},
467 	   {0, 0, 0, 0, 0, 0, 0, 0,
468 	    0, 0, 0, 0, 0, 0, 0, 0,
469 	    0, 0, 0, 0, 0, 0, 0, 0,
470 	    0, 0, 0, 0, 0, 0, 0, 0}
471 	   },
472 	{
473 	   {0x02, 0xff},
474 	   0x00543210,
475 	   0x0213,
476 	   {0x01327654, 0x70615432, 0x54760123, 0x07162345},
477 	   {0x08, 0x08, 0x08, 0x08},
478 	   WDQLVL_PAT,
479 	   {0, 0, 0, 0, 0, 0, 0, 0,
480 	    0, 0},
481 	   {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 	    0, 0, 0, 0, 0, 0, 0, 0},
486 	   {0, 0, 0, 0},
487 	   {0, 0, 0, 0, 0, 0, 0, 0,
488 	    0, 0, 0, 0, 0, 0, 0, 0,
489 	    0, 0, 0, 0, 0, 0, 0, 0,
490 	    0, 0, 0, 0, 0, 0, 0, 0}
491 	}
492 	}
493 	 },
494 /* boardcnf[3] RENESAS Starter Kit board with M3-W/SIP(8Gbit 1rank) */
495 	{
496 	 0x03,
497 	 0x01,
498 	 0x02c0,
499 	 0,
500 	 0x0300,
501 	 0x00a0,
502 	{
503 	{
504 	   {0x02, 0xFF},
505 	   0x00543210U,
506 	   0x3201,
507 	   {0x70612543, 0x43251670, 0x45326170, 0x10672534},
508 	   {0x08, 0x08, 0x08, 0x08},
509 	   WDQLVL_PAT,
510 	   {0, 0, 0, 0, 0, 0, 0, 0,
511 	    0, 0},
512 	   {0, 0, 0, 0},
513 	   {0, 0, 0, 0, 0, 0, 0, 0,
514 	    0, 0, 0, 0, 0, 0, 0, 0,
515 	    0, 0, 0, 0, 0, 0, 0, 0,
516 	    0, 0, 0, 0, 0, 0, 0, 0},
517 	   {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, 0, 0, 0, 0,
521 	    0, 0, 0, 0, 0, 0, 0, 0}
522 	   },
523 	{
524 	   {0x02, 0xFF},
525 	   0x00543210,
526 	   0x2310,
527 	   {0x01327654, 0x34526107, 0x35421670, 0x70615324},
528 	   {0x08, 0x08, 0x08, 0x08},
529 	   WDQLVL_PAT,
530 	   {0, 0, 0, 0, 0, 0, 0, 0,
531 	    0, 0},
532 	   {0, 0, 0, 0},
533 	   {0, 0, 0, 0, 0, 0, 0, 0,
534 	    0, 0, 0, 0, 0, 0, 0, 0,
535 	    0, 0, 0, 0, 0, 0, 0, 0,
536 	    0, 0, 0, 0, 0, 0, 0, 0},
537 	   {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, 0, 0, 0, 0,
541 	    0, 0, 0, 0, 0, 0, 0, 0}
542 	}
543 	}
544 	 },
545 /* boardcnf[4] RENESAS SALVATOR-M(1rank) board with H3 Ver.1.x/SoC */
546 	{
547 	 0x0f,
548 	 0x00,
549 	 0x2c0,
550 	 -320,
551 	 0x300,
552 	 0x0a0,
553 	{
554 	{
555 	   {0x02, 0xff},
556 	   0x00315024,
557 	   0x3120,
558 	   {0x30671254, 0x26541037, 0x17054623, 0x12307645},
559 	   {0x08, 0x08, 0x08, 0x08},
560 	   WDQLVL_PAT,
561 	   {0, 0, 0, 0, 0, 0, 0, 0,
562 	    0, 0},
563 	   {0, 0, 0, 0},
564 	   {0, 0, 0, 0, 0, 0, 0, 0,
565 	    0, 0, 0, 0, 0, 0, 0, 0,
566 	    0, 0, 0, 0, 0, 0, 0, 0,
567 	    0, 0, 0, 0, 0, 0, 0, 0},
568 	   {0, 0, 0, 0},
569 	   {0, 0, 0, 0, 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 	   },
574 	{
575 	   {0x02, 0xff},
576 	   0x00025143,
577 	   0x3210,
578 	   {0x70613542, 0x16245307, 0x30712645, 0x21706354},
579 	   {0x08, 0x08, 0x08, 0x08},
580 	   WDQLVL_PAT,
581 	   {0, 0, 0, 0, 0, 0, 0, 0,
582 	    0, 0},
583 	   {0, 0, 0, 0},
584 	   {0, 0, 0, 0, 0, 0, 0, 0,
585 	    0, 0, 0, 0, 0, 0, 0, 0,
586 	    0, 0, 0, 0, 0, 0, 0, 0,
587 	    0, 0, 0, 0, 0, 0, 0, 0},
588 	   {0, 0, 0, 0},
589 	   {0, 0, 0, 0, 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 	   },
594 	{
595 	   {0x02, 0xff},
596 	   0x00523104,
597 	   0x2301,
598 	   {0x70613542, 0x16245307, 0x30712645, 0x21706354},
599 	   {0x08, 0x08, 0x08, 0x08},
600 	   WDQLVL_PAT,
601 	   {0, 0, 0, 0, 0, 0, 0, 0,
602 	    0, 0},
603 	   {0, 0, 0, 0},
604 	   {0, 0, 0, 0, 0, 0, 0, 0,
605 	    0, 0, 0, 0, 0, 0, 0, 0,
606 	    0, 0, 0, 0, 0, 0, 0, 0,
607 	    0, 0, 0, 0, 0, 0, 0, 0},
608 	   {0, 0, 0, 0},
609 	   {0, 0, 0, 0, 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 	   },
614 	{
615 	   {0x02, 0xff},
616 	   0x00153402,
617 	   0x2031,
618 	   {0x30671254, 0x26541037, 0x17054623, 0x12307645},
619 	   {0x08, 0x08, 0x08, 0x08},
620 	   WDQLVL_PAT,
621 	   {0, 0, 0, 0, 0, 0, 0, 0,
622 	    0, 0},
623 	   {0, 0, 0, 0},
624 	   {0, 0, 0, 0, 0, 0, 0, 0,
625 	    0, 0, 0, 0, 0, 0, 0, 0,
626 	    0, 0, 0, 0, 0, 0, 0, 0,
627 	    0, 0, 0, 0, 0, 0, 0, 0},
628 	   {0, 0, 0, 0},
629 	   {0, 0, 0, 0, 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 	}
634 	}
635 	 },
636 /* boardcnf[5] RENESAS KRIEK-1rank board with M3-W/SoC */
637 	{
638 	 0x03,
639 	 0x01,
640 	 0x2c0,
641 	 0,
642 	 0x300,
643 	 0x0a0,
644 	{
645 	{
646 	   {0x02, 0xff},
647 	   0x00345201,
648 	   0x3201,
649 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
650 	   {0x08, 0x08, 0x08, 0x08},
651 	   WDQLVL_PAT,
652 	   {0, 0, 0, 0, 0, 0, 0, 0,
653 	    0, 0},
654 	   {0, 0, 0, 0},
655 	   {0, 0, 0, 0, 0, 0, 0, 0,
656 	    0, 0, 0, 0, 0, 0, 0, 0,
657 	    0, 0, 0, 0, 0, 0, 0, 0,
658 	    0, 0, 0, 0, 0, 0, 0, 0},
659 	   {0, 0, 0, 0},
660 	   {0, 0, 0, 0, 0, 0, 0, 0,
661 	    0, 0, 0, 0, 0, 0, 0, 0,
662 	    0, 0, 0, 0, 0, 0, 0, 0,
663 	    0, 0, 0, 0, 0, 0, 0, 0}
664 	   },
665 	{
666 	   {0x02, 0xff},
667 	   0x00302154,
668 	   0x2310,
669 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
670 	   {0x08, 0x08, 0x08, 0x08},
671 	   WDQLVL_PAT,
672 	   {0, 0, 0, 0, 0, 0, 0, 0,
673 	    0, 0},
674 	   {0, 0, 0, 0},
675 	   {0, 0, 0, 0, 0, 0, 0, 0,
676 	    0, 0, 0, 0, 0, 0, 0, 0,
677 	    0, 0, 0, 0, 0, 0, 0, 0,
678 	    0, 0, 0, 0, 0, 0, 0, 0},
679 	   {0, 0, 0, 0},
680 	   {0, 0, 0, 0, 0, 0, 0, 0,
681 	    0, 0, 0, 0, 0, 0, 0, 0,
682 	    0, 0, 0, 0, 0, 0, 0, 0,
683 	    0, 0, 0, 0, 0, 0, 0, 0}
684 	}
685 	}
686 	 },
687 /* boardcnf[6] RENESAS SALVATOR-X board with H3 Ver.1.x/SIP(8Gbit 2rank) */
688 	{
689 	 0x0f,
690 	 0x00,
691 	 0x300,
692 	 -320,
693 	 0x300,
694 	 0x0a0,
695 	{
696 	{
697 	   {0x02, 0x02},
698 	   0x00543210,
699 	   0x3210,
700 	   {0x20741365, 0x34256107, 0x57460321, 0x70614532},
701 	   {0x08, 0x08, 0x08, 0x08},
702 	   WDQLVL_PAT,
703 	   {0, 0, 0, 0, 0, 0, 0, 0,
704 	    0, 0},
705 	   {0, 0, 0, 0},
706 	   {0, 0, 0, 0, 0, 0, 0, 0,
707 	    0, 0, 0, 0, 0, 0, 0, 0,
708 	    0, 0, 0, 0, 0, 0, 0, 0,
709 	    0, 0, 0, 0, 0, 0, 0, 0},
710 	   {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, 0, 0, 0, 0}
715 	   },
716 	{
717 	   {0x02, 0x02},
718 	   0x00543210,
719 	   0x3102,
720 	   {0x23547610, 0x34526107, 0x67452310, 0x32106754},
721 	   {0x08, 0x08, 0x08, 0x08},
722 	   WDQLVL_PAT,
723 	   {0, 0, 0, 0, 0, 0, 0, 0,
724 	    0, 0},
725 	   {0, 0, 0, 0},
726 	   {0, 0, 0, 0, 0, 0, 0, 0,
727 	    0, 0, 0, 0, 0, 0, 0, 0,
728 	    0, 0, 0, 0, 0, 0, 0, 0,
729 	    0, 0, 0, 0, 0, 0, 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 	   },
736 	{
737 	   {0x02, 0x02},
738 	   0x00543210,
739 	   0x0213,
740 	   {0x30216754, 0x67453210, 0x70165243, 0x07162345},
741 	   {0x08, 0x08, 0x08, 0x08},
742 	   WDQLVL_PAT,
743 	   {0, 0, 0, 0, 0, 0, 0, 0,
744 	    0, 0},
745 	   {0, 0, 0, 0},
746 	   {0, 0, 0, 0, 0, 0, 0, 0,
747 	    0, 0, 0, 0, 0, 0, 0, 0,
748 	    0, 0, 0, 0, 0, 0, 0, 0,
749 	    0, 0, 0, 0, 0, 0, 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 	   },
756 	{
757 	   {0x02, 0x02},
758 	   0x00543210,
759 	   0x0213,
760 	   {0x01327654, 0x70615432, 0x54760123, 0x07162345},
761 	   {0x08, 0x08, 0x08, 0x08},
762 	   WDQLVL_PAT,
763 	   {0, 0, 0, 0, 0, 0, 0, 0,
764 	    0, 0},
765 	   {0, 0, 0, 0},
766 	   {0, 0, 0, 0, 0, 0, 0, 0,
767 	    0, 0, 0, 0, 0, 0, 0, 0,
768 	    0, 0, 0, 0, 0, 0, 0, 0,
769 	    0, 0, 0, 0, 0, 0, 0, 0},
770 	   {0, 0, 0, 0},
771 	   {0, 0, 0, 0, 0, 0, 0, 0,
772 	    0, 0, 0, 0, 0, 0, 0, 0,
773 	    0, 0, 0, 0, 0, 0, 0, 0,
774 	    0, 0, 0, 0, 0, 0, 0, 0}
775 	}
776 	}
777 	 },
778 /*
779  * boardcnf[7] RENESAS SALVATOR-X board with
780  * H3 Ver.2.0 or later/SIP(8Gbit 1rank)
781  */
782 	{
783 	 0x0f,
784 	 0x01,
785 	 0x300,
786 	 0,
787 	 0x300,
788 	 0x0a0,
789 	{
790 	{
791 	   {0x02, 0xff},
792 	   0x00543210,
793 	   0x2310,
794 	   {0x70631425, 0x34527016, 0x43527610, 0x32104567},
795 	   {0x08, 0x08, 0x08, 0x08},
796 	   WDQLVL_PAT,
797 	   {0, 0, 0, 0, 0, 0, 0, 0,
798 	    0, 0},
799 	   {0, 0, 0, 0},
800 	   {0, 0, 0, 0, 0, 0, 0, 0,
801 	    0, 0, 0, 0, 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},
805 	   {0, 0, 0, 0, 0, 0, 0, 0,
806 	    0, 0, 0, 0, 0, 0, 0, 0,
807 	    0, 0, 0, 0, 0, 0, 0, 0,
808 	    0, 0, 0, 0, 0, 0, 0, 0}
809 	   },
810 	{
811 	   {0x02, 0xff},
812 	   0x00105432,
813 	   0x3210,
814 	   {0x43256107, 0x07162354, 0x10234567, 0x01235467},
815 	   {0x08, 0x08, 0x08, 0x08},
816 	   WDQLVL_PAT,
817 	   {0, 0, 0, 0, 0, 0, 0, 0,
818 	    0, 0},
819 	   {0, 0, 0, 0},
820 	   {0, 0, 0, 0, 0, 0, 0, 0,
821 	    0, 0, 0, 0, 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},
825 	   {0, 0, 0, 0, 0, 0, 0, 0,
826 	    0, 0, 0, 0, 0, 0, 0, 0,
827 	    0, 0, 0, 0, 0, 0, 0, 0,
828 	    0, 0, 0, 0, 0, 0, 0, 0}
829 	   },
830 	{
831 	   {0x02, 0xff},
832 	   0x00543210,
833 	   0x2301,
834 	   {0x01327654, 0x02316457, 0x10234567, 0x01325467},
835 	   {0x08, 0x08, 0x08, 0x08},
836 	   WDQLVL_PAT,
837 	   {0, 0, 0, 0, 0, 0, 0, 0,
838 	    0, 0},
839 	   {0, 0, 0, 0},
840 	   {0, 0, 0, 0, 0, 0, 0, 0,
841 	    0, 0, 0, 0, 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},
845 	   {0, 0, 0, 0, 0, 0, 0, 0,
846 	    0, 0, 0, 0, 0, 0, 0, 0,
847 	    0, 0, 0, 0, 0, 0, 0, 0,
848 	    0, 0, 0, 0, 0, 0, 0, 0}
849 	   },
850 	{
851 	   {0x02, 0xff},
852 	   0x00543210,
853 	   0x2301,
854 	   {0x12034765, 0x23105467, 0x23017645, 0x32106745},
855 	   {0x08, 0x08, 0x08, 0x08},
856 	   WDQLVL_PAT,
857 	   {0, 0, 0, 0, 0, 0, 0, 0,
858 	    0, 0},
859 	   {0, 0, 0, 0},
860 	   {0, 0, 0, 0, 0, 0, 0, 0,
861 	    0, 0, 0, 0, 0, 0, 0, 0,
862 	    0, 0, 0, 0, 0, 0, 0, 0,
863 	    0, 0, 0, 0, 0, 0, 0, 0},
864 	   {0, 0, 0, 0},
865 	   {0, 0, 0, 0, 0, 0, 0, 0,
866 	    0, 0, 0, 0, 0, 0, 0, 0,
867 	    0, 0, 0, 0, 0, 0, 0, 0,
868 	    0, 0, 0, 0, 0, 0, 0, 0}
869 	}
870 	}
871 	 },
872 /*
873  * boardcnf[8] RENESAS SALVATOR-X board with
874  * H3 Ver.2.0 or later/SIP(8Gbit 2rank)
875  */
876 	{
877 #if RCAR_DRAM_CHANNEL == 5
878 	 0x05,
879 #else
880 	 0x0f,
881 #endif
882 	 0x01,
883 	 0x300,
884 	 0,
885 	 0x300,
886 	 0x0a0,
887 	{
888 	{
889 	   {0x02, 0x02},
890 	   0x00543210,
891 	   0x2310,
892 	   {0x70631425, 0x34527016, 0x43527610, 0x32104567},
893 	   {0x08, 0x08, 0x08, 0x08},
894 	   WDQLVL_PAT,
895 	   {0, 0, 0, 0, 0, 0, 0, 0,
896 	    0, 0},
897 	   {0, 0, 0, 0},
898 	   {0, 0, 0, 0, 0, 0, 0, 0,
899 	    0, 0, 0, 0, 0, 0, 0, 0,
900 	    0, 0, 0, 0, 0, 0, 0, 0,
901 	    0, 0, 0, 0, 0, 0, 0, 0},
902 	   {0, 0, 0, 0},
903 	   {0, 0, 0, 0, 0, 0, 0, 0,
904 	    0, 0, 0, 0, 0, 0, 0, 0,
905 	    0, 0, 0, 0, 0, 0, 0, 0,
906 	    0, 0, 0, 0, 0, 0, 0, 0}
907 	   },
908 #if ((RCAR_DRAM_CHANNEL == 5) && (RCAR_DRAM_SPLIT == 2))
909 	{
910 	   {0x02, 0x02},
911 	   0x00543210,
912 	   0x2301,
913 	   {0x01327654, 0x02316457, 0x10234567, 0x01325467},
914 	   {0x08, 0x08, 0x08, 0x08},
915 	   WDQLVL_PAT,
916 	   {0, 0, 0, 0, 0, 0, 0, 0,
917 	    0, 0},
918 	   {0, 0, 0, 0},
919 	   {0, 0, 0, 0, 0, 0, 0, 0,
920 	    0, 0, 0, 0, 0, 0, 0, 0,
921 	    0, 0, 0, 0, 0, 0, 0, 0,
922 	    0, 0, 0, 0, 0, 0, 0, 0},
923 	   {0, 0, 0, 0},
924 	   {0, 0, 0, 0, 0, 0, 0, 0,
925 	    0, 0, 0, 0, 0, 0, 0, 0,
926 	    0, 0, 0, 0, 0, 0, 0, 0,
927 	    0, 0, 0, 0, 0, 0, 0, 0}
928 	   },
929 #else
930 	{
931 	   {0x02, 0x02},
932 	   0x00105432,
933 	   0x3210,
934 	   {0x43256107, 0x07162354, 0x10234567, 0x01235467},
935 	   {0x08, 0x08, 0x08, 0x08},
936 	   WDQLVL_PAT,
937 	   {0, 0, 0, 0, 0, 0, 0, 0,
938 	    0, 0},
939 	   {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, 0, 0, 0, 0},
944 	   {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 	    0, 0, 0, 0, 0, 0, 0, 0}
949 	   },
950 #endif
951 	{
952 	   {0x02, 0x02},
953 	   0x00543210,
954 	   0x2301,
955 	   {0x01327654, 0x02316457, 0x10234567, 0x01325467},
956 	   {0x08, 0x08, 0x08, 0x08},
957 	   WDQLVL_PAT,
958 	   {0, 0, 0, 0, 0, 0, 0, 0,
959 	    0, 0},
960 	   {0, 0, 0, 0},
961 	   {0, 0, 0, 0, 0, 0, 0, 0,
962 	    0, 0, 0, 0, 0, 0, 0, 0,
963 	    0, 0, 0, 0, 0, 0, 0, 0,
964 	    0, 0, 0, 0, 0, 0, 0, 0},
965 	   {0, 0, 0, 0},
966 	   {0, 0, 0, 0, 0, 0, 0, 0,
967 	    0, 0, 0, 0, 0, 0, 0, 0,
968 	    0, 0, 0, 0, 0, 0, 0, 0,
969 	    0, 0, 0, 0, 0, 0, 0, 0}
970 	   },
971 	{
972 	   {0x02, 0x02},
973 	   0x00543210,
974 	   0x2301,
975 	   {0x12034765, 0x23105467, 0x23017645, 0x32106745},
976 	   {0x08, 0x08, 0x08, 0x08},
977 	   WDQLVL_PAT,
978 	   {0, 0, 0, 0, 0, 0, 0, 0,
979 	    0, 0},
980 	   {0, 0, 0, 0},
981 	   {0, 0, 0, 0, 0, 0, 0, 0,
982 	    0, 0, 0, 0, 0, 0, 0, 0,
983 	    0, 0, 0, 0, 0, 0, 0, 0,
984 	    0, 0, 0, 0, 0, 0, 0, 0},
985 	   {0, 0, 0, 0},
986 	   {0, 0, 0, 0, 0, 0, 0, 0,
987 	    0, 0, 0, 0, 0, 0, 0, 0,
988 	    0, 0, 0, 0, 0, 0, 0, 0,
989 	    0, 0, 0, 0, 0, 0, 0, 0}
990 	}
991 	}
992 	 },
993 /* boardcnf[9] RENESAS SALVATOR-MS(1rank) board with H3 Ver.2.0 or later/SoC */
994 	{
995 	 0x0f,
996 	 0x01,
997 	 0x300,
998 	 0,
999 	 0x300,
1000 	 0x0a0,
1001 	{
1002 	{
1003 	   {0x02, 0xff},
1004 	   0x00543210,
1005 	   0x3210,
1006 	   {0x27645310, 0x75346210, 0x53467210, 0x23674510},
1007 	   {0x08, 0x08, 0x08, 0x08},
1008 	   WDQLVL_PAT,
1009 	   {0, 0, 0, 0, 0, 0, 0, 0,
1010 	    0, 0},
1011 	   {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, 0, 0, 0, 0,
1015 	    0, 0, 0, 0, 0, 0, 0, 0},
1016 	   {0, 0, 0, 0},
1017 	   {0, 0, 0, 0, 0, 0, 0, 0,
1018 	    0, 0, 0, 0, 0, 0, 0, 0,
1019 	    0, 0, 0, 0, 0, 0, 0, 0,
1020 	    0, 0, 0, 0, 0, 0, 0, 0}
1021 	   },
1022 	{
1023 	   {0x02, 0xff},
1024 	   0x00543210,
1025 	   0x2301,
1026 	   {0x23764510, 0x43257610, 0x43752610, 0x37652401},
1027 	   {0x08, 0x08, 0x08, 0x08},
1028 	   WDQLVL_PAT,
1029 	   {-128, -128, -128, -128, -128, -128, 0, 0,
1030 	    0, 0},
1031 	   {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, 0, 0, 0, 0,
1035 	    0, 0, 0, 0, 0, 0, 0, 0},
1036 	   {0, 0, 0, 0},
1037 	   {0, 0, 0, 0, 0, 0, 0, 0,
1038 	    0, 0, 0, 0, 0, 0, 0, 0,
1039 	    0, 0, 0, 0, 0, 0, 0, 0,
1040 	    0, 0, 0, 0, 0, 0, 0, 0}
1041 	   },
1042 	{
1043 	   {0x02, 0xff},
1044 	   0x00452103,
1045 	   0x3210,
1046 	   {0x32764510, 0x43257610, 0x43752610, 0x26573401},
1047 	   {0x08, 0x08, 0x08, 0x08},
1048 	   WDQLVL_PAT,
1049 	   {0, 0, 0, 0, 0, 0, 0, 0,
1050 	    0, 0},
1051 	   {0, 0, 0, 0},
1052 	   {0, 0, 0, 0, 0, 0, 0, 0,
1053 	    0, 0, 0, 0, 0, 0, 0, 0,
1054 	    0, 0, 0, 0, 0, 0, 0, 0,
1055 	    0, 0, 0, 0, 0, 0, 0, 0},
1056 	   {0, 0, 0, 0},
1057 	   {0, 0, 0, 0, 0, 0, 0, 0,
1058 	    0, 0, 0, 0, 0, 0, 0, 0,
1059 	    0, 0, 0, 0, 0, 0, 0, 0,
1060 	    0, 0, 0, 0, 0, 0, 0, 0}
1061 	   },
1062 	{
1063 	   {0x02, 0xff},
1064 	   0x00520413,
1065 	   0x2301,
1066 	   {0x47652301, 0x75346210, 0x53467210, 0x32674501},
1067 	   {0x08, 0x08, 0x08, 0x08},
1068 	   WDQLVL_PAT,
1069 	   {30, 30, 30, 30, 30, 30, 30, 30,
1070 	    30, 30},
1071 	   {0, 0, 0, 0},
1072 	   {0, 0, 0, 0, 0, 0, 0, 0,
1073 	    0, 0, 0, 0, 0, 0, 0, 0,
1074 	    0, 0, 0, 0, 0, 0, 0, 0,
1075 	    0, 0, 0, 0, 0, 0, 0, 0},
1076 	   {0, 0, 0, 0},
1077 	   {0, 0, 0, 0, 0, 0, 0, 0,
1078 	    0, 0, 0, 0, 0, 0, 0, 0,
1079 	    0, 0, 0, 0, 0, 0, 0, 0,
1080 	    0, 0, 0, 0, 0, 0, 0, 0}
1081 	}
1082 	}
1083 	 },
1084 /* boardcnf[10] RENESAS Kriek(2rank) board with M3-N/SoC */
1085 	{
1086 	 0x01,
1087 	 0x01,
1088 	 0x300,
1089 	 0,
1090 	 0x300,
1091 	 0x0a0,
1092 	{
1093 	{
1094 	   {0x02, 0x02},
1095 	   0x00345201,
1096 	   0x3201,
1097 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1098 	   {0x08, 0x08, 0x08, 0x08},
1099 	   WDQLVL_PAT,
1100 	   {0, 0, 0, 0, 0, 0, 0, 0,
1101 	    0, 0},
1102 	   {0, 0, 0, 0},
1103 	   {0, 0, 0, 0, 0, 0, 0, 0,
1104 	    0, 0, 0, 0, 0, 0, 0, 0,
1105 	    0, 0, 0, 0, 0, 0, 0, 0,
1106 	    0, 0, 0, 0, 0, 0, 0, 0},
1107 	   {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, 0, 0, 0, 0}
1112 	}
1113 	}
1114 	 },
1115 /* boardcnf[11] RENESAS SALVATOR-X board with M3-N/SIP(8Gbit 2rank) */
1116 	{
1117 	 0x01,
1118 	 0x01,
1119 	 0x300,
1120 	 0,
1121 	 0x300,
1122 	 0x0a0,
1123 	{
1124 	{
1125 #if (RCAR_DRAM_LPDDR4_MEMCONF == 2)
1126 	   {0x04, 0x04},
1127 #else
1128 	   {0x02, 0x02},
1129 #endif
1130 	   0x00342501,
1131 	   0x3201,
1132 	   {0x10672534, 0x43257106, 0x34527601, 0x71605243},
1133 	   {0x08, 0x08, 0x08, 0x08},
1134 	   WDQLVL_PAT,
1135 	   {0, 0, 0, 0, 0, 0, 0, 0,
1136 	    0, 0},
1137 	   {0, 0, 0, 0},
1138 	   {0, 0, 0, 0, 0, 0, 0, 0,
1139 	    0, 0, 0, 0, 0, 0, 0, 0,
1140 	    0, 0, 0, 0, 0, 0, 0, 0,
1141 	    0, 0, 0, 0, 0, 0, 0, 0},
1142 	   {0, 0, 0, 0},
1143 	   {0, 0, 0, 0, 0, 0, 0, 0,
1144 	    0, 0, 0, 0, 0, 0, 0, 0,
1145 	    0, 0, 0, 0, 0, 0, 0, 0,
1146 	    0, 0, 0, 0, 0, 0, 0, 0}
1147 	}
1148 	}
1149 	 },
1150 /* boardcnf[12] RENESAS CONDOR board with V3H/SoC */
1151 	{
1152 	 0x01,
1153 	 0x1,
1154 	 0x300,
1155 	 0,
1156 	 0x300,
1157 	 0x0a0,
1158 	{
1159 	{
1160 	   {0x02, 0x02},
1161 	   0x00501342,
1162 	   0x3201,
1163 	   {0x70562134, 0x34526071, 0x23147506, 0x12430567},
1164 	   {0x08, 0x08, 0x08, 0x08},
1165 	   WDQLVL_PAT,
1166 	   {0, 0, 0, 0, 0, 0, 0, 0,
1167 	    0, 0},
1168 	   {0, 0, 0, 0},
1169 	   {0, 0, 0, 0, 0, 0, 0, 0,
1170 	    0, 0, 0, 0, 0, 0, 0, 0,
1171 	    0, 0, 0, 0, 0, 0, 0, 0,
1172 	    0, 0, 0, 0, 0, 0, 0, 0},
1173 	   {0, 0, 0, 0},
1174 	   {0, 0, 0, 0, 0, 0, 0, 0,
1175 	    0, 0, 0, 0, 0, 0, 0, 0,
1176 	    0, 0, 0, 0, 0, 0, 0, 0,
1177 	    0, 0, 0, 0, 0, 0, 0, 0}
1178 	}
1179 	}
1180 	 },
1181 /* boardcnf[13] RENESAS KRIEK board with PM3/SoC */
1182 	{
1183 	 0x05,
1184 	 0x00,
1185 	 0x2c0,
1186 	 -320,
1187 	 0x300,
1188 	 0x0a0,
1189 	{
1190 	{
1191 	   {0x02, 0x02},
1192 	   0x00345201,
1193 	   0x3201,
1194 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1195 	   {0x08, 0x08, 0x08, 0x08},
1196 	   WDQLVL_PAT,
1197 	   {0, 0, 0, 0, 0, 0, 0, 0,
1198 	    0, 0},
1199 	   {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, 0, 0, 0, 0},
1204 	   {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 	    0, 0, 0, 0, 0, 0, 0, 0}
1209 	   },
1210 	{
1211 	   {0x02, 0x02},
1212 	   0x00302154,
1213 	   0x2310,
1214 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1215 	   {0x08, 0x08, 0x08, 0x08},
1216 	   WDQLVL_PAT,
1217 	   {0, 0, 0, 0, 0, 0, 0, 0,
1218 	    0, 0},
1219 	   {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, 0, 0, 0, 0},
1224 	   {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 	    0, 0, 0, 0, 0, 0, 0, 0}
1229 	   },
1230 	{
1231 	   {0x02, 0x02},
1232 	   0x00302154,
1233 	   0x2310,
1234 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1235 	   {0x08, 0x08, 0x08, 0x08},
1236 	   WDQLVL_PAT,
1237 	   {0, 0, 0, 0, 0, 0, 0, 0,
1238 	    0, 0},
1239 	   {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, 0, 0, 0, 0},
1244 	   {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 	    0, 0, 0, 0, 0, 0, 0, 0}
1249 	   },
1250 	{
1251 	   {0xff, 0xff},
1252 	   0,
1253 	   0,
1254 	   {0, 0, 0, 0},
1255 	   {0, 0, 0, 0},
1256 	   WDQLVL_PAT,
1257 	   {0, 0, 0, 0, 0, 0, 0, 0,
1258 	    0, 0},
1259 	   {0, 0, 0, 0},
1260 	   {0, 0, 0, 0, 0, 0, 0, 0,
1261 	    0, 0, 0, 0, 0, 0, 0, 0,
1262 	    0, 0, 0, 0, 0, 0, 0, 0,
1263 	    0, 0, 0, 0, 0, 0, 0, 0},
1264 	   {0, 0, 0, 0},
1265 	   {0, 0, 0, 0, 0, 0, 0, 0,
1266 	    0, 0, 0, 0, 0, 0, 0, 0,
1267 	    0, 0, 0, 0, 0, 0, 0, 0,
1268 	    0, 0, 0, 0, 0, 0, 0, 0}
1269 	}
1270 	}
1271 	 },
1272 /* boardcnf[14] SALVATOR-X board with H3 Ver.2.0 or later/SIP(16Gbit 1rank) */
1273 	{
1274 #if RCAR_DRAM_CHANNEL == 5
1275 	 0x05,
1276 #else
1277 	 0x0f,
1278 #endif
1279 	 0x01,
1280 	 0x300,
1281 	 0,
1282 	 0x300,
1283 	 0x0a0,
1284 	{
1285 	{
1286 	   {0x04, 0xff},
1287 	   0x00543210,
1288 	   0x2310,
1289 	   {0x70631425, 0x34527016, 0x43527610, 0x32104567},
1290 	   {0x08, 0x08, 0x08, 0x08},
1291 	   WDQLVL_PAT,
1292 	   {0, 0, 0, 0, 0, 0, 0, 0,
1293 	    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 	   {0, 0, 0, 0},
1300 	   {0, 0, 0, 0, 0, 0, 0, 0,
1301 	    0, 0, 0, 0, 0, 0, 0, 0,
1302 	    0, 0, 0, 0, 0, 0, 0, 0,
1303 	    0, 0, 0, 0, 0, 0, 0, 0}
1304 	   },
1305 #if ((RCAR_DRAM_CHANNEL == 5) && (RCAR_DRAM_SPLIT == 2))
1306 	{
1307 	   {0x04, 0xff},
1308 	   0x00543210,
1309 	   0x2301,
1310 	   {0x01327654, 0x02316457, 0x10234567, 0x01325467},
1311 	   {0x08, 0x08, 0x08, 0x08},
1312 	   WDQLVL_PAT,
1313 	   {0, 0, 0, 0, 0, 0, 0, 0,
1314 	    0, 0},
1315 	   {0, 0, 0, 0},
1316 	   {0, 0, 0, 0, 0, 0, 0, 0,
1317 	    0, 0, 0, 0, 0, 0, 0, 0,
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 	   },
1326 #else
1327 	{
1328 	   {0x04, 0xff},
1329 	   0x00105432,
1330 	   0x3210,
1331 	   {0x43256107, 0x07162354, 0x10234567, 0x01235467},
1332 	   {0x08, 0x08, 0x08, 0x08},
1333 	   WDQLVL_PAT,
1334 	   {0, 0, 0, 0, 0, 0, 0, 0,
1335 	    0, 0},
1336 	   {0, 0, 0, 0},
1337 	   {0, 0, 0, 0, 0, 0, 0, 0,
1338 	    0, 0, 0, 0, 0, 0, 0, 0,
1339 	    0, 0, 0, 0, 0, 0, 0, 0,
1340 	    0, 0, 0, 0, 0, 0, 0, 0},
1341 	   {0, 0, 0, 0},
1342 	   {0, 0, 0, 0, 0, 0, 0, 0,
1343 	    0, 0, 0, 0, 0, 0, 0, 0,
1344 	    0, 0, 0, 0, 0, 0, 0, 0,
1345 	    0, 0, 0, 0, 0, 0, 0, 0}
1346 	   },
1347 #endif
1348 	{
1349 	   {0x04, 0xff},
1350 	   0x00543210,
1351 	   0x2301,
1352 	   {0x01327654, 0x02316457, 0x10234567, 0x01325467},
1353 	   {0x08, 0x08, 0x08, 0x08},
1354 	   WDQLVL_PAT,
1355 	   {0, 0, 0, 0, 0, 0, 0, 0,
1356 	    0, 0},
1357 	   {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 	    0, 0, 0, 0, 0, 0, 0, 0},
1362 	   {0, 0, 0, 0},
1363 	   {0, 0, 0, 0, 0, 0, 0, 0,
1364 	    0, 0, 0, 0, 0, 0, 0, 0,
1365 	    0, 0, 0, 0, 0, 0, 0, 0,
1366 	    0, 0, 0, 0, 0, 0, 0, 0}
1367 	   },
1368 	{
1369 	   {0x04, 0xff},
1370 	   0x00543210,
1371 	   0x2301,
1372 	   {0x12034765, 0x23105467, 0x23017645, 0x32106745},
1373 	   {0x08, 0x08, 0x08, 0x08},
1374 	   WDQLVL_PAT,
1375 	   {0, 0, 0, 0, 0, 0, 0, 0,
1376 	    0, 0},
1377 	   {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 	    0, 0, 0, 0, 0, 0, 0, 0},
1382 	   {0, 0, 0, 0},
1383 	   {0, 0, 0, 0, 0, 0, 0, 0,
1384 	    0, 0, 0, 0, 0, 0, 0, 0,
1385 	    0, 0, 0, 0, 0, 0, 0, 0,
1386 	    0, 0, 0, 0, 0, 0, 0, 0}
1387 	}
1388 	}
1389 	 },
1390 /* boardcnf[15] RENESAS KRIEK board with H3N */
1391 	{
1392 	 0x05,
1393 	 0x01,
1394 	 0x300,
1395 	 0,
1396 	 0x300,
1397 	 0x0a0,
1398 	{
1399 	{
1400 	   {0x02, 0x02},
1401 	   0x00345201,
1402 	   0x3201,
1403 	   {0x01672543, 0x45367012, 0x45632107, 0x60715234},
1404 	   {0x08, 0x08, 0x08, 0x08},
1405 	   WDQLVL_PAT,
1406 	   {0, 0, 0, 0, 0, 0, 0, 0,
1407 	    0, 0},
1408 	   {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 	    0, 0, 0, 0, 0, 0, 0, 0},
1413 	   {0, 0, 0, 0},
1414 	   {0, 0, 0, 0, 0, 0, 0, 0,
1415 	    0, 0, 0, 0, 0, 0, 0, 0,
1416 	    0, 0, 0, 0, 0, 0, 0, 0,
1417 	    0, 0, 0, 0, 0, 0, 0, 0}
1418 	   },
1419 	{
1420 	   {0x02, 0x02},
1421 	   0x00302154,
1422 	   0x2310,
1423 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1424 	   {0x08, 0x08, 0x08, 0x08},
1425 	   WDQLVL_PAT,
1426 	   {0, 0, 0, 0, 0, 0, 0, 0,
1427 	    0, 0},
1428 	   {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 	    0, 0, 0, 0, 0, 0, 0, 0},
1433 	   {0, 0, 0, 0},
1434 	   {0, 0, 0, 0, 0, 0, 0, 0,
1435 	    0, 0, 0, 0, 0, 0, 0, 0,
1436 	    0, 0, 0, 0, 0, 0, 0, 0,
1437 	    0, 0, 0, 0, 0, 0, 0, 0}
1438 	   },
1439 	{
1440 	   {0x02, 0x02},
1441 	   0x00302154,
1442 	   0x2310,
1443 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1444 	   {0x08, 0x08, 0x08, 0x08},
1445 	   WDQLVL_PAT,
1446 	   {0, 0, 0, 0, 0, 0, 0, 0,
1447 	    0, 0},
1448 	   {0, 0, 0, 0},
1449 	   {0, 0, 0, 0, 0, 0, 0, 0,
1450 	    0, 0, 0, 0, 0, 0, 0, 0,
1451 	    0, 0, 0, 0, 0, 0, 0, 0,
1452 	    0, 0, 0, 0, 0, 0, 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 	   },
1459 	{
1460 	   {0xff, 0xff},
1461 	   0,
1462 	   0,
1463 	   {0, 0, 0, 0},
1464 	   {0, 0, 0, 0},
1465 	   WDQLVL_PAT,
1466 	   {0, 0, 0, 0, 0, 0, 0, 0,
1467 	    0, 0},
1468 	   {0, 0, 0, 0},
1469 	   {0, 0, 0, 0, 0, 0, 0, 0,
1470 	    0, 0, 0, 0, 0, 0, 0, 0,
1471 	    0, 0, 0, 0, 0, 0, 0, 0,
1472 	    0, 0, 0, 0, 0, 0, 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 	}
1479 	}
1480 	 },
1481 /* boardcnf[16] RENESAS KRIEK-P2P board with M3-W/SoC */
1482 	{
1483 	 0x03,
1484 	 0x01,
1485 	 0x0320,
1486 	 0,
1487 	 0x0300,
1488 	 0x00a0,
1489 	{
1490 	{
1491 	   {0x04, 0x04},
1492 	    0x520314FFFF523041,
1493 	    0x3201,
1494 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1495 	   {0x08, 0x08, 0x08, 0x08},
1496 	    WDQLVL_PAT,
1497 	   {0, 0, 0, 0, 0, 0, 0, 0,
1498 	    0, 0, 0, 0, 0, 0, 0, 0},
1499 	   {0, 0, 0, 0},
1500 	   {0, 0, 0, 0, 0, 0, 0, 0,
1501 	    0, 0, 0, 0, 0, 0, 0, 0,
1502 	    0, 0, 0, 0, 0, 0, 0, 0,
1503 	    0, 0, 0, 0, 0, 0, 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 	   },
1510 	{
1511 	   {0x04, 0x04},
1512 	    0x314250FFFF312405,
1513 	    0x2310,
1514 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1515 	   {0x08, 0x08, 0x08, 0x08},
1516 	    WDQLVL_PAT,
1517 	   {0, 0, 0, 0, 0, 0, 0, 0,
1518 	    0, 0, 0, 0, 0, 0, 0, 0},
1519 	   {0, 0, 0, 0},
1520 	   {0, 0, 0, 0, 0, 0, 0, 0,
1521 	    0, 0, 0, 0, 0, 0, 0, 0,
1522 	    0, 0, 0, 0, 0, 0, 0, 0,
1523 	    0, 0, 0, 0, 0, 0, 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 	}
1530 	}
1531 	 },
1532 /* boardcnf[17] RENESAS KRIEK-P2P board with M3-N/SoC */
1533 	{
1534 	 0x01,
1535 	 0x01,
1536 	 0x0300,
1537 	 0,
1538 	 0x0300,
1539 	 0x00a0,
1540 	{
1541 	{
1542 	   {0x04, 0x04},
1543 	    0x520314FFFF523041,
1544 	    0x3201,
1545 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1546 	   {0x08, 0x08, 0x08, 0x08},
1547 	    WDQLVL_PAT,
1548 	   {0, 0, 0, 0, 0, 0, 0, 0,
1549 	    0, 0, 0, 0, 0, 0, 0, 0},
1550 	   {0, 0, 0, 0},
1551 	   {0, 0, 0, 0, 0, 0, 0, 0,
1552 	    0, 0, 0, 0, 0, 0, 0, 0,
1553 	    0, 0, 0, 0, 0, 0, 0, 0,
1554 	    0, 0, 0, 0, 0, 0, 0, 0},
1555 	   {0, 0, 0, 0},
1556 	   {0, 0, 0, 0, 0, 0, 0, 0,
1557 	    0, 0, 0, 0, 0, 0, 0, 0,
1558 	    0, 0, 0, 0, 0, 0, 0, 0,
1559 	    0, 0, 0, 0, 0, 0, 0, 0}
1560 	}
1561 	}
1562 	},
1563 /* boardcnf[18] RENESAS SALVATOR-X board with M3-W/SIP(16Gbit 2rank) */
1564 	{
1565 	 0x03,
1566 	 0x01,
1567 	 0x02c0,
1568 	 0,
1569 	 0x0300,
1570 	 0x00a0,
1571 	{
1572 	{
1573 	   {0x04, 0x04},
1574 	    0x00543210,
1575 	    0x3201,
1576 	   {0x70612543, 0x43251670, 0x45326170, 0x10672534},
1577 	   {0x08, 0x08, 0x08, 0x08},
1578 	   WDQLVL_PAT,
1579 	   {0, 0, 0, 0, 0, 0, 0, 0,
1580 	    0, 0},
1581 	   {0, 0, 0, 0},
1582 	   {0, 0, 0, 0, 0, 0, 0, 0,
1583 	    0, 0, 0, 0, 0, 0, 0, 0,
1584 	    0, 0, 0, 0, 0, 0, 0, 0,
1585 	    0, 0, 0, 0, 0, 0, 0, 0},
1586 	   {0, 0, 0, 0},
1587 	   {0, 0, 0, 0, 0, 0, 0, 0,
1588 	    0, 0, 0, 0, 0, 0, 0, 0,
1589 	    0, 0, 0, 0, 0, 0, 0, 0,
1590 	    0, 0, 0, 0, 0, 0, 0, 0}
1591 	   },
1592 	{
1593 	   {0x04, 0x04},
1594 	    0x00543210,
1595 	    0x2310,
1596 	   {0x01327654, 0x34526107, 0x35421670, 0x70615324},
1597 	   {0x08, 0x08, 0x08, 0x08},
1598 	   WDQLVL_PAT,
1599 	   {0, 0, 0, 0, 0, 0, 0, 0,
1600 	    0, 0},
1601 	   {0, 0, 0, 0},
1602 	   {0, 0, 0, 0, 0, 0, 0, 0,
1603 	    0, 0, 0, 0, 0, 0, 0, 0,
1604 	    0, 0, 0, 0, 0, 0, 0, 0,
1605 	    0, 0, 0, 0, 0, 0, 0, 0},
1606 	   {0, 0, 0, 0},
1607 	   {0, 0, 0, 0, 0, 0, 0, 0,
1608 	    0, 0, 0, 0, 0, 0, 0, 0,
1609 	    0, 0, 0, 0, 0, 0, 0, 0,
1610 	    0, 0, 0, 0, 0, 0, 0, 0}
1611 	}
1612 	}
1613 	},
1614 /* boardcnf[19] RENESAS SALVATOR-X board with M3-W/SIP(16Gbit 1rank) */
1615 	{
1616 	 0x03,
1617 	 0x01,
1618 	 0x02c0,
1619 	 0,
1620 	 0x0300,
1621 	 0x00a0,
1622 	{
1623 	{
1624 	   {0x04, 0xff},
1625 	    0x00543210,
1626 	    0x3201,
1627 	   {0x70612543, 0x43251670, 0x45326170, 0x10672534},
1628 	   {0x08, 0x08, 0x08, 0x08},
1629 	   WDQLVL_PAT,
1630 	   {0, 0, 0, 0, 0, 0, 0, 0,
1631 	    0, 0},
1632 	   {0, 0, 0, 0},
1633 	   {0, 0, 0, 0, 0, 0, 0, 0,
1634 	    0, 0, 0, 0, 0, 0, 0, 0,
1635 	    0, 0, 0, 0, 0, 0, 0, 0,
1636 	    0, 0, 0, 0, 0, 0, 0, 0},
1637 	   {0, 0, 0, 0},
1638 	   {0, 0, 0, 0, 0, 0, 0, 0,
1639 	    0, 0, 0, 0, 0, 0, 0, 0,
1640 	    0, 0, 0, 0, 0, 0, 0, 0,
1641 	    0, 0, 0, 0, 0, 0, 0, 0}
1642 	   },
1643 	{
1644 	   {0x04, 0xff},
1645 	    0x00543210,
1646 	    0x2310,
1647 	   {0x01327654, 0x34526107, 0x35421670, 0x70615324},
1648 	   {0x08, 0x08, 0x08, 0x08},
1649 	   WDQLVL_PAT,
1650 	   {0, 0, 0, 0, 0, 0, 0, 0,
1651 	    0, 0},
1652 	   {0, 0, 0, 0},
1653 	   {0, 0, 0, 0, 0, 0, 0, 0,
1654 	    0, 0, 0, 0, 0, 0, 0, 0,
1655 	    0, 0, 0, 0, 0, 0, 0, 0,
1656 	    0, 0, 0, 0, 0, 0, 0, 0},
1657 	   {0, 0, 0, 0},
1658 	   {0, 0, 0, 0, 0, 0, 0, 0,
1659 	    0, 0, 0, 0, 0, 0, 0, 0,
1660 	    0, 0, 0, 0, 0, 0, 0, 0,
1661 	    0, 0, 0, 0, 0, 0, 0, 0}
1662 	}
1663 	}
1664 	},
1665 /* boardcnf[20] RENESAS KRIEK 16Gbit/2rank/2ch board with M3-W/SoC */
1666 	{
1667 	 0x03,
1668 	 0x01,
1669 	 0x02c0,
1670 	 0,
1671 	 0x0300,
1672 	 0x00a0,
1673 	{
1674 	{
1675 	   {0x04, 0x04},
1676 	    0x00345201,
1677 	    0x3201,
1678 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1679 	   {0x08, 0x08, 0x08, 0x08},
1680 	    WDQLVL_PAT,
1681 	   {0, 0, 0, 0, 0, 0, 0, 0,
1682 	    0, 0},
1683 	   {0, 0, 0, 0},
1684 	   {0, 0, 0, 0, 0, 0, 0, 0,
1685 	    0, 0, 0, 0, 0, 0, 0, 0,
1686 	    0, 0, 0, 0, 0, 0, 0, 0,
1687 	    0, 0, 0, 0, 0, 0, 0, 0},
1688 	   {0, 0, 0, 0},
1689 	   {0, 0, 0, 0, 0, 0, 0, 0,
1690 	    0, 0, 0, 0, 0, 0, 0, 0,
1691 	    0, 0, 0, 0, 0, 0, 0, 0,
1692 	    0, 0, 0, 0, 0, 0, 0, 0}
1693 	   },
1694 	{
1695 	   {0x04, 0x04},
1696 	    0x00302154,
1697 	    0x2310,
1698 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1699 	   {0x08, 0x08, 0x08, 0x08},
1700 	   WDQLVL_PAT,
1701 	   {0, 0, 0, 0, 0, 0, 0, 0,
1702 	    0, 0},
1703 	   {0, 0, 0, 0},
1704 	   {0, 0, 0, 0, 0, 0, 0, 0,
1705 	    0, 0, 0, 0, 0, 0, 0, 0,
1706 	    0, 0, 0, 0, 0, 0, 0, 0,
1707 	    0, 0, 0, 0, 0, 0, 0, 0},
1708 	   {0, 0, 0, 0},
1709 	   {0, 0, 0, 0, 0, 0, 0, 0,
1710 	    0, 0, 0, 0, 0, 0, 0, 0,
1711 	    0, 0, 0, 0, 0, 0, 0, 0,
1712 	    0, 0, 0, 0, 0, 0, 0, 0}
1713 	}
1714 	}
1715 	},
1716 /* boardcnf[21] RENESAS KRIEK 16Gbit/1rank/2ch board with M3-W/SoC */
1717 	{
1718 	 0x03,
1719 	 0x01,
1720 	 0x02c0,
1721 	 0,
1722 	 0x0300,
1723 	 0x00a0,
1724 	{
1725 	{
1726 	   {0x04, 0xff},
1727 	    0x00345201,
1728 	    0x3201,
1729 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1730 	   {0x08, 0x08, 0x08, 0x08},
1731 	   WDQLVL_PAT,
1732 	   {0, 0, 0, 0, 0, 0, 0, 0,
1733 	    0, 0},
1734 	   {0, 0, 0, 0},
1735 	   {0, 0, 0, 0, 0, 0, 0, 0,
1736 	    0, 0, 0, 0, 0, 0, 0, 0,
1737 	    0, 0, 0, 0, 0, 0, 0, 0,
1738 	    0, 0, 0, 0, 0, 0, 0, 0},
1739 	   {0, 0, 0, 0},
1740 	   {0, 0, 0, 0, 0, 0, 0, 0,
1741 	    0, 0, 0, 0, 0, 0, 0, 0,
1742 	    0, 0, 0, 0, 0, 0, 0, 0,
1743 	    0, 0, 0, 0, 0, 0, 0, 0}
1744 	   },
1745 	{
1746 	   {0x04, 0xff},
1747 	    0x00302154,
1748 	    0x2310,
1749 	   {0x01672543, 0x45361207, 0x45632107, 0x60715234},
1750 	   {0x08, 0x08, 0x08, 0x08},
1751 	   WDQLVL_PAT,
1752 	   {0, 0, 0, 0, 0, 0, 0, 0,
1753 	    0, 0},
1754 	   {0, 0, 0, 0},
1755 	   {0, 0, 0, 0, 0, 0, 0, 0,
1756 	    0, 0, 0, 0, 0, 0, 0, 0,
1757 	    0, 0, 0, 0, 0, 0, 0, 0,
1758 	    0, 0, 0, 0, 0, 0, 0, 0},
1759 	   {0, 0, 0, 0},
1760 	   {0, 0, 0, 0, 0, 0, 0, 0,
1761 	    0, 0, 0, 0, 0, 0, 0, 0,
1762 	    0, 0, 0, 0, 0, 0, 0, 0,
1763 	    0, 0, 0, 0, 0, 0, 0, 0}
1764 	}
1765 	}
1766 	}
1767 };
1768 #endif /* RZG_SOC == 1 */
1769 
boardcnf_get_brd_clk(uint32_t brd,uint32_t * clk,uint32_t * div)1770 void boardcnf_get_brd_clk(uint32_t brd, uint32_t *clk, uint32_t *div)
1771 {
1772 	uint32_t md;
1773 
1774 	if ((prr_product == PRR_PRODUCT_H3) && (prr_cut == PRR_PRODUCT_10)) {
1775 		*clk = 50;
1776 		*div = 3;
1777 	} else {
1778 		md = (mmio_read_32(RST_MODEMR) >> 13) & 0x3;
1779 		switch (md) {
1780 		case 0x0:
1781 			*clk = 50;
1782 			*div = 3;
1783 			break;
1784 		case 0x1:
1785 			*clk = 60;
1786 			*div = 3;
1787 			break;
1788 		case 0x2:
1789 			*clk = 75;
1790 			*div = 3;
1791 			break;
1792 		case 0x3:
1793 			*clk = 100;
1794 			*div = 3;
1795 			break;
1796 		}
1797 	}
1798 	(void)brd;
1799 }
1800 
boardcnf_get_ddr_mbps(uint32_t brd,uint32_t * mbps,uint32_t * div)1801 void boardcnf_get_ddr_mbps(uint32_t brd, uint32_t *mbps, uint32_t *div)
1802 {
1803 	uint32_t md;
1804 
1805 	if (prr_product == PRR_PRODUCT_V3H) {
1806 		md = (mmio_read_32(RST_MODEMR) >> 19) & 0x1;
1807 		md = (md | (md << 1)) & 0x3; /* 0 or 3 */
1808 	} else {
1809 		md = (mmio_read_32(RST_MODEMR) >> 17) & 0x5;
1810 		md = (md | (md >> 1)) & 0x3;
1811 	}
1812 	switch (md) {
1813 	case 0x0:
1814 		*mbps = 3200;
1815 		*div = 1;
1816 		break;
1817 	case 0x1:
1818 		*mbps = 2800;
1819 		*div = 1;
1820 		break;
1821 	case 0x2:
1822 		*mbps = 2400;
1823 		*div = 1;
1824 		break;
1825 	case 0x3:
1826 		*mbps = 1600;
1827 		*div = 1;
1828 		break;
1829 	}
1830 	(void)brd;
1831 }
1832 
1833 #define _def_REFPERIOD  1890
1834 
1835 #define M3_SAMPLE_TT_A84        0xB866CC10, 0x3B250421
1836 #define M3_SAMPLE_TT_A85        0xB866CC10, 0x3AA50421
1837 #define M3_SAMPLE_TT_A86        0xB866CC10, 0x3AA48421
1838 #define M3_SAMPLE_FF_B45        0xB866CC10, 0x3AB00C21
1839 #define M3_SAMPLE_FF_B49        0xB866CC10, 0x39B10C21
1840 #define M3_SAMPLE_FF_B56        0xB866CC10, 0x3AAF8C21
1841 #define M3_SAMPLE_SS_E24        0xB866CC10, 0x3BA39421
1842 #define M3_SAMPLE_SS_E28        0xB866CC10, 0x3C231421
1843 #define M3_SAMPLE_SS_E32        0xB866CC10, 0x3C241421
1844 
1845 static const uint32_t termcode_by_sample[20][3] = {
1846 	{M3_SAMPLE_TT_A84, 0x000158D5},
1847 	{M3_SAMPLE_TT_A85, 0x00015955},
1848 	{M3_SAMPLE_TT_A86, 0x00015955},
1849 	{M3_SAMPLE_FF_B45, 0x00015690},
1850 	{M3_SAMPLE_FF_B49, 0x00015753},
1851 	{M3_SAMPLE_FF_B56, 0x00015793},
1852 	{M3_SAMPLE_SS_E24, 0x00015996},
1853 	{M3_SAMPLE_SS_E28, 0x000159D7},
1854 	{M3_SAMPLE_SS_E32, 0x00015997},
1855 	{0xFFFFFFFF, 0xFFFFFFFF, 0x0001554F}
1856 };
1857 
1858 #ifdef BOARD_JUDGE_AUTO
1859 /*
1860  * SAMPLE board detect function
1861  */
1862 #define PFC_PMMR	0xE6060000U
1863 #define PFC_PUEN5	0xE6060414U
1864 #define PFC_PUEN6	0xE6060418U
1865 #define PFC_PUD5	0xE6060454U
1866 #define PFC_PUD6	0xE6060458U
1867 #define GPIO_INDT5	0xE605500CU
1868 #define GPIO_GPSR6	0xE6060118U
1869 
1870 #if (RCAR_GEN3_ULCB == 0) && (RZG_SOC == 0)
pfc_write_and_poll(uint32_t a,uint32_t v)1871 static void pfc_write_and_poll(uint32_t a, uint32_t v)
1872 {
1873 	mmio_write_32(PFC_PMMR, ~v);
1874 	v = ~mmio_read_32(PFC_PMMR);
1875 	mmio_write_32(a, v);
1876 	while (v != mmio_read_32(a))
1877 		;
1878 	dsb_sev();
1879 }
1880 #endif
1881 
1882 #ifndef RCAR_GEN3_ULCB
1883 #define RCAR_GEN3_ULCB		0
1884 #endif
1885 
1886 #if (RCAR_GEN3_ULCB == 0) && (RZG_SOC == 0)	/* non Starter Kit */
1887 
opencheck_SSI_WS6(void)1888 static uint32_t opencheck_SSI_WS6(void)
1889 {
1890 	uint32_t dataL, down, up;
1891 	uint32_t gpsr6_bak;
1892 	uint32_t puen5_bak;
1893 	uint32_t pud5_bak;
1894 
1895 	gpsr6_bak = mmio_read_32(GPIO_GPSR6);
1896 	puen5_bak = mmio_read_32(PFC_PUEN5);
1897 	pud5_bak = mmio_read_32(PFC_PUD5);
1898 	dsb_sev();
1899 
1900 	dataL = (gpsr6_bak & ~BIT(15));
1901 	pfc_write_and_poll(GPIO_GPSR6, dataL);
1902 
1903 	/* Pull-Up/Down Enable (PUEN5[22]=1) */
1904 	dataL = puen5_bak;
1905 	dataL |= (BIT(22));
1906 	pfc_write_and_poll(PFC_PUEN5, dataL);
1907 
1908 	/* Pull-Down-Enable (PUD5[22]=0, PUEN5[22]=1) */
1909 	dataL = pud5_bak;
1910 	dataL &= ~(BIT(22));
1911 	pfc_write_and_poll(PFC_PUD5, dataL);
1912 	/* GPSR6[15]=SSI_WS6 */
1913 	rcar_micro_delay(10);
1914 	down = (mmio_read_32(GPIO_INDT6) >> 15) & 0x1;
1915 	dsb_sev();
1916 
1917 	/* Pull-Up-Enable (PUD5[22]=1, PUEN5[22]=1) */
1918 	dataL = pud5_bak;
1919 	dataL |= (BIT(22));
1920 	pfc_write_and_poll(PFC_PUD5, dataL);
1921 
1922 	/* GPSR6[15]=SSI_WS6 */
1923 	rcar_micro_delay(10);
1924 	up = (mmio_read_32(GPIO_INDT6) >> 15) & 0x1;
1925 
1926 	dsb_sev();
1927 
1928 	pfc_write_and_poll(GPIO_GPSR6, gpsr6_bak);
1929 	pfc_write_and_poll(PFC_PUEN5, puen5_bak);
1930 	pfc_write_and_poll(PFC_PUD5, pud5_bak);
1931 
1932 	if (down == up) {
1933 		/* Same = Connect */
1934 		return 0;
1935 	}
1936 
1937 	/* Diff = Open */
1938 	return 1;
1939 }
1940 
1941 #endif
1942 
1943 #if (RZG_SOC == 1)
1944 #define LPDDR4_2RANK   (0x01U << 25U)
1945 
rzg2_board_judge(void)1946 static uint32_t rzg2_board_judge(void)
1947 {
1948 	uint32_t brd;
1949 
1950 	switch (prr_product) {
1951 	case PRR_PRODUCT_M3:
1952 		brd = 1U;
1953 		if ((mmio_read_32(PRR) & PRR_CUT_MASK) != RCAR_M3_CUT_VER11) {
1954 			if ((mmio_read_32(GPIO_INDT5) & LPDDR4_2RANK) == 0U) {
1955 				brd = 0U;
1956 			}
1957 		}
1958 		break;
1959 	case PRR_PRODUCT_H3:
1960 		brd = 2U;
1961 		break;
1962 	case PRR_PRODUCT_M3N:
1963 		brd = 3U;
1964 		break;
1965 	default:
1966 		brd = 99U;
1967 	}
1968 
1969 	return brd;
1970 }
1971 #endif /* RZG_SOC == 1 */
1972 
1973 #if (RZG_SOC == 0) && (RCAR_DRAM_LPDDR4_MEMCONF != 0)
ddr_rank_judge(void)1974 static uint32_t ddr_rank_judge(void)
1975 {
1976 	uint32_t brd;
1977 
1978 #if (RCAR_DRAM_MEMRANK == 0)
1979 	int32_t ret;
1980 	uint32_t type = 0U;
1981 	uint32_t rev = 0U;
1982 
1983 	brd = 99U;
1984 	ret = rcar_get_board_type(&type, &rev);
1985 	if ((ret == 0) && (rev != 0xFFU)) {
1986 		if (type == (uint32_t)BOARD_SALVATOR_XS) {
1987 			if (rev == 0x11U) {
1988 				brd = 14U;
1989 			} else {
1990 				brd = 8U;
1991 			}
1992 		} else if (type == (uint32_t)BOARD_STARTER_KIT_PRE) {
1993 			if (rev == 0x21U) {
1994 				brd = 14U;
1995 			} else {
1996 				brd = 8U;
1997 			}
1998 		}
1999 	}
2000 #elif (RCAR_DRAM_MEMRANK == 1)
2001 	brd = 14U;
2002 #elif (RCAR_DRAM_MEMRANK == 2)
2003 	brd = 8U;
2004 #else
2005 #error Invalid value was set to RCAR_DRAM_MEMRANK
2006 #endif /* (RCAR_DRAM_MEMRANK == 0) */
2007 	return brd;
2008 }
2009 #endif /* (RCAR_DRAM_LPDDR4_MEMCONF != 0) */
2010 
_board_judge(void)2011 static uint32_t _board_judge(void)
2012 {
2013 	uint32_t brd;
2014 
2015 #if (RZG_SOC == 1)
2016 	brd = rzg2_board_judge();
2017 #else
2018 #if (RCAR_GEN3_ULCB == 1)
2019 	/* Starter Kit */
2020 	if (prr_product == PRR_PRODUCT_H3) {
2021 		if (prr_cut <= PRR_PRODUCT_11) {
2022 			/* RENESAS Starter Kit(H3 Ver.1.x/SIP) board */
2023 			brd = 2;
2024 		} else {
2025 			/* RENESAS Starter Kit(H3 Ver.2.0 or later/SIP) board */
2026 #if (RCAR_DRAM_LPDDR4_MEMCONF == 0)
2027 			brd = 7;
2028 #else
2029 			brd = ddr_rank_judge();
2030 #endif
2031 		}
2032 	} else if (prr_product == PRR_PRODUCT_M3) {
2033 		if (prr_cut >= PRR_PRODUCT_30) {
2034 			/* RENESAS Starter Kit (M3-W Ver.3.0/SIP) */
2035 			brd = 18;
2036 		} else {
2037 			/* RENESAS Starter Kit(M3-W/SIP 8Gbit 1rank) board */
2038 			brd = 3;
2039 		}
2040 	} else {
2041 		/* RENESAS Starter Kit(M3-N/SIP) board */
2042 		brd = 11;
2043 	}
2044 #else
2045 	uint32_t usb2_ovc_open;
2046 
2047 	usb2_ovc_open = opencheck_SSI_WS6();
2048 
2049 	/* RENESAS Eva-board */
2050 	brd = 99;
2051 	if (prr_product == PRR_PRODUCT_V3H) {
2052 		/* RENESAS Condor board */
2053 		brd = 12;
2054 	} else if (usb2_ovc_open) {
2055 		if (prr_product == PRR_PRODUCT_M3N) {
2056 			/* RENESAS Kriek board with M3-N */
2057 			brd = 10;
2058 		} else if (prr_product == PRR_PRODUCT_M3) {
2059 			/* RENESAS Kriek board with M3-W */
2060 			brd = 1;
2061 		} else if ((prr_product == PRR_PRODUCT_H3) &&
2062 			   (prr_cut <= PRR_PRODUCT_11)) {
2063 			/* RENESAS Kriek board with PM3 */
2064 			brd = 13;
2065 		} else if ((prr_product == PRR_PRODUCT_H3) &&
2066 			   (prr_cut > PRR_PRODUCT_20)) {
2067 			/* RENESAS Kriek board with H3N */
2068 			brd = 15;
2069 		}
2070 	} else {
2071 		if (prr_product == PRR_PRODUCT_H3) {
2072 			if (prr_cut <= PRR_PRODUCT_11) {
2073 				/* RENESAS SALVATOR-X (H3 Ver.1.x/SIP) */
2074 				brd = 2;
2075 			} else if (prr_cut < PRR_PRODUCT_30) {
2076 				/* RENESAS SALVATOR-X (H3 Ver.2.0/SIP) */
2077 				brd = 7;	//  8Gbit/1rank
2078 			} else {
2079 				/* RENESAS SALVATOR-X (H3 Ver.3.0/SIP) */
2080 #if (RCAR_DRAM_LPDDR4_MEMCONF == 0)
2081 				brd = 7;
2082 #else
2083 				brd = ddr_rank_judge();
2084 #endif
2085 			}
2086 		} else if (prr_product == PRR_PRODUCT_M3N) {
2087 			/* RENESAS SALVATOR-X (M3-N/SIP) */
2088 			brd = 11;
2089 		} else if ((prr_product == PRR_PRODUCT_M3) &&
2090 			   (prr_cut <= PRR_PRODUCT_20)) {
2091 			/* RENESAS SALVATOR-X (M3-W/SIP) */
2092 			brd = 0;
2093 		} else if ((prr_product == PRR_PRODUCT_M3) &&
2094 			   (prr_cut < PRR_PRODUCT_30)) {
2095 			/* RENESAS SALVATOR-X (M3-W Ver.1.x/SIP) */
2096 			brd = 19;
2097 		} else if ((prr_product == PRR_PRODUCT_M3) &&
2098 			   (prr_cut >= PRR_PRODUCT_30)) {
2099 			/* RENESAS SALVATOR-X (M3-W ver.3.0/SIP) */
2100 			brd = 18;
2101 		}
2102 	}
2103 #endif
2104 #endif /* RZG_SOC == 1 */
2105 
2106 	return brd;
2107 }
2108 #endif
2109