Debian Codegraph @

src/mainboard/google/reef/variants/baseboard/memory.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <baseboard/variants.h>
4 #include <gpio.h>
5 #include <soc/meminit.h>
6 #include <variant/gpio.h>
7 #include <fsp/api.h>
8
9 const struct lpddr4_swizzle_cfg baseboard_lpddr4_swizzle = {
10 /* CH0_DQA[0:31] SoC pins -> U22 LPDDR4 module pins */
11 .phys[LP4_PHYS_CH0A] = {
12 /* DQA[0:7] pins of LPDDR4 module. */
13 .dqs[LP4_DQS0] = { 6, 7, 5, 4, 3, 1, 0, 2 },
14 /* DQA[8:15] pins of LPDDR4 module. */
15 .dqs[LP4_DQS1] = { 12, 10, 11, 13, 14, 8, 9, 15 },
16 /* DQB[0:7] pins of LPDDR4 module with offset of 16. */
17 .dqs[LP4_DQS2] = { 16, 22, 23, 20, 18, 17, 19, 21 },
18 /* DQB[7:15] pins of LPDDR4 module with offset of 16. */
19 .dqs[LP4_DQS3] = { 30, 28, 29, 25, 24, 26, 27, 31 },
20 },
21 .phys[LP4_PHYS_CH0B] = {
22 /* DQA[0:7] pins of LPDDR4 module. */
23 .dqs[LP4_DQS0] = { 7, 3, 5, 2, 6, 0, 1, 4 },
24 /* DQA[8:15] pins of LPDDR4 module. */
25 .dqs[LP4_DQS1] = { 9, 14, 12, 13, 10, 11, 8, 15 },
26 /* DQB[0:7] pins of LPDDR4 module with offset of 16. */
27 .dqs[LP4_DQS2] = { 20, 22, 23, 16, 19, 17, 18, 21 },
28 /* DQB[7:15] pins of LPDDR4 module with offset of 16. */
29 .dqs[LP4_DQS3] = { 28, 24, 26, 27, 29, 30, 31, 25 },
30 },
31 .phys[LP4_PHYS_CH1A] = {
32 /* DQA[0:7] pins of LPDDR4 module. */
33 .dqs[LP4_DQS0] = { 2, 1, 6, 7, 5, 4, 3, 0 },
34 /* DQA[8:15] pins of LPDDR4 module. */
35 .dqs[LP4_DQS1] = { 11, 10, 8, 9, 12, 15, 13, 14 },
36 /* DQB[0:7] pins of LPDDR4 module with offset of 16. */
37 .dqs[LP4_DQS2] = { 17, 23, 19, 16, 21, 22, 20, 18 },
38 /* DQB[7:15] pins of LPDDR4 module with offset of 16. */
39 .dqs[LP4_DQS3] = { 31, 29, 26, 25, 28, 27, 24, 30 },
40 },
41 .phys[LP4_PHYS_CH1B] = {
42 /* DQA[0:7] pins of LPDDR4 module. */
43 .dqs[LP4_DQS0] = { 4, 3, 7, 5, 6, 1, 0, 2 },
44 /* DQA[8:15] pins of LPDDR4 module. */
45 .dqs[LP4_DQS1] = { 15, 9, 8, 11, 14, 13, 12, 10 },
46 /* DQB[0:7] pins of LPDDR4 module with offset of 16. */
47 .dqs[LP4_DQS2] = { 20, 23, 22, 21, 18, 19, 16, 17 },
48 /* DQB[7:15] pins of LPDDR4 module with offset of 16. */
49 .dqs[LP4_DQS3] = { 25, 28, 30, 31, 26, 27, 24, 29 },
50 },
51 };
52
53 /*
54 * The strings in the part_num field aren't necessarily the exact part
55 * numbers used in all the designs. The reason is that the mosys userland
56 * tool uses these strings for dumping more information. Different speed bins
57 * could change in future systems, but the strings still need to match.
58 */
59 static const struct lpddr4_sku skus[] = {
60 /*
61 * K4F6E304HB-MG - both logical channels While the parts
62 * are listed at 16Gb there are 2 ranks per channel so indicate
63 * the deneisty as 8Gb per rank.
64 */
65 [0] = {
66 .speed = LP4_SPEED_2400,
67 .ch0_rank_density = LP4_8Gb_DENSITY,
68 .ch1_rank_density = LP4_8Gb_DENSITY,
69 .ch0_dual_rank = 1,
70 .ch1_dual_rank = 1,
71 .part_num = "K4F6E304HB-MGCJ",
72 },
73 /* K4F8E304HB-MG - both logical channels */
74 [1] = {
75 .speed = LP4_SPEED_2400,
76 .ch0_rank_density = LP4_8Gb_DENSITY,
77 .ch1_rank_density = LP4_8Gb_DENSITY,
78 .part_num = "K4F8E304HB-MGCJ",
79 },
80 /*
81 * MT53B512M32D2NP - both logical channels. While the parts
82 * are listed at 16Gb there are 2 ranks per channel so indicate
83 * the deneisty as 8Gb per rank.
84 */
85 [2] = {
86 .speed = LP4_SPEED_2400,
87 .ch0_rank_density = LP4_8Gb_DENSITY,
88 .ch1_rank_density = LP4_8Gb_DENSITY,
89 .ch0_dual_rank = 1,
90 .ch1_dual_rank = 1,
91 .part_num = "MT53B512M32D2NP",
92 },
93 /* MT53B256M32D1NP - both logical channels */
94 [3] = {
95 .speed = LP4_SPEED_2400,
96 .ch0_rank_density = LP4_8Gb_DENSITY,
97 .ch1_rank_density = LP4_8Gb_DENSITY,
98 .part_num = "MT53B256M32D1NP",
99 },
100 /*
101 * H9HCNNNBPUMLHR - both logical channels. While the parts
102 * are listed at 16Gb there are 2 ranks per channel so indicate the
103 * density as 8Gb per rank.
104 */
105 [4] = {
106 .speed = LP4_SPEED_2400,
107 .ch0_rank_density = LP4_8Gb_DENSITY,
108 .ch1_rank_density = LP4_8Gb_DENSITY,
109 .ch0_dual_rank = 1,
110 .ch1_dual_rank = 1,
111 .part_num = "H9HCNNNBPUMLHR",
112 },
113 /* H9HCNNN8KUMLHR - both logical channels */
114 [5] = {
115 .speed = LP4_SPEED_2400,
116 .ch0_rank_density = LP4_8Gb_DENSITY,
117 .ch1_rank_density = LP4_8Gb_DENSITY,
118 .part_num = "H9HCNNN8KUMLHR",
119 },
120 /* MT53E512M32D2NP - both logical channels */
121 [6] = {
122 .speed = LP4_SPEED_2400,
123 .ch0_rank_density = LP4_16Gb_DENSITY,
124 .ch1_rank_density = LP4_16Gb_DENSITY,
125 .part_num = "MT53E512M32D2NP",
126 },
127 /* K4F6E3S4HM-MGCJ - both logical channels */
128 [7] = {
129 .speed = LP4_SPEED_2400,
130 .ch0_rank_density = LP4_16Gb_DENSITY,
131 .ch1_rank_density = LP4_16Gb_DENSITY,
132 .part_num = "K4F6E3S4HM-MGCJ",
133 },
134 /* K4F8E3S4HD-MGCL - both logical channels */
135 [8] = {
136 .speed = LP4_SPEED_2400,
137 .ch0_rank_density = LP4_8Gb_DENSITY,
138 .ch1_rank_density = LP4_8Gb_DENSITY,
139 .part_num = "K4F8E3S4HD-MGCL",
140 },
141 /* NT6AN256T32AV-J2 - both logical channels */
142 [9] = {
143 .speed = LP4_SPEED_2400,
144 .ch0_rank_density = LP4_8Gb_DENSITY,
145 .ch1_rank_density = LP4_8Gb_DENSITY,
146 .part_num = "NT6AN256T32AV-J2",
147 },
148 };
149
150 static const struct lpddr4_cfg lp4cfg = {
151 .skus = skus,
152 .num_skus = ARRAY_SIZE(skus),
153 .swizzle_config = &baseboard_lpddr4_swizzle,
154 };
155
156 const struct lpddr4_cfg * __weak variant_lpddr4_config(void)
157 {
158 return &lp4cfg;
159 }
160
161 size_t __weak variant_memory_sku(void)
162 {
163 gpio_t pads[] = {
164 [3] = MEM_CONFIG3, [2] = MEM_CONFIG2,
165 [1] = MEM_CONFIG1, [0] = MEM_CONFIG0,
166 };
167
168 /* Need internal pullups enabled as only pulldown stuffing options
169 * exist. */
170 return gpio_pullup_base2_value(pads, ARRAY_SIZE(pads));
171 }
172
173 uint8_t fsp_memory_mainboard_version(void)
174 {
175 return 1;
176 }