mb/google/brya: Create rull variant
[coreboot2.git] / src / mainboard / google / cyan / variants / celes / spd_util.c
blobc918cc7ad2a539fd747eb1d5a49193a9e9faff38
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <console/console.h>
4 #include <gpio.h>
5 #include <mainboard/google/cyan/spd/spd_util.h>
7 /*
8 * Usage of RAMID straps
10 * RAMID1 - Single/Dual channel configuration
11 * 0 - Dual channel, 1 - Single channel
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
18 uint8_t get_ramid(void)
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 */
27 return gpio_base2_value(spd_gpios, ARRAY_SIZE(spd_gpios));
30 int get_variant_spd_index(int ram_id, int *dual)
32 int spd_index = ram_id & 0x7;
34 /* Determine if single or dual channel memory system */
35 /* RAMID3 is deterministic for celes */
36 *dual = ((ram_id >> 3) & 0x1) ? 0 : 1;
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;
49 return spd_index;