Skip to contentSkip to conversation

usb: xhci: increase CRS timeout value

PATCH New Mathias Nyman 1 participant 1 message Jun 21, 2018

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

PATCH 5/5 usb: xhci: increase CRS timeout value

From: Ajay Gupta <[email protected]>

Some controllers take almost 55ms to complete controller restore state (CRS).
There is no timeout limit mentioned in xhci specification so fixing the issue by increasing the timeout limit to 100ms

[reformat code comment -Mathias]
---
 drivers/usb/host/xhci.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/host/xhci.c +6 -1
index f11ec61..2f4850f 100644
@@ -1078,8 +1078,13 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated)
 		command = readl(&xhci->op_regs->command);
 		command |= CMD_CRS;
 		writel(command, &xhci->op_regs->command);
+		/*
+		 * Some controllers take up to 55+ ms to complete the controller
+		 * restore so setting the timeout to 100ms. Xhci specification
+		 * doesn't mention any timeout value.
+		 */
 		if (xhci_handshake(&xhci->op_regs->status,
-			      STS_RESTORE, 0, 10 * 1000)) {
+			      STS_RESTORE, 0, 100 * 1000)) {
 			xhci_warn(xhci, "WARN: xHC restore state timeout\n");
 			spin_unlock_irq(&xhci->lock);
 			return -ETIMEDOUT;