1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
/* SPDX-License-Identifier: GPL-2.0-only */
#include <arch/cpu.h>
#include "board_id.h"
#include <baseboard/variants.h>
#include <soc/romstage.h>
static const struct mb_cfg ddr4_mem_config = {
.type = MEM_TYPE_DDR4,
.ect = true, /* Early Command Training */
.UserBd = BOARD_TYPE_MOBILE,
.ddr_config = {
/* Baseboard uses only 100ohm Rcomp resistors */
.rcomp_resistor = {100, 100, 100},
/* Baseboard Rcomp target values */
.rcomp_targets = {40, 30, 33, 33, 30},
.dq_pins_interleaved = false,
},
};
static const struct mb_cfg lpddr4_mem_config = {
.type = MEM_TYPE_LP4X,
/* DQ byte map */
.lpx_dq_map = {
.ddr0 = {
.dq0 = { 0, 2, 3, 1, 6, 7, 5, 4, },
.dq1 = { 10, 8, 11, 9, 14, 12, 13, 15, },
},
.ddr1 = {
.dq0 = { 12, 8, 14, 10, 11, 13, 15, 9, },
.dq1 = { 5, 0, 7, 3, 6, 2, 1, 4, },
},
.ddr2 = {
.dq0 = { 3, 0, 2, 1, 6, 5, 4, 7, },
.dq1 = { 12, 13, 14, 15, 10, 9, 8, 11, },
},
.ddr3 = {
.dq0 = { 2, 6, 7, 1, 3, 4, 0, 5, },
.dq1 = { 9, 13, 8, 15, 14, 11, 12, 10, },
},
.ddr4 = {
.dq0 = { 3, 0, 1, 2, 7, 4, 6, 5, },
.dq1 = { 10, 8, 11, 9, 14, 13, 12, 15, },
},
.ddr5 = {
.dq0 = { 10, 12, 14, 8, 9, 13, 15, 11, },
.dq1 = { 3, 7, 6, 2, 0, 4, 5, 1, },
},
.ddr6 = {
.dq0 = { 12, 15, 14, 13, 9, 10, 11, 8, },
.dq1 = { 7, 4, 6, 5, 0, 1, 3, 2, },
},
.ddr7 = {
.dq0 = { 0, 2, 4, 3, 1, 6, 7, 5, },
.dq1 = { 13, 9, 10, 11, 8, 12, 14, 15, },
},
},
/* DQS CPU<>DRAM map */
.lpx_dqs_map = {
.ddr0 = { .dqs0 = 0, .dqs1 = 1 },
.ddr1 = { .dqs0 = 1, .dqs1 = 0 },
.ddr2 = { .dqs0 = 0, .dqs1 = 1 },
.ddr3 = { .dqs0 = 0, .dqs1 = 1 },
.ddr4 = { .dqs0 = 0, .dqs1 = 1 },
.ddr5 = { .dqs0 = 1, .dqs1 = 0 },
.ddr6 = { .dqs0 = 1, .dqs1 = 0 },
.ddr7 = { .dqs0 = 0, .dqs1 = 1 },
},
.ect = true, /* Early Command Training */
.UserBd = BOARD_TYPE_MOBILE,
};
static const struct mb_cfg lp5_mem_config = {
.type = MEM_TYPE_LP5X,
/* DQ byte map */
.lpx_dq_map = {
.ddr0 = {
.dq0 = { 3, 2, 1, 0, 5, 4, 6, 7, },
.dq1 = { 15, 14, 12, 13, 8, 9, 10, 11, },
},
.ddr1 = {
.dq0 = { 0, 2, 3, 1, 5, 7, 4, 6, },
.dq1 = { 14, 13, 15, 12, 8, 9, 11, 10, },
},
.ddr2 = {
.dq0 = { 1, 2, 0, 3, 4, 6, 5, 7, },
.dq1 = { 15, 13, 12, 14, 9, 10, 8, 11, },
},
.ddr3 = {
.dq0 = { 2, 1, 3, 0, 7, 4, 5, 6, },
.dq1 = { 13, 12, 15, 14, 9, 11, 8, 10, },
},
.ddr4 = {
.dq0 = { 1, 2, 3, 0, 6, 4, 5, 7, },
.dq1 = { 15, 13, 14, 12, 10, 9, 8, 11, },
},
.ddr5 = {
.dq0 = { 1, 0, 3, 2, 6, 7, 4, 5, },
.dq1 = { 14, 12, 15, 13, 8, 9, 10, 11, },
},
.ddr6 = {
.dq0 = { 0, 2, 1, 3, 4, 7, 5, 6, },
.dq1 = { 12, 13, 15, 14, 9, 11, 10, 8, },
},
.ddr7 = {
.dq0 = { 3, 2, 1, 0, 5, 4, 6, 7, },
.dq1 = { 13, 15, 11, 12, 10, 9, 14, 8, },
},
},
/* DQS CPU<>DRAM map */
.lpx_dqs_map = {
.ddr0 = { .dqs0 = 0, .dqs1 = 1 },
.ddr1 = { .dqs0 = 0, .dqs1 = 1 },
.ddr2 = { .dqs0 = 0, .dqs1 = 1 },
.ddr3 = { .dqs0 = 0, .dqs1 = 1 },
.ddr4 = { .dqs0 = 0, .dqs1 = 1 },
.ddr5 = { .dqs0 = 0, .dqs1 = 1 },
.ddr6 = { .dqs0 = 0, .dqs1 = 1 },
.ddr7 = { .dqs0 = 0, .dqs1 = 1 }
},
.ect = false, /* Early Command Training */
.UserBd = BOARD_TYPE_MOBILE,
.lp5x_config = {
.ccc_config = 0xff,
},
};
static const struct mb_cfg ddr5_mem_config = {
.type = MEM_TYPE_DDR5,
.ect = true, /* Early Command Training */
.UserBd = BOARD_TYPE_MOBILE,
.ddr_config = {
/* Baseboard uses only 100ohm Rcomp resistors */
.rcomp_resistor = {100, 100, 100},
/* Baseboard Rcomp target values */
.rcomp_targets = {50, 30, 30, 30, 27},
.dq_pins_interleaved = false,
}
};
const struct mb_cfg *variant_memory_params(void)
{
int board_id = get_board_id();
switch (board_id) {
case ADL_P_LP4_1:
case ADL_P_LP4_2:
return &lpddr4_mem_config;
case ADL_P_DDR4_1:
case ADL_P_DDR4_2:
return &ddr4_mem_config;
case ADL_P_DDR5:
return &ddr5_mem_config;
case ADL_P_LP5:
return &lp5_mem_config;
default:
die("unsupported board id : 0x%x\n", board_id);
}
}
|