Linux-USB Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] usb: host: xhci-rcar: Fix timeout in xhci_suspend()
@ 2019-08-02  8:33 Yoshihiro Shimoda
  2019-08-09 17:20 ` Simon Horman
  0 siblings, 1 reply; 2+ messages in thread
From: Yoshihiro Shimoda @ 2019-08-02  8:33 UTC (permalink / raw)
  To: gregkh, mathias.nyman
  Cc: linux-usb, linux-renesas-soc, stable, Yoshihiro Shimoda

When a USB device is connected to the host controller and
the system enters suspend, the following error happens
in xhci_suspend():

	xhci-hcd ee000000.usb: WARN: xHC CMD_RUN timeout

Since the firmware/internal CPU control the USBSTS.STS_HALT
and the process speed is down when the roothub port enters U3,
long delay for the handshake of STS_HALT is neeed in xhci_suspend().
So, this patch adds to set the XHCI_SLOW_SUSPEND.

Fixes: 435cc1138ec9 ("usb: host: xhci-plat: set resume_quirk() for R-Car controllers")
Cc: <stable@vger.kernel.org> # v4.12+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/host/xhci-rcar.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c
index 671bce1..8616c52 100644
--- a/drivers/usb/host/xhci-rcar.c
+++ b/drivers/usb/host/xhci-rcar.c
@@ -238,10 +238,15 @@ int xhci_rcar_init_quirk(struct usb_hcd *hcd)
 	 * pointers. So, this driver clears the AC64 bit of xhci->hcc_params
 	 * to call dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in
 	 * xhci_gen_setup().
+	 *
+	 * And, since the firmware/internal CPU control the USBSTS.STS_HALT
+	 * and the process speed is down when the roothub port enters U3,
+	 * long delay for the handshake of STS_HALT is neeed in xhci_suspend().
 	 */
 	if (xhci_rcar_is_gen2(hcd->self.controller) ||
-			xhci_rcar_is_gen3(hcd->self.controller))
-		xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
+			xhci_rcar_is_gen3(hcd->self.controller)) {
+		xhci->quirks |= XHCI_NO_64BIT_SUPPORT | XHCI_SLOW_SUSPEND;
+	}
 
 	if (!xhci_rcar_wait_for_pll_active(hcd))
 		return -ETIMEDOUT;
-- 
2.7.4


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

* Re: [PATCH] usb: host: xhci-rcar: Fix timeout in xhci_suspend()
  2019-08-02  8:33 [PATCH] usb: host: xhci-rcar: Fix timeout in xhci_suspend() Yoshihiro Shimoda
@ 2019-08-09 17:20 ` Simon Horman
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Horman @ 2019-08-09 17:20 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: gregkh, mathias.nyman, linux-usb, linux-renesas-soc, stable

On Fri, Aug 02, 2019 at 05:33:35PM +0900, Yoshihiro Shimoda wrote:
> When a USB device is connected to the host controller and
> the system enters suspend, the following error happens
> in xhci_suspend():
> 
> 	xhci-hcd ee000000.usb: WARN: xHC CMD_RUN timeout
> 
> Since the firmware/internal CPU control the USBSTS.STS_HALT
> and the process speed is down when the roothub port enters U3,
> long delay for the handshake of STS_HALT is neeed in xhci_suspend().
> So, this patch adds to set the XHCI_SLOW_SUSPEND.
> 
> Fixes: 435cc1138ec9 ("usb: host: xhci-plat: set resume_quirk() for R-Car controllers")
> Cc: <stable@vger.kernel.org> # v4.12+
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>

Reviewed-by: Simon Horman <horms+renesas@verge.net.au>

> ---
>  drivers/usb/host/xhci-rcar.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/host/xhci-rcar.c b/drivers/usb/host/xhci-rcar.c
> index 671bce1..8616c52 100644
> --- a/drivers/usb/host/xhci-rcar.c
> +++ b/drivers/usb/host/xhci-rcar.c
> @@ -238,10 +238,15 @@ int xhci_rcar_init_quirk(struct usb_hcd *hcd)
>  	 * pointers. So, this driver clears the AC64 bit of xhci->hcc_params
>  	 * to call dma_set_coherent_mask(dev, DMA_BIT_MASK(32)) in
>  	 * xhci_gen_setup().
> +	 *
> +	 * And, since the firmware/internal CPU control the USBSTS.STS_HALT
> +	 * and the process speed is down when the roothub port enters U3,
> +	 * long delay for the handshake of STS_HALT is neeed in xhci_suspend().
>  	 */
>  	if (xhci_rcar_is_gen2(hcd->self.controller) ||
> -			xhci_rcar_is_gen3(hcd->self.controller))
> -		xhci->quirks |= XHCI_NO_64BIT_SUPPORT;
> +			xhci_rcar_is_gen3(hcd->self.controller)) {
> +		xhci->quirks |= XHCI_NO_64BIT_SUPPORT | XHCI_SLOW_SUSPEND;
> +	}


nit: As there is still only one line guarded by the conditional I don't
think that { } need to be added.

>  
>  	if (!xhci_rcar_wait_for_pll_active(hcd))
>  		return -ETIMEDOUT;
> -- 
> 2.7.4
> 

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

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-08-02  8:33 [PATCH] usb: host: xhci-rcar: Fix timeout in xhci_suspend() Yoshihiro Shimoda
2019-08-09 17:20 ` Simon Horman

Linux-USB Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-usb/0 linux-usb/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-usb linux-usb/ https://lore.kernel.org/linux-usb \
		linux-usb@vger.kernel.org linux-usb@archiver.kernel.org
	public-inbox-index linux-usb


Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-usb


AGPL code for this site: git clone https://public-inbox.org/ public-inbox