summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Durbin <adurbin@chromium.org>2017-09-22 17:05:59 -0600
committerAaron Durbin <adurbin@chromium.org>2017-09-26 03:35:24 +0000
commita871059ef2f4a4ddbd539f0af8c89bef8e257ffe (patch)
tree93a2e53b7f8d9abefa6366d4edcbed0d4874f0a4
parent8f08f5f5c71d7214b5bdd40f298177205e663a96 (diff)
downloadcoreboot-a871059ef2f4a4ddbd539f0af8c89bef8e257ffe.tar.xz
mainboard/google/reef: expose sku strapping helper function
variant_board_sku() callback exists to allow some of the variants to report the sku id differently based on board implementation. However, there are cases where there are multiple ways to encode the sku id, but the original way should be used as a fallback. As such expose a helper function, sku_strapping_value(), such that there isn't code duplication for the common fallback case. BUG=b:65339688 Change-Id: I1e917733eb89aebc41a483e2001a02acfda31bf4 Signed-off-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: https://review.coreboot.org/21645 Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
-rw-r--r--src/mainboard/google/reef/mainboard.c12
-rw-r--r--src/mainboard/google/reef/variants/baseboard/include/baseboard/variants.h3
2 files changed, 12 insertions, 3 deletions
diff --git a/src/mainboard/google/reef/mainboard.c b/src/mainboard/google/reef/mainboard.c
index 8c7ec3cc05..3de383a689 100644
--- a/src/mainboard/google/reef/mainboard.c
+++ b/src/mainboard/google/reef/mainboard.c
@@ -52,16 +52,22 @@ static void mainboard_init(void *chip_info)
* a pulldown. This way we can generate 9 different values with the
* 2 pins.
*/
-uint8_t __attribute__((weak)) variant_board_sku(void)
+uint8_t sku_strapping_value(void)
{
- static int board_sku_num = -1;
gpio_t board_sku_gpios[] = {
[1] = GPIO_17, [0] = GPIO_16,
};
const size_t num = ARRAY_SIZE(board_sku_gpios);
+ return gpio_base3_value(board_sku_gpios, num);
+}
+
+uint8_t __attribute__((weak)) variant_board_sku(void)
+{
+ static int board_sku_num = -1;
+
if (board_sku_num < 0)
- board_sku_num = gpio_base3_value(board_sku_gpios, num);
+ board_sku_num = sku_strapping_value();
return board_sku_num;
}
diff --git a/src/mainboard/google/reef/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/reef/variants/baseboard/include/baseboard/variants.h
index 535bf34311..13a52f55d0 100644
--- a/src/mainboard/google/reef/variants/baseboard/include/baseboard/variants.h
+++ b/src/mainboard/google/reef/variants/baseboard/include/baseboard/variants.h
@@ -21,6 +21,9 @@
#include <stdint.h>
#include <vendorcode/google/chromeos/chromeos.h>
+/* Return the sku id based off the strapping resistors attached to SoC. */
+uint8_t sku_strapping_value(void);
+
/* Return the board id for the current variant board. */
uint8_t variant_board_id(void);