flapjack: get sku_id from ec (cbi)

On flapjack, retrieve the board information via CBI interface.

Also reserving 0x2 sku_id for the case of un-provisioned board as this is the id
used prior to the readiness of cbi.

BUG=b:123676982
BRANCH=kukui
TEST=provisioned cbi info and verify the sku_id.

Signed-off-by: YH Lin <yueherngl@google.com>
Change-Id: Iad7a52df38e2045abbdded8ba0a1f1544de961fc
Reviewed-on: https://review.coreboot.org/c/31586
Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
YH Lin 2019-02-22 19:25:02 -08:00 committed by Patrick Georgi
parent 6220f8d833
commit 967edec254
1 changed files with 11 additions and 0 deletions

View File

@ -16,8 +16,11 @@
#include <assert.h>
#include <boardid.h>
#include <soc/auxadc.h>
#include <ec/google/chromeec/ec.h>
#include <stddef.h>
#define FLAPJACK_UNDEF_SKU_ID 2 /* For all un-provisioned Flapjack boards */
static uint32_t get_index(unsigned int channel, uint32_t *cached_id)
{
static const int voltages[] = {
@ -64,6 +67,14 @@ uint32_t sku_id(void)
{
static uint32_t cached_sku_id = BOARD_ID_INIT;
/* On Flapjack, getting the SKU via CBI */
if (IS_ENABLED(CONFIG_BOARD_GOOGLE_FLAPJACK)) {
if (cached_sku_id == BOARD_ID_INIT &&
google_chromeec_cbi_get_sku_id(&cached_sku_id))
cached_sku_id = FLAPJACK_UNDEF_SKU_ID;
return cached_sku_id;
}
/* Quirk for KUKUI: All P1/SKU0 had incorrectly set SKU=1. */
if (IS_ENABLED(CONFIG_BOARD_GOOGLE_KUKUI)) {
if (cached_sku_id == BOARD_ID_INIT && board_id() == 1) {