summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulius Werner <jwerner@chromium.org>2017-12-04 16:47:53 -0800
committerJulius Werner <jwerner@chromium.org>2017-12-07 01:19:46 +0000
commit4177679a84786de8cd91d9dab654182e47cecc2c (patch)
tree50d81b88205bb68161103162b87755ac6a50eb70
parentb7e1557355fc091c1b459f7a70343d5585d259dd (diff)
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 <jwerner@chromium.org> Reviewed-on: https://review.coreboot.org/22697 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Reviewed-by: Aaron Durbin <adurbin@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/mainboard/google/gru/boardid.c16
1 files changed, 16 insertions, 0 deletions
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 <boardid.h>
#include <console/console.h>
+#include <gpio.h>
#include <stdlib.h>
#include <soc/saradc.h>
@@ -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;
+}