mb/google/deltaur: Return SKU ID info

For Deltaur and Deltan variants return proper SKU ID based on EC
firmware type and sensor detect GPIO value

BUG=b:152544516
TEST=make build successful for deltan

Change-Id: I20a497739e5062400b093648c3a634203dec6105
Signed-off-by: Anil Kumar <anil.kumar.k@intel.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/39868
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
Reviewed-by: EricR Lai <ericr_lai@compal.corp-partner.google.com>
This commit is contained in:
Anil Kumar 2020-03-26 16:35:23 -07:00 committed by Martin Roth
parent 06684979f9
commit c6f5b05cf3
7 changed files with 100 additions and 0 deletions

View File

@ -7,5 +7,6 @@
bootblock-y += gpio.c bootblock-y += gpio.c
ramstage-y += gpio.c ramstage-y += gpio.c
ramstage-y += sku.c
verstage-y += gpio.c verstage-y += gpio.c

View File

@ -468,3 +468,8 @@ const struct pad_config *__weak variant_early_gpio_table(size_t *num)
*num = ARRAY_SIZE(early_gpio_table); *num = ARRAY_SIZE(early_gpio_table);
return early_gpio_table; return early_gpio_table;
} }
int __weak has_360_sensor_board(void)
{
return 0;
}

View File

@ -25,4 +25,13 @@ const struct cros_gpio *variant_cros_gpios(size_t *num);
const struct lpddr4x_cfg *variant_memory_params(void); const struct lpddr4x_cfg *variant_memory_params(void);
void variant_memory_init(FSP_M_CONFIG *mem_cfg); void variant_memory_init(FSP_M_CONFIG *mem_cfg);
/* SKU ID structure */
typedef struct {
int id;
const char *name;
} sku_info;
/* Check if the device has a 360 sensor board present */
int has_360_sensor_board(void);
#endif /* __BASEBOARD_VARIANTS_H__ */ #endif /* __BASEBOARD_VARIANTS_H__ */

View File

@ -0,0 +1,26 @@
/*
* This file is part of the coreboot project.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include <baseboard/variants.h>
#include <boardid.h>
#include <ec/google/wilco/commands.h>
#include <smbios.h>
#include <variant/variant.h>
static const uint32_t get_sku_index(void)
{
return ((!has_360_sensor_board()) | (wilco_ec_signed_fw() << 1));
}
const uint32_t sku_id(void)
{
return skus[get_sku_index()].id;
}
const char *smbios_system_sku(void)
{
return skus[get_sku_index()].name;
}

View File

@ -0,0 +1,25 @@
/*
* This file is part of the coreboot project.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef VARIANT_H
#define VARIANT_H
#include <baseboard/variants.h>
#include <gpio.h>
#include <variant/gpio.h>
const static sku_info skus[] = {
/* Deltan 360 - invalid configuration */
{ .id = -1, .name = "sku_invalid" },
/* Deltan */
{ .id = 1, .name = "sku1" },
/* Deltan 360 signed - invalid configuration */
{ .id = -1, .name = "sku_invalid" },
/* Deltan signed */
{ .id = 2, .name = "sku2" },
};
#endif

View File

@ -7,6 +7,8 @@
#include <baseboard/gpio.h> #include <baseboard/gpio.h>
#include <baseboard/variants.h> #include <baseboard/variants.h>
#include <commonlib/helpers.h> #include <commonlib/helpers.h>
#include <gpio.h>
#include <variant/variant.h>
/* Pad configuration in ramstage */ /* Pad configuration in ramstage */
static const struct pad_config gpio_table[] = { static const struct pad_config gpio_table[] = {
@ -29,3 +31,9 @@ const struct pad_config *variant_early_gpio_table(size_t *num)
*num = ARRAY_SIZE(early_gpio_table); *num = ARRAY_SIZE(early_gpio_table);
return early_gpio_table; return early_gpio_table;
} }
/* Check if the device has a 360 sensor board present */
int has_360_sensor_board(void)
{
return gpio_get(SENSOR_DET_360) == 0;
}

View File

@ -0,0 +1,26 @@
/*
* This file is part of the coreboot project.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#ifndef VARIANT_H
#define VARIANT_H
#include <baseboard/variants.h>
/* TODO b/153027724: Sensor detection pin */
#define SENSOR_DET_360 GPP_C10
const static sku_info skus[] = {
/* Deltaur 360 */
{ .id = 1, .name = "sku1" },
/* Deltaur */
{ .id = 2, .name = "sku2" },
/* Deltaur 360 signed */
{ .id = 3, .name = "sku3" },
/* Deltaur signed */
{ .id = 4, .name = "sku4" },
};
#endif