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>
This commit is contained in:
Mathew King 2019-11-04 12:29:41 -07:00 committed by Patrick Georgi
parent 763eeecb30
commit 51b1fc6e39
3 changed files with 13 additions and 11 deletions

View File

@ -14,6 +14,7 @@
*/ */
#include <variant/gpio.h> #include <variant/gpio.h>
#include <variant/variant.h>
#include <vendorcode/google/chromeos/chromeos.h> #include <vendorcode/google/chromeos/chromeos.h>
#include <gpio.h> #include <gpio.h>
#include <soc/romstage.h> #include <soc/romstage.h>
@ -274,17 +275,11 @@ const struct cros_gpio *variant_cros_gpios(size_t *num)
return 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) void variant_mainboard_post_init_params(FSPM_UPD *mupd)
{ {
FSP_M_CONFIG *fsp_m_cfg = &mupd->FspmConfig; FSP_M_CONFIG *fsp_m_cfg = &mupd->FspmConfig;
if (fsp_m_cfg->PchIshEnable) 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 * Disable memory channel by HW strap pin, HW default is enable

View File

@ -16,6 +16,9 @@
#ifndef VARIANT_H #ifndef VARIANT_H
#define VARIANT_H #define VARIANT_H
#include <gpio.h>
#include <variant/gpio.h>
/* Need to update for Drallion with right SKU IDs*/ /* Need to update for Drallion with right SKU IDs*/
typedef struct { typedef struct {
int id; int id;
@ -36,4 +39,10 @@ const static sku_info skus[] = {
/* Return memory SKU for the variant */ /* Return memory SKU for the variant */
int variant_memory_sku(void); 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 #endif

View File

@ -14,15 +14,13 @@
*/ */
#include <boardid.h> #include <boardid.h>
#include <ec/google/wilco/commands.h>
#include <smbios.h> #include <smbios.h>
#include <ec/google/wilco/commands.h>
#include <variant/variant.h> #include <variant/variant.h>
#include <gpio.h>
#include <variant/gpio.h>
static const uint32_t get_sku_index(void) 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) uint32_t sku_id(void)