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>
This commit is contained in:
Furquan Shaikh 2019-07-11 22:59:12 -07:00
parent 463fca4362
commit 73d560a71a
1 changed files with 34 additions and 0 deletions

View File

@ -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;
}