From: Andiry Xu <andiry...@amd.com>

When system software decides to power down the xHC with the intent of
resuming operation at a later time, it will ask xHC to save the internal
state and restore it when resume to correctly recover from a power event.
Two bits are used to enable this operation: Save State and Restore State.

xHCI spec 4.23.2 says software should "Set the Controller Save State(CSS)
flag in the USBCMD register and wait for the Save State Status(SSS) flag
in the USBSTS register to transition to '0'". However, it does not define
how long software should wait for the SSS bit to transition to 0.

Currently the timeout is set to 1ms. There is bug report
(https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1002697)
indicates that the timeout is too short for ASMedia ASM1042 host controller
to save the state successfully. Increase the timeout to 10ms helps to
resolve the issue.

Signed-off-by: Andiry Xu <andiry...@gmail.com>
Cc: Ming Lei <ming....@canonical.com>
Cc: <stable@vger.kernel.org>
---
 drivers/usb/host/xhci.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index afdc73e..8d446af 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -795,7 +795,7 @@ int xhci_suspend(struct xhci_hcd *xhci)
        command = xhci_readl(xhci, &xhci->op_regs->command);
        command |= CMD_CSS;
        xhci_writel(xhci, command, &xhci->op_regs->command);
-       if (handshake(xhci, &xhci->op_regs->status, STS_SAVE, 0, 10*100)) {
+       if (handshake(xhci, &xhci->op_regs->status, STS_SAVE, 0, 10 * 1000)) {
                xhci_warn(xhci, "WARN: xHC CMD_CSS timeout\n");
                spin_unlock_irq(&xhci->lock);
                return -ETIMEDOUT;
-- 
1.7.4.1


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

Reply via email to