Re: [GIT PULL] USB resume timeout rework for v4.1

From: GrÃgory Herrero
Date: Thu Apr 09 2015 - 06:17:21 EST


Hi Felipe,

Following patch: usb: dwc2: hcd: use new USB_RESUME_TIMEOUT is not correct.
The delay is currently done before the controller drives the resume timeout.
Attached patch fix this issue.

2015-04-07 22:49 GMT+00:00 Felipe Balbi <balbi@xxxxxx>:
> Hi Greg,
>
> As promised, here's a pull request with only the resume timeout
> patches. I've rebased and retested them with my available platforms.
>
> Let me know if you want anything to be changed.
>
> cheers
>
> The following changes since commit 3e457371f436e89ce9239674828f9729a36b2595:
>
> usb: musb: Fix fifo reads for dm816x with musb_dsps (2015-03-24 11:36:38 -0500)
>
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/balbi/usb.git tags/usb-for-v4.1-part2
>
> for you to fetch changes up to bbc78c07a51f6fd29c227b1220a9016e585358ba:
>
> usb: core: hub: use new USB_RESUME_TIMEOUT (2015-04-07 12:58:36 -0500)
>
> ----------------------------------------------------------------
> usb: generic resume timeout for v4.1
>
> This part 2 pull request contains only the patches
> which make sure everybody on linux uses the same
> resume timeout value.
>
> Signed-off-by: Felipe Balbi <balbi@xxxxxx>
>
> ----------------------------------------------------------------
> Felipe Balbi (14):
> usb: define a generic USB_RESUME_TIMEOUT macro
> usb: host: xhci: use new USB_RESUME_TIMEOUT
> usb: host: ehci: use new USB_RESUME_TIMEOUT
> usb: host: uhci: use new USB_RESUME_TIMEOUT
> usb: musb: use new USB_RESUME_TIMEOUT
> usb: host: isp116x: use new USB_RESUME_TIMEOUT
> usb: host: fotg210: use new USB_RESUME_TIMEOUT
> usb: host: fusbh200: use new USB_RESUME_TIMEOUT
> usb: host: oxu210hp: use new USB_RESUME_TIMEOUT
> usb: host: r8a66597: use new USB_RESUME_TIMEOUT
> usb: host: sl811: use new USB_RESUME_TIMEOUT
> usb: dwc2: hcd: use new USB_RESUME_TIMEOUT
> usb: isp1760: hcd: use new USB_RESUME_TIMEOUT
> usb: core: hub: use new USB_RESUME_TIMEOUT
>
> drivers/usb/core/hub.c | 4 ++--
> drivers/usb/dwc2/hcd.c | 2 +-
> drivers/usb/host/ehci-hcd.c | 10 +++++-----
> drivers/usb/host/ehci-hub.c | 9 ++++++---
> drivers/usb/host/fotg210-hcd.c | 2 +-
> drivers/usb/host/fusbh200-hcd.c | 3 +--
> drivers/usb/host/isp116x-hcd.c | 2 +-
> drivers/usb/host/oxu210hp-hcd.c | 7 ++++---
> drivers/usb/host/r8a66597-hcd.c | 2 +-
> drivers/usb/host/sl811-hcd.c | 2 +-
> drivers/usb/host/uhci-hub.c | 5 +++--
> drivers/usb/host/xhci-ring.c | 2 +-
> drivers/usb/isp1760/isp1760-hcd.c | 2 +-
> drivers/usb/musb/musb_core.c | 7 ++++---
> drivers/usb/musb/musb_virthub.c | 2 +-
> include/linux/usb.h | 26 ++++++++++++++++++++++++++
> 16 files changed, 59 insertions(+), 28 deletions(-)
> --
> 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
From d4996890e535d0582cc845bbeaa75ad4de693d92 Mon Sep 17 00:00:00 2001
From: Gregory Herrero <gregory.herrero@xxxxxxxxx>
Date: Fri, 3 Apr 2015 10:53:25 +0200
Subject: [PATCH] usb: dwc2: host: sleep USB_RESUME_TIMEOUT during resume

msleep(USB_RESUME_TIMEOUT) must be done when the controller drives
the resume. This is true after HPRT0_RES is written.
Moreover, restore the delay after controller power is up.

Signed-off-by: Gregory Herrero <gregory.herrero@xxxxxxxxx>
---
drivers/usb/dwc2/hcd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc2/hcd.c b/drivers/usb/dwc2/hcd.c
index fdf40a0..4b6f4ab 100644
--- a/drivers/usb/dwc2/hcd.c
+++ b/drivers/usb/dwc2/hcd.c
@@ -1534,13 +1534,13 @@ static int dwc2_hcd_hub_control(struct dwc2_hsotg *hsotg, u16 typereq,
dev_dbg(hsotg->dev,
"ClearPortFeature USB_PORT_FEAT_SUSPEND\n");
writel(0, hsotg->regs + PCGCTL);
- msleep(USB_RESUME_TIMEOUT);
+ usleep_range(20000, 40000);

hprt0 = dwc2_read_hprt0(hsotg);
hprt0 |= HPRT0_RES;
writel(hprt0, hsotg->regs + HPRT0);
hprt0 &= ~HPRT0_SUSP;
- usleep_range(100000, 150000);
+ msleep(USB_RESUME_TIMEOUT);

hprt0 &= ~HPRT0_RES;
writel(hprt0, hsotg->regs + HPRT0);
--
1.7.10.4