diff options
Diffstat (limited to 'src')
7 files changed, 100 insertions, 0 deletions
diff --git a/src/mainboard/google/deltaur/variants/baseboard/Makefile.inc b/src/mainboard/google/deltaur/variants/baseboard/Makefile.inc index 937cb4628f..277b75ab27 100644 --- a/src/mainboard/google/deltaur/variants/baseboard/Makefile.inc +++ b/src/mainboard/google/deltaur/variants/baseboard/Makefile.inc @@ -7,5 +7,6 @@ bootblock-y += gpio.c ramstage-y += gpio.c +ramstage-y += sku.c verstage-y += gpio.c diff --git a/src/mainboard/google/deltaur/variants/baseboard/gpio.c b/src/mainboard/google/deltaur/variants/baseboard/gpio.c index a67dd8cb4c..46a5cdd79d 100644 --- a/src/mainboard/google/deltaur/variants/baseboard/gpio.c +++ b/src/mainboard/google/deltaur/variants/baseboard/gpio.c @@ -468,3 +468,8 @@ const struct pad_config *__weak variant_early_gpio_table(size_t *num) *num = ARRAY_SIZE(early_gpio_table); return early_gpio_table; } + +int __weak has_360_sensor_board(void) +{ + return 0; +} diff --git a/src/mainboard/google/deltaur/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/deltaur/variants/baseboard/include/baseboard/variants.h index a1f1b22ec1..332a2c6ea3 100644 --- a/src/mainboard/google/deltaur/variants/baseboard/include/baseboard/variants.h +++ b/src/mainboard/google/deltaur/variants/baseboard/include/baseboard/variants.h @@ -25,4 +25,13 @@ const struct cros_gpio *variant_cros_gpios(size_t *num); const struct lpddr4x_cfg *variant_memory_params(void); 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__ */ diff --git a/src/mainboard/google/deltaur/variants/baseboard/sku.c b/src/mainboard/google/deltaur/variants/baseboard/sku.c new file mode 100644 index 0000000000..8465e64137 --- /dev/null +++ b/src/mainboard/google/deltaur/variants/baseboard/sku.c @@ -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; +} diff --git a/src/mainboard/google/deltaur/variants/deltan/include/variant/variant.h b/src/mainboard/google/deltaur/variants/deltan/include/variant/variant.h new file mode 100644 index 0000000000..be4c970959 --- /dev/null +++ b/src/mainboard/google/deltaur/variants/deltan/include/variant/variant.h @@ -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 diff --git a/src/mainboard/google/deltaur/variants/deltaur/gpio.c b/src/mainboard/google/deltaur/variants/deltaur/gpio.c index 30315bbc2e..02cb127504 100644 --- a/src/mainboard/google/deltaur/variants/deltaur/gpio.c +++ b/src/mainboard/google/deltaur/variants/deltaur/gpio.c @@ -7,6 +7,8 @@ #include <baseboard/gpio.h> #include <baseboard/variants.h> #include <commonlib/helpers.h> +#include <gpio.h> +#include <variant/variant.h> /* Pad configuration in ramstage */ 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); 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; +} diff --git a/src/mainboard/google/deltaur/variants/deltaur/include/variant/variant.h b/src/mainboard/google/deltaur/variants/deltaur/include/variant/variant.h new file mode 100644 index 0000000000..8a5e3a83a8 --- /dev/null +++ b/src/mainboard/google/deltaur/variants/deltaur/include/variant/variant.h @@ -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 |