Patrick Georgi has submitted this change. ( https://review.coreboot.org/c/coreboot/+/35303 )
Change subject: mb/google/drallion: Enable 360 sensor detection ......................................................................
mb/google/drallion: Enable 360 sensor detection
Implementing logic to detect SKU model and enable ISH accordignly.
BUG=b:140748790
Change-Id: I22fafb43dce6545851883be556a02d65a01fc386 Signed-off-by: Bernardo Perez Priego bernardo.perez.priego@intel.com Reviewed-on: https://review.coreboot.org/c/coreboot/+/35303 Reviewed-by: Mathew King mathewk@chromium.org Reviewed-by: EricR Lai ericr_lai@compal.corp-partner.google.com Tested-by: build bot (Jenkins) no-reply@coreboot.org --- M src/mainboard/google/drallion/Makefile.inc M src/mainboard/google/drallion/romstage.c A src/mainboard/google/drallion/variants/baseboard/include/baseboard/variants.h M src/mainboard/google/drallion/variants/drallion/gpio.c M src/mainboard/google/drallion/variants/drallion/include/variant/gpio.h 5 files changed, 50 insertions(+), 0 deletions(-)
Approvals: build bot (Jenkins): Verified EricR Lai: Looks good to me, approved Mathew King: Looks good to me, approved
diff --git a/src/mainboard/google/drallion/Makefile.inc b/src/mainboard/google/drallion/Makefile.inc index e7c90bb..ae8251e 100644 --- a/src/mainboard/google/drallion/Makefile.inc +++ b/src/mainboard/google/drallion/Makefile.inc @@ -34,6 +34,9 @@ romstage-y += ec.c verstage-y += ec.c
+subdirs-y += variants/baseboard +CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/baseboard/include + subdirs-y += variants/$(VARIANT_DIR) CPPFLAGS_common += -I$(src)/mainboard/$(MAINBOARDDIR)/variants/$(VARIANT_DIR)/include
diff --git a/src/mainboard/google/drallion/romstage.c b/src/mainboard/google/drallion/romstage.c index 20eee7f..c9f009e 100644 --- a/src/mainboard/google/drallion/romstage.c +++ b/src/mainboard/google/drallion/romstage.c @@ -16,6 +16,9 @@ #include <ec/google/wilco/romstage.h> #include <soc/cnl_memcfg_init.h> #include <soc/romstage.h> +#include <baseboard/variants.h> + +void __weak variant_mainboard_post_init_params(FSPM_UPD *mupd) {}
static const struct cnl_mb_cfg memcfg = { /* Access memory info through SMBUS. */ @@ -57,6 +60,8 @@
void mainboard_memory_init_params(FSPM_UPD *memupd) { + variant_mainboard_post_init_params(memupd); + wilco_ec_romstage_init();
cannonlake_memcfg_init(&memupd->FspmConfig, &memcfg); diff --git a/src/mainboard/google/drallion/variants/baseboard/include/baseboard/variants.h b/src/mainboard/google/drallion/variants/baseboard/include/baseboard/variants.h new file mode 100644 index 0000000..1edd660 --- /dev/null +++ b/src/mainboard/google/drallion/variants/baseboard/include/baseboard/variants.h @@ -0,0 +1,23 @@ +/* + * 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. + */ + +#ifndef BASEBOARD_VARIANTS_H +#define BASEBOARD_VARIANTS_H + +#include <fsp/api.h> + +void variant_mainboard_post_init_params(FSPM_UPD *mupd); + +#endif /* BASEBOARD_VARIANTS_H */ diff --git a/src/mainboard/google/drallion/variants/drallion/gpio.c b/src/mainboard/google/drallion/variants/drallion/gpio.c index 064f96c..5fba04b 100644 --- a/src/mainboard/google/drallion/variants/drallion/gpio.c +++ b/src/mainboard/google/drallion/variants/drallion/gpio.c @@ -15,6 +15,9 @@
#include <variant/gpio.h> #include <vendorcode/google/chromeos/chromeos.h> +#include <gpio.h> +#include <soc/romstage.h> +#include <baseboard/variants.h>
/* Pad configuration in ramstage */ static const struct pad_config gpio_table[] = { @@ -271,3 +274,16 @@ *num = ARRAY_SIZE(cros_gpios); return cros_gpios; } + +static int is_ish_device_enabled(void) +{ + gpio_input(SENSOR_DET_360); + return gpio_get(SENSOR_DET_360) == 0; +} + +void variant_mainboard_post_init_params(FSPM_UPD *mupd) +{ + FSP_M_CONFIG *fsp_m_cfg = &mupd->FspmConfig; + if (fsp_m_cfg->PchIshEnable) + fsp_m_cfg->PchIshEnable = is_ish_device_enabled(); +} diff --git a/src/mainboard/google/drallion/variants/drallion/include/variant/gpio.h b/src/mainboard/google/drallion/variants/drallion/include/variant/gpio.h index 20cfbb8..251b40e 100644 --- a/src/mainboard/google/drallion/variants/drallion/include/variant/gpio.h +++ b/src/mainboard/google/drallion/variants/drallion/include/variant/gpio.h @@ -25,6 +25,9 @@ /* Recovery mode */ #define GPIO_REC_MODE GPP_E8
+/* Sensor detection pin */ +#define SENSOR_DET_360 GPP_H5 + /* Memory configuration board straps */ #define GPIO_MEM_CONFIG_0 GPP_F12 #define GPIO_MEM_CONFIG_1 GPP_F13