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>
This commit is contained in:
Julius Werner 2017-12-04 16:47:53 -08:00
parent b7e1557355
commit 4177679a84
1 changed files with 16 additions and 0 deletions

View File

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