summaryrefslogtreecommitdiff
path: root/src/mainboard/google
diff options
context:
space:
mode:
authorDavid Hendricks <dhendrix@chromium.org>2014-11-07 13:48:49 -0800
committerPatrick Georgi <pgeorgi@google.com>2015-04-10 20:50:08 +0200
commita0abd51e4edb6b00c82032234b8ae1868e6d965e (patch)
tree6e4413f589d297548ae43b264a7504f727413f38 /src/mainboard/google
parentef639b2dd3ec7d322c59d53e4e614b31e209d8d3 (diff)
veyron*: use gpio_base2_value() in board_id()
This makes board_id() use the generic gpio_base2_value() function to obtain the value of the board ID straps. BUG=none BRANCH=none TEST=tested on pinky Change-Id: I15c1310889b989c34638fd342011aef5fe7bcec1 Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: fcbb8a6998a66531326afe16b232395d49fee64d Original-Signed-off-by: David Hendricks <dhendrix@chromium.org> Original-Change-Id: I5847bf1c5b26bcaf7d36103f31bb255b31ff8185 Original-Reviewed-on: https://chromium-review.googlesource.com/228370 Original-Reviewed-by: Julius Werner <jwerner@chromium.org> Reviewed-on: http://review.coreboot.org/9548 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src/mainboard/google')
-rw-r--r--src/mainboard/google/veyron_jerry/boardid.c10
-rw-r--r--src/mainboard/google/veyron_pinky/boardid.c10
2 files changed, 4 insertions, 16 deletions
diff --git a/src/mainboard/google/veyron_jerry/boardid.c b/src/mainboard/google/veyron_jerry/boardid.c
index 8d3e183ed1..66de2768f2 100644
--- a/src/mainboard/google/veyron_jerry/boardid.c
+++ b/src/mainboard/google/veyron_jerry/boardid.c
@@ -25,17 +25,11 @@
uint8_t board_id(void)
{
static int id = -1;
- static const gpio_t pins[] = {[3] = GPIO(2, A, 7), [2] = GPIO(2, A, 2),
+ static gpio_t pins[] = {[3] = GPIO(2, A, 7), [2] = GPIO(2, A, 2),
[1] = GPIO(2, A, 1), [0] = GPIO(2, A, 0)}; /* GPIO2_A0 is LSB */
if (id < 0) {
- int i;
-
- id = 0;
- for (i = 0; i < ARRAY_SIZE(pins); i++) {
- gpio_input(pins[i]);
- id |= gpio_get(pins[i]) << i;
- }
+ id = gpio_base2_value(pins, ARRAY_SIZE(pins));
printk(BIOS_SPEW, "Board ID: %d.\n", id);
}
diff --git a/src/mainboard/google/veyron_pinky/boardid.c b/src/mainboard/google/veyron_pinky/boardid.c
index 8d3e183ed1..66de2768f2 100644
--- a/src/mainboard/google/veyron_pinky/boardid.c
+++ b/src/mainboard/google/veyron_pinky/boardid.c
@@ -25,17 +25,11 @@
uint8_t board_id(void)
{
static int id = -1;
- static const gpio_t pins[] = {[3] = GPIO(2, A, 7), [2] = GPIO(2, A, 2),
+ static gpio_t pins[] = {[3] = GPIO(2, A, 7), [2] = GPIO(2, A, 2),
[1] = GPIO(2, A, 1), [0] = GPIO(2, A, 0)}; /* GPIO2_A0 is LSB */
if (id < 0) {
- int i;
-
- id = 0;
- for (i = 0; i < ARRAY_SIZE(pins); i++) {
- gpio_input(pins[i]);
- id |= gpio_get(pins[i]) << i;
- }
+ id = gpio_base2_value(pins, ARRAY_SIZE(pins));
printk(BIOS_SPEW, "Board ID: %d.\n", id);
}