summaryrefslogtreecommitdiff
path: root/src/soc/intel/common
diff options
context:
space:
mode:
authorDeepti Deshatty <deepti.deshatty@intel.com>2021-05-20 21:01:52 +0530
committerPatrick Georgi <pgeorgi@google.com>2021-06-04 12:36:07 +0000
commitc146daf8a3241026c8c8906add2b5ae37cc76427 (patch)
treedea56397963aa97bc0db20d8339528ec353ae0ae /src/soc/intel/common
parent7014efd8cfb1c496354cc991bbb9443e882d5d82 (diff)
intel/common/block: Move mainboard api to tcss common block
As per the comments in CB:54090 mainboard api mainboard_tcss_get_port_info() is simplified and moved to tcss common block code. Signed-off-by: Deepti Deshatty <deepti.deshatty@intel.com> Change-Id: I7894363df4862f7cfe733d93e6160677fb8a9e31 Reviewed-on: https://review.coreboot.org/c/coreboot/+/54733 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: EricR Lai <ericr_lai@compal.corp-partner.google.com>
Diffstat (limited to 'src/soc/intel/common')
-rw-r--r--src/soc/intel/common/block/include/intelblocks/tcss.h4
-rw-r--r--src/soc/intel/common/block/tcss/tcss.c34
2 files changed, 35 insertions, 3 deletions
diff --git a/src/soc/intel/common/block/include/intelblocks/tcss.h b/src/soc/intel/common/block/include/intelblocks/tcss.h
index 29093d1664..9595a78e00 100644
--- a/src/soc/intel/common/block/include/intelblocks/tcss.h
+++ b/src/soc/intel/common/block/include/intelblocks/tcss.h
@@ -161,10 +161,10 @@ void tcss_configure(const struct typec_aux_bias_pads pads[MAX_TYPE_C_PORTS]);
const struct tcss_mux_info *mainboard_tcss_get_mux_info(int port);
/*
- * Mainboard method to get only the port information to initialize the muxes to
+ * Method to get only the port information to initialize the muxes to
* disconnect mode during boot.
* returns tscc_port_map of all ports on system
*/
-const struct tcss_port_map *mainboard_tcss_get_port_info(size_t *num_ports);
+const struct tcss_port_map *tcss_get_port_info(size_t *num_ports);
#endif /* _TCSS_H_ */
diff --git a/src/soc/intel/common/block/tcss/tcss.c b/src/soc/intel/common/block/tcss/tcss.c
index da19954b10..28564e34cc 100644
--- a/src/soc/intel/common/block/tcss/tcss.c
+++ b/src/soc/intel/common/block/tcss/tcss.c
@@ -12,6 +12,7 @@
#include <soc/pcr_ids.h>
#include <soc/tcss.h>
#include <stdlib.h>
+#include <drivers/intel/pmc_mux/conn/chip.h>
#define BIAS_CTRL_VW_INDEX_SHIFT 16
#define BIAS_CTRL_BIT_POS_SHIFT 8
@@ -338,13 +339,44 @@ static void tcss_configure_aux_bias_pads(
}
}
+const struct tcss_port_map *tcss_get_port_info(size_t *num_ports)
+{
+ static struct tcss_port_map port_map[MAX_TYPE_C_PORTS];
+ size_t active_ports = 0;
+ size_t port;
+
+ for (port = 0; port < MAX_TYPE_C_PORTS; port++) {
+ const struct device_path conn_path[] = {
+ {.type = DEVICE_PATH_PCI, .pci.devfn = PCH_DEVFN_PMC},
+ {.type = DEVICE_PATH_GENERIC, .generic.id = 0, .generic.subid = 0},
+ {.type = DEVICE_PATH_GENERIC, .generic.id = port},
+ };
+ const struct device *conn = find_dev_nested_path(pci_root_bus(), conn_path,
+ ARRAY_SIZE(conn_path));
+ unsigned int usb2_port, usb3_port;
+
+ if (!conn)
+ continue;
+
+ if (CONFIG(DRIVERS_INTEL_PMC) &&
+ intel_pmc_mux_conn_get_ports(conn, &usb2_port, &usb3_port)) {
+ port_map[active_ports].usb2_port = usb2_port;
+ port_map[active_ports].usb3_port = usb3_port;
+ ++active_ports;
+ }
+ }
+
+ *num_ports = active_ports;
+ return port_map;
+}
+
void tcss_configure(const struct typec_aux_bias_pads aux_bias_pads[MAX_TYPE_C_PORTS])
{
const struct tcss_port_map *port_map;
size_t num_ports;
size_t i;
- port_map = mainboard_tcss_get_port_info(&num_ports);
+ port_map = tcss_get_port_info(&num_ports);
if (port_map == NULL)
return;