From 73d560a71ae55d39a1ca189cb02663454835b03c Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Thu, 11 Jul 2019 22:59:12 -0700 Subject: mb/google/hatch/var/helios: Implement variant_memory_sku() This change provides an implementation of variant_memory_sku() for helios that overrides memory ID 3 and 4 to 0 and 1 to workaround the incorrect memory straps in hardware for board id 0 and unknown. BUG=b:133455595 Change-Id: I38fab1f91decac5d0a146e5a6c74e88f677af305 Signed-off-by: Furquan Shaikh Reviewed-on: https://review.coreboot.org/c/coreboot/+/34252 Tested-by: build bot (Jenkins) Reviewed-by: Paul Fagerburg --- .../google/hatch/variants/helios/memory.c | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) (limited to 'src/mainboard/google') diff --git a/src/mainboard/google/hatch/variants/helios/memory.c b/src/mainboard/google/hatch/variants/helios/memory.c index 64b4cac8d0..a3cd813f09 100644 --- a/src/mainboard/google/hatch/variants/helios/memory.c +++ b/src/mainboard/google/hatch/variants/helios/memory.c @@ -15,8 +15,11 @@ #include #include +#include +#include #include #include +#include static const struct cnl_mb_cfg baseboard_memcfg = { /* @@ -66,3 +69,34 @@ void variant_memory_params(struct cnl_mb_cfg *bcfg) { memcpy(bcfg, &baseboard_memcfg, sizeof(baseboard_memcfg)); } + +int variant_memory_sku(void) +{ + const gpio_t spd_gpios[] = { + GPIO_MEM_CONFIG_0, + GPIO_MEM_CONFIG_1, + GPIO_MEM_CONFIG_2, + GPIO_MEM_CONFIG_3, + }; + + int val = gpio_base2_value(spd_gpios, ARRAY_SIZE(spd_gpios)); + + if ((board_id() != 0) && (board_id() != BOARD_ID_UNKNOWN)) + return val; + + /* + * For boards with id 0 or unknown, memory straps 3 and 4 are + * incorrectly stuffed in hardware. This is a workaround for these + * boards to override memory strap 3 to 0 and 4 to 1. + */ + switch (val) { + case 3: + val = 0; + break; + case 4: + val = 1; + break; + } + + return val; +} -- cgit v1.2.3