diff options
author | Vadim Bendebury <vbendeb@chromium.org> | 2014-09-08 14:04:08 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-03-28 08:48:17 +0100 |
commit | 2786ce0b485f39dd5c9fa0fc037fe214adb771e5 (patch) | |
tree | a08ad29a6a2d8ae49231c73932a134c2fb418e6c /src | |
parent | 1de971dd3202a02492e5738b40595afaa8aca153 (diff) |
storm: make sure board ID is calculated only once
Figuring out board_id on storm requires reading tertiary gpios, which
takes time. Let's calculate it once and reuse it when necessary.
BUG=none
TEST=verified board ID reported as 0 and 1 on proto0 and proto0.2
respectively.
Change-Id: I69f6afa3de8a175a1d723e95902efd15607e68b7
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 080c839c1c0c1b5e389b2382144ef67535bb4ff1
Original-Change-Id: I4e237077d1d9a96daebba462cd00f3f40be14518
Original-Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/217086
Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org>
Original-Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: http://review.coreboot.org/9119
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/mainboard/google/storm/boardid.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mainboard/google/storm/boardid.c b/src/mainboard/google/storm/boardid.c index 6d7a918088..683b5f4812 100644 --- a/src/mainboard/google/storm/boardid.c +++ b/src/mainboard/google/storm/boardid.c @@ -37,7 +37,9 @@ * revision. */ -uint8_t board_id(void) +static int board_id_value = -1; + +static uint8_t get_board_id(void) { uint8_t bid; gpio_t hw_rev_gpios[] = {29, 30, 68}; @@ -50,3 +52,11 @@ uint8_t board_id(void) return bid; } + +uint8_t board_id(void) +{ + if (board_id_value < 0) + board_id_value = get_board_id(); + + return board_id_value; +} |