mb/google/volteer: ACPI nodes for volteer2_ti50

Unique among the Volteer devices, the volteer2_ti50 variant connects to
the TPM via I2C.  This CL introduces the proper devicestree declarations
for the Linux kernel to recognize that.

overridetree.cb is shared between "sub"-variants volteer2 and
volteer2_ti50, so both will have two TPM nodes, the I2C being disabled
by default.  The odd _ti50 variant then has code in variant.c to enable
the I2C node and disable the SPI node.

BUG=b:173461736
TEST=abuild -t GOOGLE_VOLTEER2{_TI50,} -c max -x

Change-Id: I5576a595bbabc34c62b768f8b3439e35ff6bcf7b
Signed-off-by: Jes Bodi Klinke <jbk@chromium.org>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/48223
Reviewed-by: Duncan Laurie <dlaurie@chromium.org>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Jes Klinke 2020-12-01 15:21:38 -08:00 committed by Patrick Georgi
parent a97fb7f960
commit 6e929acb73
6 changed files with 57 additions and 7 deletions

View File

@ -61,6 +61,7 @@ config BOARD_GOOGLE_VOLTEER2
select VARIANT_HAS_MIPI_CAMERA
select SOC_INTEL_CSE_LITE_SKU
select DRIVERS_GENESYSLOGIC_GL9755
select DRIVER_I2C_TPM_ACPI
# Reworked Volteer2 prototype, Haven chip replaced with Dauntless demo board
config BOARD_GOOGLE_VOLTEER2_TI50
@ -69,6 +70,7 @@ config BOARD_GOOGLE_VOLTEER2_TI50
select VARIANT_HAS_MIPI_CAMERA
select SOC_INTEL_CSE_LITE_SKU
select DRIVERS_GENESYSLOGIC_GL9755
select DRIVER_I2C_TPM_ACPI
config BOARD_GOOGLE_VOXEL
bool "-> Voxel"

View File

@ -23,8 +23,8 @@ extern struct chip_operations drivers_intel_pmc_mux_conn_ops;
static bool is_port1(struct device *dev)
{
return dev->path.type == DEVICE_PATH_GENERIC && dev->path.generic.id == 1 &&
dev->chip_ops == &drivers_intel_pmc_mux_conn_ops;
return dev->path.type == DEVICE_PATH_GENERIC && dev->path.generic.id == 1
&& dev->chip_ops == &drivers_intel_pmc_mux_conn_ops;
}
static void typec_orientation_fixup(void)
@ -53,14 +53,15 @@ static void typec_orientation_fixup(void)
if (!conn)
return;
if (fw_config_probe(FW_CONFIG(DB_USB, USB4_GEN2)) ||
fw_config_probe(FW_CONFIG(DB_USB, USB3_ACTIVE)) ||
fw_config_probe(FW_CONFIG(DB_USB, USB4_GEN3)) ||
fw_config_probe(FW_CONFIG(DB_USB, USB3_NO_A))) {
if (fw_config_probe(FW_CONFIG(DB_USB, USB4_GEN2))
|| fw_config_probe(FW_CONFIG(DB_USB, USB3_ACTIVE))
|| fw_config_probe(FW_CONFIG(DB_USB, USB4_GEN3))
|| fw_config_probe(FW_CONFIG(DB_USB, USB3_NO_A))) {
struct drivers_intel_pmc_mux_conn_config *config = conn->chip_info;
if (config) {
printk(BIOS_INFO, "Configure Right Type-C port orientation for retimer\n");
printk(BIOS_INFO,
"Configure Right Type-C port orientation for retimer\n");
config->sbu_orientation = TYPEC_ORIENTATION_NORMAL;
}
}
@ -70,6 +71,11 @@ static void mainboard_init(struct device *dev)
{
mainboard_ec_init();
typec_orientation_fixup();
variant_devtree_update();
}
void __weak variant_devtree_update(void)
{
}
static void add_fw_config_oem_string(const struct fw_config *config, void *arg)

View File

@ -21,4 +21,7 @@ const struct cros_gpio *variant_cros_gpios(size_t *num);
const struct ddr_memory_cfg *variant_memory_params(void);
int variant_memory_sku(void);
/* Modify devictree settings during ramstage. */
void variant_devtree_update(void);
#endif /* __BASEBOARD_VARIANTS_H__ */

View File

@ -3,3 +3,4 @@
bootblock-y += gpio.c
ramstage-y += gpio.c
ramstage-y += variant.c

View File

@ -201,6 +201,11 @@ chip soc/intel/tigerlake
register "key.label" = ""pen_eject""
device generic 0 on end
end
chip drivers/i2c/tpm
register "hid" = ""GOOG0005""
register "irq" = "ACPI_IRQ_EDGE_LOW(GPP_C21_IRQ)"
device i2c 50 off end
end
end
device ref i2c2 on
chip drivers/i2c/sx9310

View File

@ -0,0 +1,33 @@
/* SPDX-License-Identifier: GPL-2.0-only */
#include <baseboard/variants.h>
#include <soc/pci_devs.h>
#include <acpi/acpi_device.h>
extern struct chip_operations drivers_i2c_tpm_ops;
static bool match_i2c_tpm(DEVTREE_CONST struct device *dev)
{
return dev->chip_ops == &drivers_i2c_tpm_ops;
}
/*
* This function runs only on the volteer_ti50 variant, which has the GSC on a
* reworked I2C bus.
*/
static void devtree_enable_i2c_tpm(void)
{
struct device *spi_tpm = pcidev_path_on_root(PCH_DEVFN_GSPI0)->link_list->children;
struct device *i2c_tpm = dev_find_matching_device_on_bus(
pcidev_path_on_root(PCH_DEVFN_I2C1)->link_list, match_i2c_tpm);
if (!i2c_tpm || !spi_tpm)
return;
spi_tpm->enabled = 0;
i2c_tpm->enabled = 1;
}
void variant_devtree_update(void)
{
if (CONFIG(MAINBOARD_HAS_I2C_TPM_CR50))
devtree_enable_i2c_tpm();
}