]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.14/usb-hub-delay-hub-autosuspend-if-usb3-port-is-still-.patch
autosel patches for 4.14
[thirdparty/kernel/stable-queue.git] / queue-4.14 / usb-hub-delay-hub-autosuspend-if-usb3-port-is-still-.patch
1 From d73a84fd26bfb54138a6da599e17dbc05f66bfbd Mon Sep 17 00:00:00 2001
2 From: Mathias Nyman <mathias.nyman@linux.intel.com>
3 Date: Wed, 28 Nov 2018 15:55:21 +0200
4 Subject: usb: hub: delay hub autosuspend if USB3 port is still link training
5
6 [ Upstream commit e86108940e541febf35813402ff29fa6f4a9ac0b ]
7
8 When initializing a hub we want to give a USB3 port in link training
9 the same debounce delay time before autosuspening the hub as already
10 trained, connected enabled ports.
11
12 USB3 ports won't reach the enabled state with "current connect status" and
13 "connect status change" bits set until the USB3 link training finishes.
14
15 Catching the port in link training (polling) and adding the debounce delay
16 prevents unnecessary failed attempts to autosuspend the hub.
17
18 Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
19 Acked-by: Alan Stern <stern@rowland.harvard.edu>
20 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21 Signed-off-by: Sasha Levin <sashal@kernel.org>
22 ---
23 drivers/usb/core/hub.c | 10 ++++++++++
24 1 file changed, 10 insertions(+)
25
26 diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
27 index a073cb5be013..4a4e666a8e09 100644
28 --- a/drivers/usb/core/hub.c
29 +++ b/drivers/usb/core/hub.c
30 @@ -1110,6 +1110,16 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
31 USB_PORT_FEAT_ENABLE);
32 }
33
34 + /*
35 + * Add debounce if USB3 link is in polling/link training state.
36 + * Link will automatically transition to Enabled state after
37 + * link training completes.
38 + */
39 + if (hub_is_superspeed(hdev) &&
40 + ((portstatus & USB_PORT_STAT_LINK_STATE) ==
41 + USB_SS_PORT_LS_POLLING))
42 + need_debounce_delay = true;
43 +
44 /* Clear status-change flags; we'll debounce later */
45 if (portchange & USB_PORT_STAT_C_CONNECTION) {
46 need_debounce_delay = true;
47 --
48 2.19.1
49