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>
This commit is contained in:
parent
ef639b2dd3
commit
a0abd51e4e
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue