All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 RFT] usb: xhci: Add to check CRR bit in xhci_suspend()
@ 2015-05-14  9:39 Yoshihiro Shimoda
  2015-05-26 11:44 ` Mathias Nyman
  2015-06-03 10:14 ` Yoshihiro Shimoda
  0 siblings, 2 replies; 3+ messages in thread
From: Yoshihiro Shimoda @ 2015-05-14  9:39 UTC (permalink / raw)
  To: linux-sh

The STS_HALT is not set until the CRR (CMD_RING_RUNNING) is cleared
on specific xHCI controllers (e.g. R-Car SoCs) after this driver set
the R/S (CMD_RUN) to 0. So, to avoid using a quirks XHCI_SLOW_SUSPEND,
this patch adds to wait for the CRR to clear.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 My environment (R-Car H2) could work correctly. I would like to know
 that this patch causes side effect or not. Also I'd like to know
 this patch can avoid the XHCI_SLOW_SUSPEND quirk on other environment
 (Fresco Logic XHCI controller).

 Changes from v1:
  - Remove a abort code.
  - Wait for the CRR to clear after this driver set the R/S to 0.
  - Rebase on the usb.git / usb-next branch.
    (commit id = aa519be34f45954f33a6c20430deac8e544a180f)

 drivers/usb/host/xhci.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index ec8ac16..a357917 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -923,6 +923,15 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup)
 	command &= ~CMD_RUN;
 	writel(command, &xhci->op_regs->command);
 
+	/*
+	 * The STS_HALT is not set until the CRR is cleared on specific
+	 * xHCI controllers (e.g. R-Car SoCs) after this driver set the R/S
+	 * to 0. So, to avoid using a quirks XHCI_SLOW_SUSPEND, this driver
+	 * waits for the CRR to clear.
+	 */
+	xhci_handshake(&xhci->op_regs->cmd_ring, CMD_RING_RUNNING, 0,
+		       5 * 1000 * 1000);
+
 	/* Some chips from Fresco Logic need an extraordinary delay */
 	delay *= (xhci->quirks & XHCI_SLOW_SUSPEND) ? 10 : 1;
 
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-03 10:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-14  9:39 [PATCH v2 RFT] usb: xhci: Add to check CRR bit in xhci_suspend() Yoshihiro Shimoda
2015-05-26 11:44 ` Mathias Nyman
2015-06-03 10:14 ` Yoshihiro Shimoda

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.