diff options
author | Furquan Shaikh <furquan@google.com> | 2019-07-11 22:59:12 -0700 |
---|---|---|
committer | Furquan Shaikh <furquan@google.com> | 2019-07-18 14:44:35 +0000 |
commit | 73d560a71ae55d39a1ca189cb02663454835b03c (patch) | |
tree | c44faf4f56f8c614c3accec259330f25e6119649 /src/mainboard/google | |
parent | 463fca43623d385f486a72444c8e30cbb9b3e9d3 (diff) | |
download | coreboot-73d560a71ae55d39a1ca189cb02663454835b03c.tar.xz |
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 <furquan@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/34252
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Paul Fagerburg <pfagerburg@chromium.org>
Diffstat (limited to 'src/mainboard/google')
-rw-r--r-- | src/mainboard/google/hatch/variants/helios/memory.c | 34 |
1 files changed, 34 insertions, 0 deletions
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 <baseboard/variants.h> #include <baseboard/gpio.h> +#include <boardid.h> +#include <gpio.h> #include <soc/cnl_memcfg_init.h> #include <string.h> +#include <variant/gpio.h> 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; +} |