Commit d589fd42 authored by Mika Westerberg's avatar Mika Westerberg

thunderbolt: Check Intel vendor ID in tb_switch_get_generation()

Only Intel made Thunderbolt 1-3 devices so to avoid possible confusion
check for the Intel vendor ID before deciding the device generation.
While there move the USB4 check to happen first.
Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
parent 408e1d96
...@@ -2188,6 +2188,10 @@ struct device_type tb_switch_type = { ...@@ -2188,6 +2188,10 @@ struct device_type tb_switch_type = {
static int tb_switch_get_generation(struct tb_switch *sw) static int tb_switch_get_generation(struct tb_switch *sw)
{ {
if (tb_switch_is_usb4(sw))
return 4;
if (sw->config.vendor_id == PCI_VENDOR_ID_INTEL) {
switch (sw->config.device_id) { switch (sw->config.device_id) {
case PCI_DEVICE_ID_INTEL_LIGHT_RIDGE: case PCI_DEVICE_ID_INTEL_LIGHT_RIDGE:
case PCI_DEVICE_ID_INTEL_EAGLE_RIDGE: case PCI_DEVICE_ID_INTEL_EAGLE_RIDGE:
...@@ -2215,19 +2219,16 @@ static int tb_switch_get_generation(struct tb_switch *sw) ...@@ -2215,19 +2219,16 @@ static int tb_switch_get_generation(struct tb_switch *sw)
case PCI_DEVICE_ID_INTEL_ICL_NHI0: case PCI_DEVICE_ID_INTEL_ICL_NHI0:
case PCI_DEVICE_ID_INTEL_ICL_NHI1: case PCI_DEVICE_ID_INTEL_ICL_NHI1:
return 3; return 3;
}
default: }
if (tb_switch_is_usb4(sw))
return 4;
/* /*
* For unknown switches assume generation to be 1 to be * For unknown switches assume generation to be 1 to be on the
* on the safe side. * safe side.
*/ */
tb_sw_warn(sw, "unsupported switch device id %#x\n", tb_sw_warn(sw, "unsupported switch device id %#x\n",
sw->config.device_id); sw->config.device_id);
return 1; return 1;
}
} }
static bool tb_switch_exceeds_max_depth(const struct tb_switch *sw, int depth) static bool tb_switch_exceeds_max_depth(const struct tb_switch *sw, int depth)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment