Mathew King has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/36617 )
Change subject: mb/g/drallion: Consolidate 360 sensor board detection ......................................................................
mb/g/drallion: Consolidate 360 sensor board detection
Create a single function to determine if the 360 sensor board is present on a device.
BUG=b:143701965 TEST='emerge-drallion coreboot'
Change-Id: I4100a9fdcfe6b7134fb238cb291cb5b0af4ec169 Signed-off-by: Mathew King mathewk@chromium.org --- M src/mainboard/google/drallion/variants/drallion/gpio.c M src/mainboard/google/drallion/variants/drallion/include/variant/variant.h M src/mainboard/google/drallion/variants/drallion/sku.c 3 files changed, 12 insertions(+), 11 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/17/36617/1
diff --git a/src/mainboard/google/drallion/variants/drallion/gpio.c b/src/mainboard/google/drallion/variants/drallion/gpio.c index 5657eea..086dca0 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 @@ 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 508654f..71d78ad 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,9 @@ /* 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 7277629..736a145 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)