summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2016-12-07 17:34:06 -0600
committerAaron Durbin <adurbin@chromium.org>2016-12-09 17:26:29 +0100
commit2b3a6bee77b3fcff721a6c7d34b3316a338bf1cb (patch)
tree59ed1d58d74af97c898e1cf2e22501ff0deb339f /src
parent26174c97fe00bbb57a0543fce2b30a8877054f60 (diff)
mainboard/google/reef: add board SKU'ing support
There are 2 gpios on reef-like boards that can be composed into a SKU. Add support for identifying the SKU value using the base 3 gpio logic. Also export the SKU information to the SMBIOS type 1 table. BUG=chrome-os-partner:59887,chrome-os-partner:60494 BRANCH=reef Change-Id: I8bb94207b0b7833d758054a817b655e248f1b239 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/17771 Tested-by: build bot (Jenkins) Reviewed-by: Furquan Shaikh <furquan@google.com> Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
Diffstat (limited to 'src')
-rw-r--r--src/mainboard/google/reef/mainboard.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/mainboard/google/reef/mainboard.c b/src/mainboard/google/reef/mainboard.c
index 4425c0184c..e350df226e 100644
--- a/src/mainboard/google/reef/mainboard.c
+++ b/src/mainboard/google/reef/mainboard.c
@@ -19,9 +19,12 @@
#include <console/console.h>
#include <device/device.h>
#include <ec/ec.h>
+#include <gpio.h>
#include <nhlt.h>
+#include <smbios.h>
#include <soc/gpio.h>
#include <soc/nhlt.h>
+#include <string.h>
#include <vendorcode/google/chromeos/chromeos.h>
#include <variant/ec.h>
#include <variant/gpio.h>
@@ -41,6 +44,35 @@ static void mainboard_init(void *chip_info)
mainboard_ec_init();
}
+/*
+ * There are 2 pins on reef-like boards that can be used for SKU'ing
+ * board differences. They each have optional stuffing for a pullup and
+ * a pulldown. This way we can generate 9 different values with the
+ * 2 pins.
+ */
+static int board_sku(void)
+{
+ static int board_sku_num = -1;
+ gpio_t board_sku_gpios[] = {
+ [1] = GPIO_17, [0] = GPIO_16,
+ };
+ const size_t num = ARRAY_SIZE(board_sku_gpios);
+
+ if (board_sku_num < 0)
+ board_sku_num = gpio_base3_value(board_sku_gpios, num);
+
+ return board_sku_num;
+}
+
+const char *smbios_mainboard_sku(void)
+{
+ static char sku_str[5]; /* sku[0-8] */
+
+ snprintf(sku_str, sizeof(sku_str), "sku%d", board_sku());
+
+ return sku_str;
+}
+
void __attribute__((weak)) variant_nhlt_oem_overrides(const char **oem_id,
const char **oem_table_id,
uint32_t *oem_revision)