blob: 9dcb6c3bb51a8b099f5a743ee43ea07e4288d00f [file] [log] [blame]
Joel Stanleyc1c704a2016-03-17 19:42:06 +10301From 797d3fde5250abb4dedf00536282b8f93e4b66fe Mon Sep 17 00:00:00 2001
Joel Stanleyd9669fe2016-01-22 16:13:06 +10302From: Joel Stanley <joel@jms.id.au>
3Date: Thu, 28 Jan 2016 13:07:06 +1030
Joel Stanley11548952016-03-03 11:41:59 +10304Subject: [PATCH 2/7] Revert "usb: xhci: stop everything on the first call to
Joel Stanleyd9669fe2016-01-22 16:13:06 +10305 xhci_stop"
6
7This reverts commit 8c24d6d7b09deee3036ddc4f2b81b53b28c8f877.
8
9With this patch, the driver stops everything at the first call to
10xhci_stop, which is always for the secondary HCD when executing the
11.remove handler. We instead want to only stop when the primray HCD is
12shutting down.
13
14Signed-off-by: Joel Stanley <joel@jms.id.au>
15---
16 drivers/usb/host/xhci.c | 20 +++++++++++++++-----
17 1 file changed, 15 insertions(+), 5 deletions(-)
18
19diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
Joel Stanley11548952016-03-03 11:41:59 +103020index 776d59c32bc5..cef80e930db9 100644
Joel Stanleyd9669fe2016-01-22 16:13:06 +103021--- a/drivers/usb/host/xhci.c
22+++ b/drivers/usb/host/xhci.c
23@@ -665,6 +665,15 @@ int xhci_run(struct usb_hcd *hcd)
24 }
25 EXPORT_SYMBOL_GPL(xhci_run);
26
27+static void xhci_only_stop_hcd(struct usb_hcd *hcd)
28+{
29+ struct xhci_hcd *xhci = hcd_to_xhci(hcd);
30+
31+ spin_lock_irq(&xhci->lock);
32+ xhci_halt(xhci);
33+ spin_unlock_irq(&xhci->lock);
34+}
35+
36 /*
37 * Stop xHCI driver.
38 *
39@@ -679,14 +688,15 @@ void xhci_stop(struct usb_hcd *hcd)
40 u32 temp;
41 struct xhci_hcd *xhci = hcd_to_xhci(hcd);
42
43- if (xhci->xhc_state & XHCI_STATE_HALTED)
44+ mutex_lock(&xhci->mutex);
45+
46+ if (!usb_hcd_is_primary_hcd(hcd)) {
47+ xhci_only_stop_hcd(xhci->shared_hcd);
48+ mutex_unlock(&xhci->mutex);
49 return;
50+ }
51
52- mutex_lock(&xhci->mutex);
53 spin_lock_irq(&xhci->lock);
54- xhci->xhc_state |= XHCI_STATE_HALTED;
55- xhci->cmd_ring_state = CMD_RING_STATE_STOPPED;
56-
57 /* Make sure the xHC is halted for a USB3 roothub
58 * (xhci_stop() could be called as part of failed init).
59 */
60--
Joel Stanleyc1c704a2016-03-17 19:42:06 +1030612.7.3
Joel Stanleyd9669fe2016-01-22 16:13:06 +103062