[RFT] xhci: Increase reset timeout for renesas 720201 host.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The NEC/Renesas 720201 xHCI host controller does not complete its reset
within 250 milliseconds.  Let's increase the timeout to 10 seconds and
use the new debugging in handshake to see how long the host controller
actually needs.

Signed-off-by: Sarah Sharp <sarah.a.sharp@xxxxxxxxxxxxxxx>
Reported-by: e.kleinmentink@xxxxxxxxx
---
 drivers/usb/host/xhci.c |   17 +++++++++++++----
 1 files changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 7648b2d..4b1bec4 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -61,8 +61,11 @@ static int handshake(struct xhci_hcd *xhci, void __iomem *ptr,
 		if (result == ~(u32)0)		/* card removed */
 			return -ENODEV;
 		result &= mask;
-		if (result == done)
+		if (result == done) {
+			xhci_dbg(xhci, "%s done after %u microseconds.\n",
+					__func__, usec);
 			return 0;
+		}
 		udelay(1);
 		usec--;
 	} while (usec > 0);
@@ -152,7 +155,7 @@ int xhci_reset(struct xhci_hcd *xhci)
 {
 	u32 command;
 	u32 state;
-	int ret, i;
+	int ret, i, usec;
 
 	state = xhci_readl(xhci, &xhci->op_regs->status);
 	if ((state & STS_HALT) == 0) {
@@ -166,7 +169,7 @@ int xhci_reset(struct xhci_hcd *xhci)
 	xhci_writel(xhci, command, &xhci->op_regs->command);
 
 	ret = handshake(xhci, &xhci->op_regs->command,
-			CMD_RESET, 0, 250 * 1000);
+			CMD_RESET, 0, 10 * 1000 * 1000);
 	if (ret)
 		return ret;
 
@@ -175,7 +178,13 @@ int xhci_reset(struct xhci_hcd *xhci)
 	 * xHCI cannot write to any doorbells or operational registers other
 	 * than status until the "Controller Not Ready" flag is cleared.
 	 */
-	ret = handshake(xhci, &xhci->op_regs->status, STS_CNR, 0, 250 * 1000);
+	usec = 1000 * 1000;
+	ret = handshake(xhci, &xhci->op_regs->status, STS_CNR, 0, usec);
+	if (ret) {
+		xhci_dbg(xhci, "Host not ready after %u microseconds.\n",
+				usec);
+		return ret;
+	}
 
 	for (i = 0; i < 2; ++i) {
 		xhci->bus_state[i].port_c_suspend = 0;
-- 
1.7.9

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux