soc/intel: Remove blank lines before '}' and after '{'
[coreboot2.git] / src / soc / intel / xeon_sp / ddr.c
blobde248ca13b45be4a7f5b9173cd85eb0b38cd395c
1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 #include <soc/ddr.h>
5 uint32_t get_ddr_voltage(uint8_t ddr_voltage)
7 /* SPD Byte 11: Module Nominal Voltage, currently DDR4 only supports 1.2V.
8 Either Bit 0 or Bit 1 is set, return 1.2V */
9 if (ddr_voltage & 0x3)
10 return 1200;
11 return 0;
14 unsigned int get_ddr_millivolt(unsigned int ddr_voltage)
16 switch (ddr_voltage) {
17 case SPD_VDD_DDR4:
18 return 1200;
19 case SPD_VDD_DDR5:
20 return 1100;
21 default:
22 return 0;
26 unsigned int get_max_memory_speed(unsigned int common_tck)
28 if (common_tck <= DDR_8400_TCK_MIN)
29 return 8400;
30 else if (common_tck <= DDR_7600_TCK_MIN)
31 return 7600;
32 else if (common_tck <= DDR_7200_TCK_MIN)
33 return 7200;
34 else if (common_tck <= DDR_6800_TCK_MIN)
35 return 6800;
36 else if (common_tck <= DDR_6400_TCK_MIN)
37 return 6400;
38 else if (common_tck <= DDR_6000_TCK_MIN)
39 return 6000;
40 else if (common_tck <= DDR_5600_TCK_MIN)
41 return 5600;
42 else if (common_tck <= DDR_5200_TCK_MIN)
43 return 5200;
44 else if (common_tck <= DDR_4800_TCK_MIN)
45 return 4800;
46 else if (common_tck <= DDR_4400_TCK_MIN)
47 return 4400;
48 else if (common_tck <= DDR_4266_TCK_MIN)
49 return 4266;
50 else if (common_tck <= DDR_4200_TCK_MIN)
51 return 4200;
52 else if (common_tck <= DDR_4000_TCK_MIN)
53 return 4000;
54 else if (common_tck <= DDR_3800_TCK_MIN)
55 return 3800;
56 else if (common_tck <= DDR_3733_TCK_MIN)
57 return 3733;
58 else if (common_tck <= DDR_3600_TCK_MIN)
59 return 3600;
60 else if (common_tck <= DDR_3466_TCK_MIN)
61 return 3466;
62 else if (common_tck <= DDR_3400_TCK_MIN)
63 return 3400;
64 else if (common_tck <= DDR_3200_TCK_MIN)
65 return 3200;
66 else if (common_tck <= DDR_3000_TCK_MIN)
67 return 3000;
68 else if (common_tck <= DDR_2933_TCK_MIN)
69 return 2933;
70 else if (common_tck <= DDR_2800_TCK_MIN)
71 return 2800;
72 else if (common_tck <= DDR_2666_TCK_MIN)
73 return 2666;
74 else if (common_tck <= DDR_2600_TCK_MIN)
75 return 2600;
76 else if (common_tck <= DDR_2400_TCK_MIN)
77 return 2400;
78 else if (common_tck <= DDR_2200_TCK_MIN)
79 return 2200;
80 else if (common_tck <= DDR_2133_TCK_MIN)
81 return 2133;
82 else if (common_tck <= DDR_2000_TCK_MIN)
83 return 2000;
84 else if (common_tck <= DDR_1866_TCK_MIN)
85 return 1866;
86 else if (common_tck <= DDR_1800_TCK_MIN)
87 return 1800;
88 else if (common_tck <= DDR_1600_TCK_MIN)
89 return 1600;
90 else if (common_tck <= DDR_1400_TCK_MIN)
91 return 1400;
92 else if (common_tck <= DDR_1333_TCK_MIN)
93 return 1333;
94 else if (common_tck <= DDR_1200_TCK_MIN)
95 return 1200;
96 else if (common_tck <= DDR_1066_TCK_MIN)
97 return 1066;
98 else if (common_tck <= DDR_1000_TCK_MIN)
99 return 1000;
100 else
101 return 800;
104 __weak bool mainboard_dimm_slot_exists(uint8_t socket, uint8_t channel, uint8_t slot)
106 return false;