Attention is currently required from: Tim Wawrzynczak, Patrick Rudolph. Maulik V Vaghela has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/59666 )
Change subject: soc/intel/alderlake: Implement function to map physical port to EC port ......................................................................
soc/intel/alderlake: Implement function to map physical port to EC port
Currently coreboot and EC had different logic to interpret TCSS port number which would break retimer update functionality since coreboot would pass wrong port information to EC.
To correct this, coreboot has implemented function which converts coreboot physical port mapping to EC's abstract port mapping.
Each SoC needs to implement this weak function since only SoC will have correct physical port mapping data. This function should resolve issue of port mismatch since coreboot will count only enabled ports and provide correct EC port number in return.
BUG=b:207057940 BRANCH=None TEST=Check if retimer update works on Redrix and correct port information is passed to EC.
Change-Id: I3735b7c7794b46123aba3beac8c0268ce72d658c Signed-off-by: MAULIK V VAGHELA maulik.v.vaghela@intel.com --- M src/soc/intel/alderlake/Makefile.inc A src/soc/intel/alderlake/retimer.c 2 files changed, 34 insertions(+), 0 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/66/59666/1
diff --git a/src/soc/intel/alderlake/Makefile.inc b/src/soc/intel/alderlake/Makefile.inc index a11352f..7c7018a 100644 --- a/src/soc/intel/alderlake/Makefile.inc +++ b/src/soc/intel/alderlake/Makefile.inc @@ -38,6 +38,7 @@ ramstage-y += pcie_rp.c ramstage-y += pmc.c ramstage-y += reset.c +ramstage-y += retimer.c ramstage-y += soundwire.c ramstage-y += systemagent.c ramstage-y += vr_config.c diff --git a/src/soc/intel/alderlake/retimer.c b/src/soc/intel/alderlake/retimer.c new file mode 100644 index 0000000..d0b2a8e --- /dev/null +++ b/src/soc/intel/alderlake/retimer.c @@ -0,0 +1,33 @@ +/* SPDX-License-Identifier: GPL-2.0-or-later */ + +#include <console/console.h> +#include <drivers/intel/usb4/retimer/retimer.h> +#include <intelblocks/tcss.h> +#include <string.h> +#include "retimer.h" + +uint8_t map_physical_port_to_ec_port(uint8_t usb_port) +{ + uint8_t ec_port = 0; + + const struct device *tcss_port_arr[] = { + DEV_PTR(tcss_usb3_port1), + DEV_PTR(tcss_usb3_port2), + DEV_PTR(tcss_usb3_port3), + DEV_PTR(tcss_usb3_port4), + }; + + for (uint8_t i = 0; i < MAX_TYPE_C_PORTS; i++) + { + if (i == usb_port) { + printk(BIOS_ERR, "USB Type-C %d mapped to EC port %d\n", i, ec_port); + return ec_port; + } + + if (is_dev_enabled(tcss_port_arr[i])) + ec_port++; + } + + // Code should not come here if usb_port input is correct + die("Couldn't find correct port mapping or Invalid input port \n"); +}