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>
This commit is contained in:
Aaron Durbin 2017-09-22 17:05:59 -06:00
parent 8f08f5f5c7
commit a871059ef2
2 changed files with 12 additions and 3 deletions

View File

@ -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;
}

View File

@ -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);