From a0abd51e4edb6b00c82032234b8ae1868e6d965e Mon Sep 17 00:00:00 2001 From: David Hendricks Date: Fri, 7 Nov 2014 13:48:49 -0800 Subject: 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 Original-Commit-Id: fcbb8a6998a66531326afe16b232395d49fee64d Original-Signed-off-by: David Hendricks Original-Change-Id: I5847bf1c5b26bcaf7d36103f31bb255b31ff8185 Original-Reviewed-on: https://chromium-review.googlesource.com/228370 Original-Reviewed-by: Julius Werner Reviewed-on: http://review.coreboot.org/9548 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/mainboard/google/veyron_jerry/boardid.c | 10 ++-------- src/mainboard/google/veyron_pinky/boardid.c | 10 ++-------- 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); } -- cgit v1.2.3