aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMathias Nyman <mathias.nyman@linux.intel.com>2020-04-21 17:08:21 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-29 16:31:34 +0200
commitd3ee95dedd88ed3fcd4647e4a8e265acaf27b2f0 (patch)
tree2a2ba00dcfa09f547395206ddd9f9756f154ff79
parentb0a0ebfed4b2b218f7b1d357fba8a0942c14b333 (diff)
downloadlinux-yocto-d3ee95dedd88ed3fcd4647e4a8e265acaf27b2f0.tar.gz
linux-yocto-d3ee95dedd88ed3fcd4647e4a8e265acaf27b2f0.tar.bz2
linux-yocto-d3ee95dedd88ed3fcd4647e4a8e265acaf27b2f0.zip
xhci: prevent bus suspend if a roothub port detected a over-current condition
commit e9fb08d617bfae5471d902112667d0eeb9dee3c4 upstream. Suspending the bus and host controller while a port is in a over-current condition may halt the host. Also keep the roothub running if over-current is active. Cc: <stable@vger.kernel.org> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Link: https://lore.kernel.org/r/20200421140822.28233-3-mathias.nyman@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/usb/host/xhci-hub.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index eb4284696f25..a58ef53e4ae1 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -1481,6 +1481,8 @@ int xhci_hub_status_data(struct usb_hcd *hcd, char *buf)
}
if ((temp & PORT_RC))
reset_change = true;
+ if (temp & PORT_OC)
+ status = 1;
}
if (!status && !reset_change) {
xhci_dbg(xhci, "%s: stopping port polling.\n", __func__);
@@ -1546,6 +1548,13 @@ retry:
port_index);
goto retry;
}
+ /* bail out if port detected a over-current condition */
+ if (t1 & PORT_OC) {
+ bus_state->bus_suspended = 0;
+ spin_unlock_irqrestore(&xhci->lock, flags);
+ xhci_dbg(xhci, "Bus suspend bailout, port over-current detected\n");
+ return -EBUSY;
+ }
/* suspend ports in U0, or bail out for new connect changes */
if ((t1 & PORT_PE) && (t1 & PORT_PLS_MASK) == XDEV_U0) {
if ((t1 & PORT_CSC) && wake_enabled) {