Skip to content

Commit c38fa07

Browse files
Gil Finewesteri
authored andcommitted
thunderbolt: Fix wake configurations after device unplug
Currently we don't configure correctly the wake events after unplug of device router. What can happen is that the downstream ports of host router will be configured to wake on: USB4-wake and wake-on-disconnect, but not on wake-on-connect. This may cause the later plugged device not to wake the domain and fail in enumeration. Fix this by clearing downstream port's "USB4 Port is Configured" bit, after unplug of a device router. Signed-off-by: Gil Fine <gil.fine@linux.intel.com> Cc: stable@vger.kernel.org Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
1 parent c032cdd commit c38fa07

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

drivers/thunderbolt/switch.c

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3180,22 +3180,29 @@ void tb_switch_unconfigure_link(struct tb_switch *sw)
31803180
{
31813181
struct tb_port *up, *down;
31823182

3183-
if (sw->is_unplugged)
3184-
return;
31853183
if (!tb_route(sw) || tb_switch_is_icm(sw))
31863184
return;
31873185

3186+
/*
3187+
* Unconfigure downstream port so that wake-on-connect can be
3188+
* configured after router unplug. No need to unconfigure upstream port
3189+
* since its router is unplugged.
3190+
*/
31883191
up = tb_upstream_port(sw);
3189-
if (tb_switch_is_usb4(up->sw))
3190-
usb4_port_unconfigure(up);
3191-
else
3192-
tb_lc_unconfigure_port(up);
3193-
31943192
down = up->remote;
31953193
if (tb_switch_is_usb4(down->sw))
31963194
usb4_port_unconfigure(down);
31973195
else
31983196
tb_lc_unconfigure_port(down);
3197+
3198+
if (sw->is_unplugged)
3199+
return;
3200+
3201+
up = tb_upstream_port(sw);
3202+
if (tb_switch_is_usb4(up->sw))
3203+
usb4_port_unconfigure(up);
3204+
else
3205+
tb_lc_unconfigure_port(up);
31993206
}
32003207

32013208
static void tb_switch_credits_init(struct tb_switch *sw)

0 commit comments

Comments
 (0)