diff options
author | Mika Westerberg <mika.westerberg@linux.intel.com> | 2020-04-02 11:42:44 +0200 |
---|---|---|
committer | Mika Westerberg <mika.westerberg@linux.intel.com> | 2020-09-03 11:06:41 +0200 |
commit | e28178bf566cf7281b513856aa71a8d41aa81154 (patch) | |
tree | a80cfb170eec85f5a2e26535d4b0e536f3cba0ec /drivers/thunderbolt/switch.c | |
parent | thunderbolt: Configure link after lane bonding is enabled (diff) | |
download | linux-e28178bf566cf7281b513856aa71a8d41aa81154.tar.xz linux-e28178bf566cf7281b513856aa71a8d41aa81154.zip |
thunderbolt: Set port configured for both ends of the link
Both ends of the link needs to have this set. Otherwise the link is not
re-established properly after sleep. Now since it is possible to have
mixed USB4 and Thunderbolt 1, 2 and 3 devices we need to split the link
configuration functionality to happen per port so we can pick the
correct implementation.
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/switch.c')
-rw-r--r-- | drivers/thunderbolt/switch.c | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c index 5d99d69107eb..50d2af5ba491 100644 --- a/drivers/thunderbolt/switch.c +++ b/drivers/thunderbolt/switch.c @@ -2320,12 +2320,24 @@ void tb_switch_lane_bonding_disable(struct tb_switch *sw) */ int tb_switch_configure_link(struct tb_switch *sw) { + struct tb_port *up, *down; + int ret; + if (!tb_route(sw) || tb_switch_is_icm(sw)) return 0; - if (tb_switch_is_usb4(sw)) - return usb4_switch_configure_link(sw); - return tb_lc_configure_link(sw); + up = tb_upstream_port(sw); + if (tb_switch_is_usb4(up->sw)) + ret = usb4_port_configure(up); + else + ret = tb_lc_configure_port(up); + if (ret) + return ret; + + down = up->remote; + if (tb_switch_is_usb4(down->sw)) + return usb4_port_configure(down); + return tb_lc_configure_port(down); } /** @@ -2337,15 +2349,24 @@ int tb_switch_configure_link(struct tb_switch *sw) */ void tb_switch_unconfigure_link(struct tb_switch *sw) { + struct tb_port *up, *down; + if (sw->is_unplugged) return; if (!tb_route(sw) || tb_switch_is_icm(sw)) return; - if (tb_switch_is_usb4(sw)) - usb4_switch_unconfigure_link(sw); + up = tb_upstream_port(sw); + if (tb_switch_is_usb4(up->sw)) + usb4_port_unconfigure(up); + else + tb_lc_unconfigure_port(up); + + down = up->remote; + if (tb_switch_is_usb4(down->sw)) + usb4_port_unconfigure(down); else - tb_lc_unconfigure_link(sw); + tb_lc_unconfigure_port(down); } /** |