thunderbolt: Add downstream PCIe port mappings for Alpine and Titan Ridge
authorMika Westerberg <mika.westerberg@linux.intel.com>
Fri, 22 Mar 2019 13:16:53 +0000 (15:16 +0200)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Sat, 2 Nov 2019 09:13:31 +0000 (12:13 +0300)
In order to keep PCIe hierarchies consistent across hotplugs, add
hard-coded PCIe downstream port to Thunderbolt port for Alpine Ridge and
Titan Ridge as well.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/thunderbolt/tb.c
drivers/thunderbolt/tb.h

index e8e2d20cf4c64173ed63c4021c00889e2e84d1b8..c24b577e049e2022499aee976fc911510bfe5de0 100644 (file)
@@ -342,10 +342,13 @@ static struct tb_port *tb_find_pcie_down(struct tb_switch *sw,
                 * Hard-coded Thunderbolt port to PCIe down port mapping
                 * per controller.
                 */
-               if (tb_switch_is_cactus_ridge(sw))
+               if (tb_switch_is_cactus_ridge(sw) ||
+                   tb_switch_is_alpine_ridge(sw))
                        index = !phy_port ? 6 : 7;
                else if (tb_switch_is_falcon_ridge(sw))
                        index = !phy_port ? 6 : 8;
+               else if (tb_switch_is_titan_ridge(sw))
+                       index = !phy_port ? 8 : 9;
                else
                        goto out;
 
index a6f1fa0d4771f96f49f591b9db83a2c2094f1fe7..3d7b2202d2487d8cb8d94f26de8a38099f76796e 100644 (file)
@@ -608,6 +608,31 @@ static inline bool tb_switch_is_falcon_ridge(const struct tb_switch *sw)
        }
 }
 
+static inline bool tb_switch_is_alpine_ridge(const struct tb_switch *sw)
+{
+       switch (sw->config.device_id) {
+       case PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_2C_BRIDGE:
+       case PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_LP_BRIDGE:
+       case PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_4C_BRIDGE:
+       case PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_BRIDGE:
+               return true;
+       default:
+               return false;
+       }
+}
+
+static inline bool tb_switch_is_titan_ridge(const struct tb_switch *sw)
+{
+       switch (sw->config.device_id) {
+       case PCI_DEVICE_ID_INTEL_TITAN_RIDGE_2C_BRIDGE:
+       case PCI_DEVICE_ID_INTEL_TITAN_RIDGE_4C_BRIDGE:
+       case PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_BRIDGE:
+               return true;
+       default:
+               return false;
+       }
+}
+
 /**
  * tb_switch_is_icm() - Is the switch handled by ICM firmware
  * @sw: Switch to check