summaryrefslogtreecommitdiff
path: root/src/drivers/intel
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/intel')
-rw-r--r--src/drivers/intel/pmc_mux/conn/chip.h8
-rw-r--r--src/drivers/intel/pmc_mux/conn/conn.c17
2 files changed, 15 insertions, 10 deletions
diff --git a/src/drivers/intel/pmc_mux/conn/chip.h b/src/drivers/intel/pmc_mux/conn/chip.h
index 96347ae4a0..08a08e184d 100644
--- a/src/drivers/intel/pmc_mux/conn/chip.h
+++ b/src/drivers/intel/pmc_mux/conn/chip.h
@@ -6,10 +6,10 @@
#include <boot/coreboot_tables.h>
struct drivers_intel_pmc_mux_conn_config {
- /* 1-based port numbers (from SoC point of view) */
- int usb2_port_number;
- /* 1-based port numbers (from SoC point of view) */
- int usb3_port_number;
+ /* A pointer to the SoC's USB-2 device */
+ DEVTREE_CONST struct device *usb2_port;
+ /* A pointer to the SoC's USB-3 device */
+ DEVTREE_CONST struct device *usb3_port;
/* Orientation of the sideband signals (SBU) */
enum type_c_orientation sbu_orientation;
/* Orientation of the High Speed lines */
diff --git a/src/drivers/intel/pmc_mux/conn/conn.c b/src/drivers/intel/pmc_mux/conn/conn.c
index caff166392..f238397245 100644
--- a/src/drivers/intel/pmc_mux/conn/conn.c
+++ b/src/drivers/intel/pmc_mux/conn/conn.c
@@ -16,6 +16,11 @@ static void conn_init(struct device *dev)
total_conn_count++;
}
+static unsigned int get_usb_port_number(const struct device *usb_port)
+{
+ return usb_port->path.usb.port_id + 1;
+}
+
static struct type_c_info *conn_get_cbmem_buffer(void)
{
struct type_c_info *info;
@@ -57,8 +62,8 @@ static void conn_write_cbmem_entry(struct device *dev)
count = info->port_count;
port_info = &info->port_info[count];
- port_info->usb2_port_number = config->usb2_port_number;
- port_info->usb3_port_number = config->usb3_port_number;
+ port_info->usb2_port_number = get_usb_port_number(config->usb2_port);
+ port_info->usb3_port_number = get_usb_port_number(config->usb3_port);
port_info->sbu_orientation = config->sbu_orientation;
port_info->data_orientation = config->hsl_orientation;
@@ -109,8 +114,8 @@ static void conn_fill_ssdt(const struct device *dev)
/* _DSD, Device-Specific Data */
dsd = acpi_dp_new_table("_DSD");
- acpi_dp_add_integer(dsd, "usb2-port-number", config->usb2_port_number);
- acpi_dp_add_integer(dsd, "usb3-port-number", config->usb3_port_number);
+ acpi_dp_add_integer(dsd, "usb2-port-number", get_usb_port_number(config->usb2_port));
+ acpi_dp_add_integer(dsd, "usb3-port-number", get_usb_port_number(config->usb3_port));
/*
* The kernel assumes that these Type-C signals (SBUs and HSLs) follow the CC lines,
@@ -161,8 +166,8 @@ bool intel_pmc_mux_conn_get_ports(const struct device *conn, unsigned int *usb2_
return false;
mux_config = conn->chip_info;
- *usb2_port = mux_config->usb2_port_number;
- *usb3_port = mux_config->usb3_port_number;
+ *usb2_port = get_usb_port_number(mux_config->usb2_port);
+ *usb3_port = get_usb_port_number(mux_config->usb3_port);
return true;
};