Skip to contentSkip to conversation

Increase XHCI suspend timeout to 16ms

PATCH In review Michael Spang 2 participants 2 messages Sep 14, 2012 – Sep 17, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Increase XHCI suspend timeout to 16ms

The Intel XHCI specification says that after clearing the run/stop bit the controller may take up to 16ms to halt. We've seen a device take 14ms, which with the current timeout of 10ms causes the kernel to abort the suspend. Increasing the timeout to the recommended value fixes the problem.

---
 drivers/usb/host/xhci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/usb/host/xhci.c +1 -1
index c59d5b5..7710ccf 100644
@@ -785,7 +785,7 @@ int xhci_suspend(struct xhci_hcd *xhci)
 	command &= ~CMD_RUN;
 	xhci_writel(xhci, command, &xhci->op_regs->command);
 	if (handshake(xhci, &xhci->op_regs->status,
-		      STS_HALT, STS_HALT, 100*100)) {
+		      STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC)) {
 		xhci_warn(xhci, "WARN: xHC CMD_RUN timeout\n");
 		spin_unlock_irq(&xhci->lock);
 		return -ETIMEDOUT;
Signature · 1 line
1.7.7.3
#1 lore raw
Quoted 5 lines · Michael Spang

The Intel XHCI specification says that after clearing the run/stop bit the controller may take up to 16ms to halt. We've seen a device take 14ms, which with the current timeout of 10ms causes the kernel to abort the suspend. Increasing the timeout to the recommended value fixes the problem.

Thanks for tracking this down, Michael. I'll queue this to Greg in a couple days.

Quoted 22 lines
---
 drivers/usb/host/xhci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/usb/host/xhci.c +1 -1
index c59d5b5..7710ccf 100644
@@ -785,7 +785,7 @@ int xhci_suspend(struct xhci_hcd *xhci)
 	command &= ~CMD_RUN;
 	xhci_writel(xhci, command, &xhci->op_regs->command);
 	if (handshake(xhci, &xhci->op_regs->status,
-		      STS_HALT, STS_HALT, 100*100)) {
+		      STS_HALT, STS_HALT, XHCI_MAX_HALT_USEC)) {
 		xhci_warn(xhci, "WARN: xHC CMD_RUN timeout\n");
 		spin_unlock_irq(&xhci->lock);
 		return -ETIMEDOUT;
Signature · 1 line
1.7.7.3