mb/google/brya: Create rull variant
[coreboot2.git] / src / mainboard / google / kahlee / variants / baseboard / memory.c
blob91101872f49381798f11f2193d6a4e1720faa3ae
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <baseboard/variants.h>
4 #include <console/console.h>
5 #include <gpio.h>
6 #include <spd_bin.h>
7 #include <string.h>
8 #include <variant/gpio.h>
9 #include <amdblocks/dimm_spd.h>
11 uint8_t __weak variant_memory_sku(void)
13 gpio_t pads[] = {
14 [3] = MEM_CONFIG3,
15 [2] = MEM_CONFIG2,
16 [1] = MEM_CONFIG1,
17 [0] = MEM_CONFIG0,
20 return gpio_base2_value(pads, ARRAY_SIZE(pads));
23 int __weak variant_mainboard_read_spd(uint8_t spdAddress,
24 char *buf, size_t len)
26 u8 spd_index = variant_memory_sku();
28 printk(BIOS_INFO, "%s SPD index %d\n", __func__, spd_index);
30 void *spd = (void *)spd_cbfs_map(spd_index);
31 if (!spd) {
32 printk(BIOS_ERR, "spd.bin not found\n");
33 return -1;
36 if (len != CONFIG_DIMM_SPD_SIZE) {
37 printk(BIOS_ERR, "spd.bin is not the correct size\n");
38 return -1;
41 memcpy(buf, spd, len);
43 return 0;