mb/google/volteer: Switch to using device pointers using alias names
This change replaces the device tree walks with device pointers by using alias names for the following devices: 1. PMC MUX connector 2. SPI TPM 3. I2C TPM Change-Id: I38f87d3a90a7253f2a29aba7db9a9f9744985494 Signed-off-by: Furquan Shaikh <furquan@google.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/57740 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Nick Vaccaro <nvaccaro@google.com> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
parent
4aba7395b7
commit
522174ba38
|
@ -20,38 +20,13 @@
|
|||
|
||||
#include "drivers/intel/pmc_mux/conn/chip.h"
|
||||
|
||||
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;
|
||||
}
|
||||
WEAK_DEV_PTR(conn1);
|
||||
|
||||
static void typec_orientation_fixup(void)
|
||||
{
|
||||
/*
|
||||
* TODO: This is an ugly hack, see if there's a better way to accomplish this same thing
|
||||
* via fw_config + devicetree, i.e., change a register's value depending on fw_config
|
||||
* probing.
|
||||
*/
|
||||
const struct device *pmc;
|
||||
const struct device *mux;
|
||||
const struct device *conn;
|
||||
const struct device *conn = DEV_PTR(conn1);
|
||||
|
||||
pmc = pcidev_path_on_root(PCH_DEVFN_PMC);
|
||||
if (!pmc || !pmc->link_list->children) {
|
||||
printk(BIOS_ERR, "%s: unable to find PMC device or its mux\n", __func__);
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Find port 1 underneath PMC.MUX; some variants may not have this defined, so it's okay
|
||||
* to just silently return here.
|
||||
*/
|
||||
mux = pmc->link_list->children;
|
||||
conn = dev_find_matching_device_on_bus(mux->link_list, is_port1);
|
||||
if (!conn)
|
||||
if (!is_dev_enabled(conn))
|
||||
return;
|
||||
|
||||
if (fw_config_probe(FW_CONFIG(DB_USB, USB4_GEN2))
|
||||
|
|
|
@ -508,7 +508,7 @@ chip soc/intel/tigerlake
|
|||
register "hid" = "ACPI_DT_NAMESPACE_HID"
|
||||
register "compat_string" = ""google,cr50""
|
||||
register "irq" = "ACPI_IRQ_EDGE_LOW(GPP_C21_IRQ)"
|
||||
device spi 0 on end
|
||||
device spi 0 alias spi_tpm on end
|
||||
end
|
||||
end
|
||||
device ref gspi1 on
|
||||
|
|
|
@ -207,7 +207,7 @@ chip soc/intel/tigerlake
|
|||
chip drivers/i2c/tpm
|
||||
register "hid" = ""GOOG0005""
|
||||
register "irq" = "ACPI_IRQ_EDGE_LOW(GPP_C21_IRQ)"
|
||||
device i2c 50 off end
|
||||
device i2c 50 alias i2c_tpm off end
|
||||
end
|
||||
end
|
||||
device ref i2c2 on
|
||||
|
|
|
@ -4,22 +4,14 @@
|
|||
#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);
|
||||
struct device *spi_tpm = DEV_PTR(spi_tpm);
|
||||
struct device *i2c_tpm = DEV_PTR(i2c_tpm);
|
||||
if (!i2c_tpm || !spi_tpm)
|
||||
return;
|
||||
spi_tpm->enabled = 0;
|
||||
|
|
Loading…
Reference in New Issue