blob: 990711f0905c028e30cc87fbf5b11133e2ecf5c8 [file] [log] [blame]
Johnny Lin75813522020-09-28 22:38:31 +08001/* SPDX-License-Identifier: GPL-2.0-or-later */
2
3#include <soc/ddr.h>
4
5uint32_t get_ddr_voltage(uint8_t DdrVoltage)
6{
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 (DdrVoltage & 0x3)
10 return 1200;
11 return 0;
12}
13
14uint16_t get_max_memory_speed(uint32_t commonTck)
15{
16 if (commonTck <= DDR_8400_TCK_MIN)
17 return 8400;
18 else if (commonTck <= DDR_6400_TCK_MIN)
19 return 6400;
20 else if (commonTck <= DDR_6000_TCK_MIN)
21 return 6000;
22 else if (commonTck <= DDR_5600_TCK_MIN)
23 return 5600;
24 else if (commonTck <= DDR_5200_TCK_MIN)
25 return 5200;
26 else if (commonTck <= DDR_4800_TCK_MIN)
27 return 4800;
28 else if (commonTck <= DDR_4400_TCK_MIN)
29 return 4400;
30 else if (commonTck <= DDR_4266_TCK_MIN)
31 return 4266;
32 else if (commonTck <= DDR_4200_TCK_MIN)
33 return 4200;
34 else if (commonTck <= DDR_4000_TCK_MIN)
35 return 4000;
36 else if (commonTck <= DDR_3800_TCK_MIN)
37 return 3800;
38 else if (commonTck <= DDR_3733_TCK_MIN)
39 return 3733;
40 else if (commonTck <= DDR_3600_TCK_MIN)
41 return 3600;
42 else if (commonTck <= DDR_3466_TCK_MIN)
43 return 3466;
44 else if (commonTck <= DDR_3400_TCK_MIN)
45 return 3400;
46 else if (commonTck <= DDR_3200_TCK_MIN)
47 return 3200;
48 else if (commonTck <= DDR_3000_TCK_MIN)
49 return 3000;
50 else if (commonTck <= DDR_2933_TCK_MIN)
51 return 2933;
52 else if (commonTck <= DDR_2800_TCK_MIN)
53 return 2800;
54 else if (commonTck <= DDR_2666_TCK_MIN)
55 return 2666;
56 else if (commonTck <= DDR_2600_TCK_MIN)
57 return 2600;
58 else if (commonTck <= DDR_2400_TCK_MIN)
59 return 2400;
60 else if (commonTck <= DDR_2200_TCK_MIN)
61 return 2200;
62 else if (commonTck <= DDR_2133_TCK_MIN)
63 return 2133;
64 else if (commonTck <= DDR_2000_TCK_MIN)
65 return 2000;
66 else if (commonTck <= DDR_1866_TCK_MIN)
67 return 1866;
68 else if (commonTck <= DDR_1800_TCK_MIN)
69 return 1800;
70 else if (commonTck <= DDR_1600_TCK_MIN)
71 return 1600;
72 else if (commonTck <= DDR_1400_TCK_MIN)
73 return 1400;
74 else if (commonTck <= DDR_1333_TCK_MIN)
75 return 1333;
76 else if (commonTck <= DDR_1200_TCK_MIN)
77 return 1200;
78 else if (commonTck <= DDR_1066_TCK_MIN)
79 return 1066;
80 else if (commonTck <= DDR_1000_TCK_MIN)
81 return 1000;
82 else
83 return 800;
84}
Angel Pons3cc20202022-05-03 18:37:32 +020085
86__weak bool mainboard_dimm_slot_exists(uint8_t socket, uint8_t channel, uint8_t slot)
87{
88 return false;
89}