diff options
3 files changed, 13 insertions, 11 deletions
diff --git a/src/mainboard/google/drallion/variants/drallion/gpio.c b/src/mainboard/google/drallion/variants/drallion/gpio.c index 5657eeaae1..086dca0265 100644 --- a/src/mainboard/google/drallion/variants/drallion/gpio.c +++ b/src/mainboard/google/drallion/variants/drallion/gpio.c @@ -14,6 +14,7 @@ */ #include <variant/gpio.h> +#include <variant/variant.h> #include <vendorcode/google/chromeos/chromeos.h> #include <gpio.h> #include <soc/romstage.h> @@ -274,17 +275,11 @@ const struct cros_gpio *variant_cros_gpios(size_t *num) 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(); + fsp_m_cfg->PchIshEnable = has_360_sensor_board(); /* * Disable memory channel by HW strap pin, HW default is enable diff --git a/src/mainboard/google/drallion/variants/drallion/include/variant/variant.h b/src/mainboard/google/drallion/variants/drallion/include/variant/variant.h index 508654faa5..bf08ec30dc 100644 --- a/src/mainboard/google/drallion/variants/drallion/include/variant/variant.h +++ b/src/mainboard/google/drallion/variants/drallion/include/variant/variant.h @@ -16,6 +16,9 @@ #ifndef VARIANT_H #define VARIANT_H +#include <gpio.h> +#include <variant/gpio.h> + /* Need to update for Drallion with right SKU IDs*/ typedef struct { int id; @@ -36,4 +39,10 @@ const static sku_info skus[] = { /* Return memory SKU for the variant */ int variant_memory_sku(void); +/* 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/drallion/variants/drallion/sku.c b/src/mainboard/google/drallion/variants/drallion/sku.c index 72776299b0..736a14579a 100644 --- a/src/mainboard/google/drallion/variants/drallion/sku.c +++ b/src/mainboard/google/drallion/variants/drallion/sku.c @@ -14,15 +14,13 @@ */ #include <boardid.h> -#include <ec/google/wilco/commands.h> #include <smbios.h> +#include <ec/google/wilco/commands.h> #include <variant/variant.h> -#include <gpio.h> -#include <variant/gpio.h> static const uint32_t get_sku_index(void) { - return (gpio_get(SENSOR_DET_360) | (wilco_ec_signed_fw() << 1)); + return ((!has_360_sensor_board()) | (wilco_ec_signed_fw() << 1)); } uint32_t sku_id(void) |