Anil Kumar K has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/39868 )
Change subject: mb/google/deltaur: Return SKU ID info ......................................................................
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
Change-Id: I20a497739e5062400b093648c3a634203dec6105 Signed-off-by: Anil Kumar anil.kumar.k@intel.com --- M src/mainboard/google/deltaur/Makefile.inc A src/mainboard/google/deltaur/sku.c M src/mainboard/google/deltaur/variants/deltan/include/variant/gpio.h A src/mainboard/google/deltaur/variants/deltan/include/variant/variant.h M src/mainboard/google/deltaur/variants/deltaur/include/variant/gpio.h A src/mainboard/google/deltaur/variants/deltaur/include/variant/variant.h 6 files changed, 131 insertions(+), 2 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/68/39868/1
diff --git a/src/mainboard/google/deltaur/Makefile.inc b/src/mainboard/google/deltaur/Makefile.inc index a913c75..d005788 100644 --- a/src/mainboard/google/deltaur/Makefile.inc +++ b/src/mainboard/google/deltaur/Makefile.inc @@ -14,6 +14,7 @@ ramstage-$(CONFIG_CHROMEOS) += chromeos.c ramstage-y += ec.c ramstage-y += mainboard.c +ramstage-y += sku.c
verstage-$(CONFIG_CHROMEOS) += chromeos.c verstage-y += ec.c diff --git a/src/mainboard/google/deltaur/sku.c b/src/mainboard/google/deltaur/sku.c new file mode 100644 index 0000000..736a145 --- /dev/null +++ b/src/mainboard/google/deltaur/sku.c @@ -0,0 +1,34 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2019 Google LLC + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#include <boardid.h> +#include <smbios.h> +#include <ec/google/wilco/commands.h> +#include <variant/variant.h> + +static const uint32_t get_sku_index(void) +{ + return ((!has_360_sensor_board()) | (wilco_ec_signed_fw() << 1)); +} + +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/gpio.h b/src/mainboard/google/deltaur/variants/deltan/include/variant/gpio.h index a1e3789..f763bac 100644 --- a/src/mainboard/google/deltaur/variants/deltan/include/variant/gpio.h +++ b/src/mainboard/google/deltaur/variants/deltan/include/variant/gpio.h @@ -8,7 +8,9 @@ #define VARIANT_GPIO_H
#include <baseboard/gpio.h> - /* Copied from baseboard and may need to change for the new variant. */
+/* Sensor detection pin */ +#define SENSOR_DET_360 GPP_C10 + #endif 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 0000000..b57a49f --- /dev/null +++ b/src/mainboard/google/deltaur/variants/deltan/include/variant/variant.h @@ -0,0 +1,45 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2018 Google LLC + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef VARIANT_H +#define VARIANT_H + +#include <variant/gpio.h> +#include <gpio.h> +/* SKU ID structure */ +typedef struct { + int id; + const char *name; +} sku_info; + +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" }, +}; + + +/* Check if the device has a 360 sensor board present */ +static inline int has_360_sensor_board(void) +{ + return gpio_get(SENSOR_DET_360) == 0; +} + +#endif diff --git a/src/mainboard/google/deltaur/variants/deltaur/include/variant/gpio.h b/src/mainboard/google/deltaur/variants/deltaur/include/variant/gpio.h index a1e3789..acede5d 100644 --- a/src/mainboard/google/deltaur/variants/deltaur/include/variant/gpio.h +++ b/src/mainboard/google/deltaur/variants/deltaur/include/variant/gpio.h @@ -8,7 +8,10 @@ #define VARIANT_GPIO_H
#include <baseboard/gpio.h> - +#include <soc/gpio.h> /* Copied from baseboard and may need to change for the new variant. */
+/* Sensor detection pin */ +#define SENSOR_DET_360 GPP_C10 + #endif 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 0000000..4b2dca2 --- /dev/null +++ b/src/mainboard/google/deltaur/variants/deltaur/include/variant/variant.h @@ -0,0 +1,44 @@ +/* + * This file is part of the coreboot project. + * + * Copyright 2018 Google LLC + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#ifndef VARIANT_H +#define VARIANT_H + +#include <variant/gpio.h> + +/* SKU ID structure */ +typedef struct { + int id; + const char *name; +} sku_info; + +const static sku_info skus[] = { + /* Deltaur 360 */ + { .id = 3, .name = "sku3" }, + /* Deltaur */ + { .id = 4, .name = "sku4" }, + /* Deltaur 360 signed */ + { .id = 5, .name = "sku5" }, + /* Deltaur signed */ + { .id = 6, .name = "sku6" }, +}; + +/* Check if the device has a 360 sensor board present */ +static inline int has_360_sensor_board(void) +{ + return gpio_get(SENSOR_DET_360) == 0; +} + +#endif