From 4177679a84786de8cd91d9dab654182e47cecc2c Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Mon, 4 Dec 2017 16:47:53 -0800 Subject: google/gru: Add SKU ID for Scarlet Scarlet has SKU detection strapping pins now. This patch adds the code to read them. BUG=b:69373077 Change-Id: I8d889a845950923bc7b5be9b79792cf3c8b6b8ad Signed-off-by: Julius Werner Reviewed-on: https://review.coreboot.org/22697 Reviewed-by: Paul Menzel Reviewed-by: Aaron Durbin Tested-by: build bot (Jenkins) --- src/mainboard/google/gru/boardid.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/mainboard/google/gru/boardid.c b/src/mainboard/google/gru/boardid.c index 8158124c7f..9dc7b05218 100644 --- a/src/mainboard/google/gru/boardid.c +++ b/src/mainboard/google/gru/boardid.c @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -75,3 +76,18 @@ uint32_t ram_code(void) { return get_index(0, &cached_ram_id); } + +uint32_t sku_id(void) +{ + if (!IS_ENABLED(CONFIG_GRU_BASEBOARD_SCARLET)) + return UNDEFINED_STRAPPING_ID; + + static uint32_t sku_id = UNDEFINED_STRAPPING_ID; + if (sku_id != UNDEFINED_STRAPPING_ID) + return sku_id; + + gpio_t pins[3] = {[2] = GPIO(3, D, 6), [1] = GPIO(3, D, 5), + [0] = GPIO(3, D, 4)}; /* GPIO3_D4 is LSB */ + sku_id = gpio_base2_value(pins, ARRAY_SIZE(pins)); + return sku_id; +} -- cgit v1.2.3