diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2014-08-08 15:38:52 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-03-26 00:26:50 +0100 |
commit | 573e21132fbe6ac3c750b59a3744766ddd750687 (patch) | |
tree | 154eb84bb91169dd230f3fe116e1ce776775b005 /src | |
parent | 3760272fb9639db22f54f54e2c32849720affde0 (diff) | |
download | coreboot-573e21132fbe6ac3c750b59a3744766ddd750687.tar.xz |
fix how to interpret board id read from gpios
nyan blaze fails to boot because tristates of the board id are interpreted in
the reverse order. this change fixes it.
BUG=none
TEST=Booted Blaze to Linux. Built firmware for Storm.
Branch=none
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Change-Id: I4ff8a15cf62869cea22931b5255c3a408a778ed2
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 3f59b13d615a8985edf2029d89af05e95aefad33
Original-Change-Id: I6d81092becb60d12e1cd2a92fc2c261da42c60f5
Original-Reviewed-on: https://chromium-review.googlesource.com/211700
Original-Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Original-Tested-by: Daisuke Nojiri <dnojiri@chromium.org>
Original-Reviewed-by: David Hendricks <dhendrix@chromium.org>
Original-Reviewed-by: Julius Werner <jwerner@chromium.org>
Original-Commit-Queue: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: http://review.coreboot.org/8980
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/include/gpiolib.h | 4 | ||||
-rw-r--r-- | src/lib/tristate_gpios.c | 2 | ||||
-rw-r--r-- | src/mainboard/google/storm/boardid.c | 2 |
3 files changed, 6 insertions, 2 deletions
diff --git a/src/include/gpiolib.h b/src/include/gpiolib.h index 850a661559..436f26ac04 100644 --- a/src/include/gpiolib.h +++ b/src/include/gpiolib.h @@ -31,6 +31,10 @@ typedef unsigned gpio_t; * bit fields, each representing one GPIO value, or a number where each GPIO is * included multiplied by 3^gpio_num, resulting in a true tertiary value. * + * gpio[]: pin positions to read. little-endian (less significant value first). + * num_gpio: number of pins to read. + * tertiary: 1: pins are interpreted as a quad coded tertiary. + * 0: pins are interpreted as a set of two bit fields. */ int gpio_get_in_tristate_values(gpio_t gpio[], int num_gpio, int tertiary); diff --git a/src/lib/tristate_gpios.c b/src/lib/tristate_gpios.c index 49f060c9c2..8e93e3704a 100644 --- a/src/lib/tristate_gpios.c +++ b/src/lib/tristate_gpios.c @@ -62,7 +62,7 @@ int gpio_get_in_tristate_values(gpio_t gpio[], int num_gpio, int tertiary) * 1: pull up * 2: floating */ - for (index = 0; index < num_gpio; ++index) { + for (index = num_gpio - 1; index >= 0; --index) { if (tertiary) id *= 3; else diff --git a/src/mainboard/google/storm/boardid.c b/src/mainboard/google/storm/boardid.c index c4a1af3da8..6d7a918088 100644 --- a/src/mainboard/google/storm/boardid.c +++ b/src/mainboard/google/storm/boardid.c @@ -40,7 +40,7 @@ uint8_t board_id(void) { uint8_t bid; - gpio_t hw_rev_gpios[] = {68, 30, 29}; + gpio_t hw_rev_gpios[] = {29, 30, 68}; int offset = 19; bid = gpio_get_in_tristate_values(hw_rev_gpios, |