Attention is currently required from: Tim Wawrzynczak. Deepti Deshatty has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/54090 )
Change subject: mb/google/brya: Enable TCSS ......................................................................
mb/google/brya: Enable TCSS
Enable flag SOC_INTEL_COMMON_BLOCK_TCSS. Add 'mainboard_tcss_get_port_info' function similar to volteer.
TEST=Verified build for brya
Signed-off-by: Deepti Deshatty deepti.deshatty@intel.com Change-Id: Ie3cb8b8836b17fa00ab0089d03fca9f22c4d702e --- M src/mainboard/google/brya/Kconfig M src/mainboard/google/brya/mainboard.c 2 files changed, 63 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/90/54090/1
diff --git a/src/mainboard/google/brya/Kconfig b/src/mainboard/google/brya/Kconfig index a910cc7..93f854d 100644 --- a/src/mainboard/google/brya/Kconfig +++ b/src/mainboard/google/brya/Kconfig @@ -24,6 +24,7 @@ select SOC_INTEL_ALDERLAKE select SOC_INTEL_COMMON_BLOCK_PCIE_RTD3 select SOC_INTEL_CSE_LITE_SKU + select SOC_INTEL_COMMON_BLOCK_TCSS
if BOARD_GOOGLE_BASEBOARD_BRYA
diff --git a/src/mainboard/google/brya/mainboard.c b/src/mainboard/google/brya/mainboard.c index 99a060d..09f9e25 100644 --- a/src/mainboard/google/brya/mainboard.c +++ b/src/mainboard/google/brya/mainboard.c @@ -5,6 +5,68 @@ #include <device/device.h> #include <ec/ec.h> #include <vendorcode/google/chromeos/chromeos.h> +#include <intelblocks/tcss.h> +#include <soc/pci_devs.h> +#include "drivers/intel/pmc_mux/conn/chip.h" + +extern struct chip_operations drivers_intel_pmc_mux_conn_ops; + +static bool is_correct_port(const struct device *dev, int port) +{ + return dev->path.type == DEVICE_PATH_GENERIC && dev->path.generic.id == port + && dev->chip_ops == &drivers_intel_pmc_mux_conn_ops; +} + +static const struct drivers_intel_pmc_mux_conn_config *get_connector_config( + const struct device *mux, + int port) +{ + const struct drivers_intel_pmc_mux_conn_config *config = NULL; + DEVTREE_CONST struct device *conn = NULL; + + while ((conn = dev_bus_each_child(mux->link_list, conn)) != NULL) { + if (is_correct_port(conn, port)) + break; + } + + if (conn) + config = (const struct drivers_intel_pmc_mux_conn_config *) conn->chip_info; + + return config; +} + +const struct tcss_port_map *mainboard_tcss_get_port_info(size_t *num_ports) +{ + static struct tcss_port_map port_map[MAX_TYPE_C_PORTS]; + size_t port; + const struct device *pmc; + const struct device *mux; + const struct drivers_intel_pmc_mux_conn_config *mux_config; + size_t active_ports = 0; + + pmc = pcidev_path_on_root(PCH_DEVFN_PMC); + if (!pmc || !pmc->link_list) { + printk(BIOS_ERR, "%s: unable to find PMC device or its mux\n", __func__); + return NULL; + } + + mux = pmc->link_list->children; + if (!mux) + return NULL; + + for (port = 0; port < MAX_TYPE_C_PORTS; port++) { + mux_config = get_connector_config(mux, port); + if (mux_config == NULL) + continue; + + port_map[active_ports].usb2_port = mux_config->usb2_port_number; + port_map[active_ports].usb3_port = mux_config->usb3_port_number; + active_ports++; + } + + *num_ports = active_ports; + return port_map; +}
static void mainboard_init(void *chip_info) {