Attention is currently required from: Patrick Rudolph. Brandon Breitenstein has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/51194 )
Change subject: soc/intel/tigerlake: Enable TCSS Muxes to disconnect mode during boot ......................................................................
soc/intel/tigerlake: Enable TCSS Muxes to disconnect mode during boot
TCSS muxes being left uninitialized during boot is causing some USB3 devices to downgrade to USB2 speed. To properly configure the Type C ports the muxes should be set to disconnected state during boot so that devices connected on the ports are not initialized till the ports are set to the appropriate mode.
BUG=b:180426950 BRANCH=firmware-volteer-13672.B TEST= Connected USB3 storage device and rebooted the system multiple times to verify that the devices were no longer downgrading to USB2 speed.
Change-Id: I4352072a4a7d6ccb1364b38377831f3c22ae8fb4 Signed-off-by: Brandon Breitenstein brandon.breitenstein@intel.com --- M src/soc/intel/tigerlake/Kconfig M src/soc/intel/tigerlake/early_tcss.c M src/soc/intel/tigerlake/fsp_params.c M src/soc/intel/tigerlake/include/soc/early_tcss.h 4 files changed, 67 insertions(+), 6 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/94/51194/1
diff --git a/src/soc/intel/tigerlake/Kconfig b/src/soc/intel/tigerlake/Kconfig index bf204f5..c1c5aca 100644 --- a/src/soc/intel/tigerlake/Kconfig +++ b/src/soc/intel/tigerlake/Kconfig @@ -244,6 +244,11 @@ help Enable displays to be detected over Type-C ports during boot.
+config EARLY_TCSS + bool "Enable early TCSS device Init" + help + Enables TCSS to initialize devices before Kernel. + config DATA_BUS_WIDTH int default 128 diff --git a/src/soc/intel/tigerlake/early_tcss.c b/src/soc/intel/tigerlake/early_tcss.c index 8616bb1..ff87be8 100644 --- a/src/soc/intel/tigerlake/early_tcss.c +++ b/src/soc/intel/tigerlake/early_tcss.c @@ -104,6 +104,29 @@ return -1; }
+static int send_pmc_disconnect_request(int port, struct tcss_mux mux_data, + struct pmc_ipc_buffer *res) +{ + uint32_t cmd; + struct pmc_ipc_buffer req = { 0 }; + + cmd = tcss_make_conn_cmd( + PMC_IPC_TCSS_DISC_REQ_RES, + mux_data.usb3_port, + mux_data.usb2_port, + 0, 0, 0, 0); + + req.buf[0] = cmd; + + printk(BIOS_DEBUG, "port C%d DISC req: usage %d usb3 %d usb2 %d\n", + port, + GET_TCSS_CD_FIELD(USAGE, cmd), + GET_TCSS_CD_FIELD(USB3, cmd), + GET_TCSS_CD_FIELD(USB2, cmd)); + + return send_pmc_req(CONNECT_REQ, &req, res, PMC_IPC_DISC_REQ_SIZE); +} + static int send_pmc_connect_request(int port, struct tcss_mux mux_data, struct pmc_ipc_buffer *res) { @@ -241,6 +264,16 @@ return 0; }
+static void initialize_mux_to_disc_mode(int port, struct tcss_mux mux_data) +{ + struct pmc_ipc_buffer *rbuf = NULL; + int ret = 0; + + ret = send_pmc_disconnect_request(port, mux_data, rbuf); + if (ret) + printk(BIOS_ERR, "Failed to setup port:%d to inial state\n", port); +} + static void update_tcss_mux(int port, struct tcss_mux mux_data) { struct pmc_ipc_buffer *rbuf = NULL; @@ -268,7 +301,7 @@
static int system_requires_early_display(void) { - if (!CONFIG(VBOOT)) + if (!CONFIG(VBOOT) || !CONFIG(EARLY_TCSS_DISPLAY)) return 1; else if (vboot_recovery_mode_enabled() || vboot_developer_mode_enabled()) return 1; @@ -286,14 +319,28 @@ if (!system_requires_early_display()) return;
- mainboard_early_tcss_enable(mux_info, &num_ports); + num_ports = mainboard_tcss_get_port_info(mux_info); + + for (i = 0; i < num_ports; i++) + initialize_mux_to_disc_mode(i, mux_info[i]); + + /* If early display is not supported end with setting ports to disconnect */ + if (!system_requires_early_display()) + return; + + num_ports = mainboard_tcss_fill_mux_info(mux_info);
for (i = 0; i < num_ports; i++) update_tcss_mux(i, mux_info[i]);
}
-__weak void mainboard_early_tcss_enable(struct tcss_mux *mux_info, unsigned int *num_ports) +__weak unsigned int mainboard_tcss_fill_mux_info(struct tcss_mux *mux_info) { - /* to be overwritten by each mainboard that needs early tcss */ + /* to be overwritten by each mainboard that needs early tcss display */ +} + +__weak unsigned int mainboard_tcss_get_port_info(struct tcss_mux *mux_info) +{ + /* to be overwritten by each mainboard that needs tcss ports configured */ } diff --git a/src/soc/intel/tigerlake/fsp_params.c b/src/soc/intel/tigerlake/fsp_params.c index c5501b7..1d57002 100644 --- a/src/soc/intel/tigerlake/fsp_params.c +++ b/src/soc/intel/tigerlake/fsp_params.c @@ -462,7 +462,7 @@ /* TCSS specific initialization here */ printk(BIOS_DEBUG, "FSP MultiPhaseSiInit %s/%s called\n", __FILE__, __func__); - if (CONFIG(EARLY_TCSS_DISPLAY)) + if (CONFIG(EARLY_TCSS)) tcss_early_configure(); break; default: diff --git a/src/soc/intel/tigerlake/include/soc/early_tcss.h b/src/soc/intel/tigerlake/include/soc/early_tcss.h index cee4c12..0a0d957 100644 --- a/src/soc/intel/tigerlake/include/soc/early_tcss.h +++ b/src/soc/intel/tigerlake/include/soc/early_tcss.h @@ -5,10 +5,12 @@ #define PMC_IPC_USBC_SUBCMD_ID 0x0 #define PMC_IPC_CMD 0x0 #define PMC_IPC_TCSS_CONN_REQ_RES 0x0 +#define PMC_IPC_TCSS_DISC_REQ_RES 0x1 #define PMC_IPC_TCSS_SAFE_MODE_REQ_RES 0x2 #define PMC_IPC_TCSS_ALTMODE_REQ_RES 0x3 #define PMC_IPC_TCSS_HPD_REQ_RES 0x4 #define PMC_IPC_CONN_REQ_SIZE 2 +#define PMC_IPC_DISC_REQ_SIZE 2 #define PMC_IPC_ALT_REQ_SIZE 8 #define PMC_IPC_SAFE_REQ_SIZE 1 #define PMC_IPC_HPD_REQ_SIZE 2 @@ -138,4 +140,11 @@ * must be overridden by the mainboard with its specific mux data stored in a struct tcss_mux * struct as defined above. */ -void mainboard_early_tcss_enable(struct tcss_mux *mux_info, unsigned int *num_ports); +unsigned int mainboard_tcss_fill_mux_info(struct tcss_mux *mux_info); + +/* + * Weak mainboard method to get only the port information to initialize the muxes to + * disconnect mode during boot. + * returns total number of ports. + */ +unsigned int mainboard_tcss_get_port_info(struct tcss_mux *mux_info);