summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathew King <mathewk@chromium.org>2019-11-04 12:29:41 -0700
committerPatrick Georgi <pgeorgi@google.com>2019-11-06 13:58:00 +0000
commit51b1fc6e3929229e997fe16aa8f653bfcd112eeb (patch)
treeda96d91f4bdd1f39fba87021c40bd7e6bae2aea7
parent763eeecb30ed09cdfedbb811aacd19f24478afee (diff)
downloadcoreboot-51b1fc6e3929229e997fe16aa8f653bfcd112eeb.tar.xz
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> Reviewed-on: https://review.coreboot.org/c/coreboot/+/36617 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: EricR Lai <ericr_lai@compal.corp-partner.google.com>
-rw-r--r--src/mainboard/google/drallion/variants/drallion/gpio.c9
-rw-r--r--src/mainboard/google/drallion/variants/drallion/include/variant/variant.h9
-rw-r--r--src/mainboard/google/drallion/variants/drallion/sku.c6
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)