From eafca1f13a7330697c23265a5e1cdb5eb14b89cf Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Wed, 22 Sep 2021 13:59:39 -0700 Subject: [PATCH] soc/intel/alderlake: Switch to using device pointers This change replaces the device tree walks with device pointers by using alias for tcss_usb3_port* devices. Change-Id: I65d9c83a9d0aab5a42f5a7cc6df98a154e79d16a Signed-off-by: Furquan Shaikh Reviewed-on: https://review.coreboot.org/c/coreboot/+/57848 Tested-by: build bot (Jenkins) Reviewed-by: Karthik Ramasubramanian Reviewed-by: Tim Wawrzynczak --- src/soc/intel/alderlake/fsp_params.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/soc/intel/alderlake/fsp_params.c b/src/soc/intel/alderlake/fsp_params.c index 541a9612d8..ec7bff6829 100644 --- a/src/soc/intel/alderlake/fsp_params.c +++ b/src/soc/intel/alderlake/fsp_params.c @@ -367,6 +367,13 @@ static void fill_fsps_igd_params(FSP_S_CONFIG *s_cfg, static void fill_fsps_tcss_params(FSP_S_CONFIG *s_cfg, const struct soc_intel_alderlake_config *config) { + 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), + }; + s_cfg->TcssAuxOri = config->TcssAuxOri; /* Explicitly clear this field to avoid using defaults */ @@ -385,15 +392,7 @@ static void fill_fsps_tcss_params(FSP_S_CONFIG *s_cfg, s_cfg->UsbTcPortEn = 0; for (int i = 0; i < MAX_TYPE_C_PORTS; i++) { - /* TCSS xHCI --> Root Hub --> Type-C Port */ - const struct device_path port_path[] = { - {.type = DEVICE_PATH_PCI, .pci.devfn = SA_DEVFN_TCSS_XHCI}, - {.type = DEVICE_PATH_USB, .usb.port_type = 0, .usb.port_id = 0}, - {.type = DEVICE_PATH_USB, .usb.port_type = 3, .usb.port_id = i} }; - const struct device *port = find_dev_nested_path(pci_root_bus(), port_path, - ARRAY_SIZE(port_path)); - - if (is_dev_enabled(port)) + if (is_dev_enabled(tcss_port_arr[i])) s_cfg->UsbTcPortEn |= BIT(i); } }