diff options
author | CoolStar <coolstarorganization@gmail.com> | 2023-02-07 14:44:54 -0800 |
---|---|---|
committer | Martin L Roth <gaumless@gmail.com> | 2023-08-06 19:25:34 +0000 |
commit | 9c7433ec557f9f06d7fb4fdc262fe09500d00903 (patch) | |
tree | c510e5fa4192bf0ca7ef3dc06ffc680cc9809cf2 /src/soc/intel/common/block/tcss | |
parent | b33778e71fe183b1f51904119d35f721a411c8ae (diff) | |
download | coreboot-9c7433ec557f9f06d7fb4fdc262fe09500d00903.tar.gz coreboot-9c7433ec557f9f06d7fb4fdc262fe09500d00903.tar.bz2 coreboot-9c7433ec557f9f06d7fb4fdc262fe09500d00903.zip |
soc/intel/common/tcss: Configure USB-C ports with attached devices
Inspect all type-C USB ports, check if there is a USB device attached,
and if so, send the connection request to the PMC. This allows for any
attached USB2/USB3 devices to be used for booting by the payload.
Since this functionality is only needed by ChromeOS devices with TCSS
running upstream coreboot, introduce a new Kconfig to guard its use.
Boards needing it will select it in subsequent commits.
TEST=tested with rest of patch train
Change-Id: I69522dbcc8cae6bbf41659ae653107d0e031c812
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/72909
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-by: Martin L Roth <gaumless@gmail.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Diffstat (limited to 'src/soc/intel/common/block/tcss')
-rw-r--r-- | src/soc/intel/common/block/tcss/Kconfig | 8 | ||||
-rw-r--r-- | src/soc/intel/common/block/tcss/tcss.c | 29 |
2 files changed, 37 insertions, 0 deletions
diff --git a/src/soc/intel/common/block/tcss/Kconfig b/src/soc/intel/common/block/tcss/Kconfig index 2e679138cd65..4af75fc559e0 100644 --- a/src/soc/intel/common/block/tcss/Kconfig +++ b/src/soc/intel/common/block/tcss/Kconfig @@ -9,3 +9,11 @@ config ENABLE_TCSS_DISPLAY_DETECTION depends on SOC_INTEL_COMMON_BLOCK_TCSS && RUN_FSP_GOP help Enable displays to be detected over Type-C ports during boot. + +config ENABLE_TCSS_USB_DETECTION + bool "Enable detection of USB boot devices attached to USB Type-C ports with TCSS" + depends on SOC_INTEL_COMMON_BLOCK_TCSS + help + Enable USB-C attached storage devices to be detected at boot. + This option is required for some payloads (eg, edk2), without which devices attached + to USB-C ports will not be detected and available to boot from. diff --git a/src/soc/intel/common/block/tcss/tcss.c b/src/soc/intel/common/block/tcss/tcss.c index 23427b444ec8..7c58e3ae58be 100644 --- a/src/soc/intel/common/block/tcss/tcss.c +++ b/src/soc/intel/common/block/tcss/tcss.c @@ -340,6 +340,32 @@ static void tcss_configure_dp_mode(const struct tcss_port_map *port_map, size_t } } +static void tcss_configure_usb_mode(const struct tcss_port_map *port_map, size_t num_ports) +{ + int ret; + size_t i; + const struct usbc_ops *ops; + struct usbc_mux_info mux_info; + const struct tcss_port_map *port_info; + + ops = usbc_get_ops(); + if (ops == NULL) + return; + + for (i = 0; i < num_ports; i++) { + ret = ops->mux_ops.get_mux_info(i, &mux_info); + if ((ret < 0) || !mux_info.usb || (mux_info.dp && mux_info.hpd_lvl)) + continue; + + port_info = &port_map[i]; + ret = send_pmc_connect_request(i, &mux_info, port_info); + if (ret) { + printk(BIOS_ERR, "Port %zu connect request failed\n", i); + continue; + } + } +} + static uint32_t calc_bias_ctrl_reg_value(gpio_t pad) { unsigned int vw_index, vw_bit; @@ -429,6 +455,9 @@ void tcss_configure(const struct typec_aux_bias_pads aux_bias_pads[MAX_TYPE_C_PO if (CONFIG(ENABLE_TCSS_DISPLAY_DETECTION)) tcss_configure_dp_mode(port_map, num_ports); + + if (CONFIG(ENABLE_TCSS_USB_DETECTION)) + tcss_configure_usb_mode(port_map, num_ports); } } |