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 <furquan@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/57848
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Karthik Ramasubramanian <kramasub@google.com>
Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org>
This commit is contained in:
Furquan Shaikh 2021-09-22 13:59:39 -07:00 committed by Paul Fagerburg
parent 20c709daad
commit eafca1f13a
1 changed files with 8 additions and 9 deletions

View File

@ -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);
}
}