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>
diff --git a/src/drivers/intel/pmc_mux/conn/chip.h b/src/drivers/intel/pmc_mux/conn/chip.h
index 8497350..461916e 100644
--- a/src/drivers/intel/pmc_mux/conn/chip.h
+++ b/src/drivers/intel/pmc_mux/conn/chip.h
@@ -23,4 +23,12 @@
enum typec_orientation hsl_orientation;
};
+/*
+ * Method verifies input "conn" device.
+ * Returns 'true' if device passed is Intel PMC MUX Conn device else returns 'false'.
+ * Method also outputs the usb2 and usb3 port numbers associated with the 'conn' device
+ */
+bool intel_pmc_mux_conn_get_ports(const struct device *conn, unsigned int *usb2_port,
+ unsigned int *usb3_port);
+
#endif /* __DRIVERS_INTEL_PMC_MUX_CONN_H__ */
diff --git a/src/drivers/intel/pmc_mux/conn/conn.c b/src/drivers/intel/pmc_mux/conn/conn.c
index 9fd8543..b6bf371 100644
--- a/src/drivers/intel/pmc_mux/conn/conn.c
+++ b/src/drivers/intel/pmc_mux/conn/conn.c
@@ -85,3 +85,18 @@
CHIP_NAME("Intel PMC MUX CONN Driver")
.enable_dev = conn_enable,
};
+
+bool intel_pmc_mux_conn_get_ports(const struct device *conn, unsigned int *usb2_port,
+ unsigned int *usb3_port)
+{
+ const struct drivers_intel_pmc_mux_conn_config *mux_config;
+
+ if (!conn->chip_info || conn->chip_ops != &drivers_intel_pmc_mux_conn_ops)
+ return false;
+
+ mux_config = conn->chip_info;
+ *usb2_port = mux_config->usb2_port_number;
+ *usb3_port = mux_config->usb3_port_number;
+
+ return true;
+};