Debian Codegraph @

src/mainboard/google/cyan/variants/celes/spd_util.c

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #include <console/console.h>
4 #include <gpio.h>
5 #include <mainboard/google/cyan/spd/spd_util.h>
6
7 /*
8 * Usage of RAMID straps
9 *
10 * RAMID1 - Single/Dual channel configuration
11 * 0 - Dual channel, 1 - Single channel
12 *
13 * Combination of RAMID3, RAMID2, RAMID0 - Index of SPD table
14 * Index 0 - Samsung K4E8E304EE-EGCE 1600MHz 23nm
15 * Index 1 - Samsung K4E8E324EB-EGCF 1866MHz 20nm
16 */
17
18 uint8_t get_ramid(void)
19 {
20 gpio_t spd_gpios[] = {
21 GP_SW_80, /* SATA_GP3,RAMID0 */
22 GP_SE_02, /* MF_PLT_CLK1, RAMID2 */
23 GP_SW_64, /* I2C3_SDA RAMID3 */
24 GP_SW_67, /* I2C3_SCL,RAMID1 */
25 };
26
27 return gpio_base2_value(spd_gpios, ARRAY_SIZE(spd_gpios));
28 }
29
30 int get_variant_spd_index(int ram_id, int *dual)
31 {
32 int spd_index = ram_id & 0x7;
33
34 /* Determine if single or dual channel memory system */
35 /* RAMID3 is deterministic for celes */
36 *dual = ((ram_id >> 3) & 0x1) ? 0 : 1;
37
38 /* Display the RAM type */
39 printk(BIOS_DEBUG, *dual ? "4GiB " : "2GiB ");
40 switch (spd_index) {
41 case 0:
42 printk(BIOS_DEBUG, "Samsung K4E8E304EE-EGCE\n");
43 break;
44 case 1:
45 printk(BIOS_DEBUG, "Samsung K4E8E324EB-EGCF\n");
46 break;
47 }
48
49 return spd_index;
50 }