Re: [PATCH] xHCI: Increase the timeout for controller save state operation

2012-06-06 Thread Takashi Iwai
At Mon, 4 Jun 2012 16:39:38 +0800,
Andiry Xu wrote:
 
 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, 100*100)) {

IMO, 10 * 1000 is clearer as a representation of 10 ms.
(I guess 10 * 100 was a typo?)


Takashi
--
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


RE: [PATCH] xHCI: Increase the timeout for controller save state operation

2012-06-06 Thread Xu, Andiry
 -Original Message-
 From: Takashi Iwai [mailto:ti...@suse.de]
 Sent: Wednesday, June 06, 2012 4:00 PM
 To: Xu, Andiry
 Cc: Sarah Sharp; Linux USB; Andiry Xu; Ming Lei; stable@vger.kernel.org
 Subject: Re: [PATCH] xHCI: Increase the timeout for controller save state
 operation
 
 At Mon, 4 Jun 2012 16:39:38 +0800,
 Andiry Xu wrote:
 
  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, 100*100)) {
 
 IMO, 10 * 1000 is clearer as a representation of 10 ms.
 (I guess 10 * 100 was a typo?)
 

OK. I don't remember why I didn't simply use 1000 in the first place.
Will submit a V2 patch later.

Thanks,
Andiry


--
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


[PATCH] xHCI: Increase the timeout for controller save state operation

2012-06-04 Thread Andiry Xu
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, 100*100)) {
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