1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <baseboard/gpio.h>
4 #include <baseboard/variants.h>
5 #include <console/console.h>
7 #include <memory_info.h>
10 static const struct mb_cfg baseboard_memcfg
= {
11 .type
= MEM_TYPE_LP4X
,
14 /* Baseboard uses only 100ohm Rcomp resistors */
17 /* Baseboard Rcomp target values */
18 .targets
= {40, 30, 30, 30, 30},
24 .dq0
= { 9, 11, 8, 10, 12, 14, 13, 15, },
25 .dq1
= { 4, 7, 6, 5, 2, 3, 0, 1, },
28 .dq0
= { 15, 12, 14, 13, 9, 10, 11, 8, },
29 .dq1
= { 0, 1, 3, 2, 7, 5, 4, 6, },
32 .dq0
= { 2, 3, 1, 0, 6, 7, 5, 4, },
33 .dq1
= { 15, 9, 14, 8, 11, 10, 13, 12, },
36 .dq0
= { 3, 1, 2, 0, 4, 6, 7, 5, },
37 .dq1
= { 13, 15, 14, 12, 11, 9, 8, 10, },
40 .dq0
= { 13, 12, 14, 15, 9, 8, 10, 11, },
41 .dq1
= { 4, 7, 5, 6, 1, 2, 0, 3, },
44 .dq0
= { 5, 0, 6, 4, 3, 1, 7, 2, },
45 .dq1
= { 11, 9, 10, 8, 15, 12, 14, 13, },
48 .dq0
= { 15, 12, 14, 13, 10, 9, 11, 8, },
49 .dq1
= { 0, 1, 2, 3, 5, 6, 4, 7, },
52 .dq0
= { 0, 3, 1, 2, 4, 5, 6, 7, },
53 .dq1
= { 11, 8, 13, 14, 9, 12, 15, 10, },
57 /* DQS CPU<>DRAM map */
59 .ddr0
= { .dqs0
= 0, .dqs1
= 1 },
60 .ddr1
= { .dqs0
= 0, .dqs1
= 1 },
61 .ddr2
= { .dqs0
= 0, .dqs1
= 1 },
62 .ddr3
= { .dqs0
= 0, .dqs1
= 1 },
63 .ddr4
= { .dqs0
= 0, .dqs1
= 1 },
64 .ddr5
= { .dqs0
= 0, .dqs1
= 1 },
65 .ddr6
= { .dqs0
= 0, .dqs1
= 1 },
66 .ddr7
= { .dqs0
= 0, .dqs1
= 1 },
69 .LpDdrDqDqsReTraining
= 1,
71 .ect
= 1, /* Enable Early Command Training */
74 static const struct mb_cfg hynix_memconfig
= {
75 .type
= MEM_TYPE_LP4X
,
78 /* Baseboard uses only 100ohm Rcomp resistors */
81 /* Baseboard Rcomp target values */
82 .targets
= {40, 30, 30, 30, 30},
88 .dq0
= { 9, 11, 8, 10, 12, 14, 13, 15, },
89 .dq1
= { 4, 7, 6, 5, 2, 3, 0, 1, },
92 .dq0
= { 15, 12, 14, 13, 9, 10, 11, 8, },
93 .dq1
= { 0, 1, 3, 2, 7, 5, 4, 6, },
96 .dq0
= { 2, 3, 1, 0, 6, 7, 5, 4, },
97 .dq1
= { 15, 9, 14, 8, 11, 10, 13, 12, },
100 .dq0
= { 3, 1, 2, 0, 4, 6, 7, 5, },
101 .dq1
= { 13, 15, 14, 12, 11, 9, 8, 10, },
104 .dq0
= { 13, 12, 14, 15, 9, 8, 10, 11, },
105 .dq1
= { 4, 7, 5, 6, 1, 2, 0, 3, },
108 .dq0
= { 5, 0, 6, 4, 3, 1, 7, 2, },
109 .dq1
= { 11, 9, 10, 8, 15, 12, 14, 13, },
112 .dq0
= { 15, 12, 14, 13, 10, 9, 11, 8, },
113 .dq1
= { 0, 1, 2, 3, 5, 6, 4, 7, },
116 .dq0
= { 0, 3, 1, 2, 4, 5, 6, 7, },
117 .dq1
= { 11, 8, 13, 14, 9, 12, 15, 10, },
121 /* DQS CPU<>DRAM map */
123 .ddr0
= { .dqs0
= 0, .dqs1
= 1 },
124 .ddr1
= { .dqs0
= 0, .dqs1
= 1 },
125 .ddr2
= { .dqs0
= 0, .dqs1
= 1 },
126 .ddr3
= { .dqs0
= 0, .dqs1
= 1 },
127 .ddr4
= { .dqs0
= 0, .dqs1
= 1 },
128 .ddr5
= { .dqs0
= 0, .dqs1
= 1 },
129 .ddr6
= { .dqs0
= 0, .dqs1
= 1 },
130 .ddr7
= { .dqs0
= 0, .dqs1
= 1 },
133 .LpDdrDqDqsReTraining
= 1,
135 .ect
= 1, /* Enable Early Command Training */
137 .cs_pi_start_high_in_ect
= 1,
139 const struct mb_cfg
*variant_memory_params(void)
141 const char *dram_part_num
= mainboard_get_dram_part_num();
143 if (strcmp(dram_part_num
, "H54G46CYRBX267N") == 0) {
144 printk(BIOS_INFO
, "Enable cs_pi_start_high_in_ect for Hynix DRAM part\n");
145 return &hynix_memconfig
;
148 return &baseboard_memcfg
;
151 int variant_memory_sku(void)
154 * Memory configuration board straps
155 * GPIO_MEM_CONFIG_0 GPP_E11
156 * GPIO_MEM_CONFIG_1 GPP_E2
157 * GPIO_MEM_CONFIG_2 GPP_E1
158 * GPIO_MEM_CONFIG_3 GPP_E12
160 gpio_t spd_gpios
[] = {
167 return gpio_base2_value(spd_gpios
, ARRAY_SIZE(spd_gpios
));
170 bool variant_is_half_populated(void)
172 /* GPIO_MEM_CH_SEL GPP_E13 */
173 return gpio_get(GPP_E13
);