summaryrefslogtreecommitdiff
path: root/src/mainboard/google/trogdor/boardid.c
diff options
context:
space:
mode:
authorT Michael Turney <mturney@codeaurora.org>2019-10-15 07:40:30 -0700
committerJulius Werner <jwerner@chromium.org>2019-11-01 01:16:35 +0000
commit626a53776b2915d7f27a8a97f9d84200b20f3079 (patch)
treec8e9cc83dd52210ae4e6d53d0bc47e6ef86645d0 /src/mainboard/google/trogdor/boardid.c
parent09c3bfe826cf8ff30bab9ee073474674f1c9d565 (diff)
downloadcoreboot-626a53776b2915d7f27a8a97f9d84200b20f3079.tar.xz
trogdor: Add mainboard gpio support
Change-Id: I06cdb8eaaf7f74b47e1d1283dcaa765674ceaa45 Signed-off-by: T Michael Turney <mturney@codeaurora.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/36070 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/mainboard/google/trogdor/boardid.c')
-rw-r--r--src/mainboard/google/trogdor/boardid.c54
1 files changed, 54 insertions, 0 deletions
diff --git a/src/mainboard/google/trogdor/boardid.c b/src/mainboard/google/trogdor/boardid.c
new file mode 100644
index 0000000000..def3068d31
--- /dev/null
+++ b/src/mainboard/google/trogdor/boardid.c
@@ -0,0 +1,54 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright 2018 Google LLC
+ * Copyright 2019 The Linux Foundation. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+#include <boardid.h>
+#include <gpio.h>
+
+uint32_t board_id(void)
+{
+ static uint32_t id = UNDEFINED_STRAPPING_ID;
+
+ const gpio_t pins[] = {[2] = GPIO(31), [1] = GPIO(93), [0] = GPIO(33)};
+
+ if (id == UNDEFINED_STRAPPING_ID)
+ id = gpio_base2_value(pins, ARRAY_SIZE(pins));
+
+ return id;
+}
+
+uint32_t ram_code(void)
+{
+ static uint32_t id = UNDEFINED_STRAPPING_ID;
+
+ const gpio_t pins[] = {[1] = GPIO(91), [0] = GPIO(29)};
+
+ if (id == UNDEFINED_STRAPPING_ID)
+ id = gpio_base2_value(pins, ARRAY_SIZE(pins));
+
+ return id;
+}
+
+uint32_t sku_id(void)
+{
+ static uint32_t id = UNDEFINED_STRAPPING_ID;
+
+ const gpio_t pins[] = {[1] = GPIO(90), [0] = GPIO(114)};
+
+ if (id == UNDEFINED_STRAPPING_ID)
+ id = gpio_base2_value(pins, ARRAY_SIZE(pins));
+
+ return id;
+}