From: Felipe Balbi <balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org>
Cc: linux-omap <linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
"linux-usb@vger.kernel.org"
<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: dwc3 gadget breaks on system suspend/resume
Date: Mon, 30 Jan 2017 15:47:58 +0200 [thread overview]
Message-ID: <87d1f464mp.fsf@linux.intel.com> (raw)
In-Reply-To: <87inow662n.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
[-- Attachment #1: Type: text/plain, Size: 2611 bytes --]
Hi,
Felipe Balbi <balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> writes:
> Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> writes:
>>> Roger Quadros <rogerq-l0cyMroinI0@public.gmane.org> writes:
>>>>> (hmm, I didn't receive your reply in my intel inbox, only
>>>>> gmail. Odd. Replying to myself here, but it should be on your reply,
>>>>> rater).
>>>>>
>>>>> Felipe Balbi <balbi-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> writes:
>>>>>>> The previous commit c499ff71ff2a281366c6ec7a904c547d806cbcd1 is fine.
>>>>>>
>>>>>> okay. Then let's try to figure out what's going on. A diff of regdump
>>>>>> before and after suspend/resume might start to give some clue about
>>>>>> what's going on. DWC3 tracepoints should help too. Care to get those?
>>>>>> BTW, is this dwc3 as host or peripheral?
>>>>>
>>>>> You don't have any endpoints enabled:
>>>>>
>>>>> -DALEPENA = 0x0000000f
>>>>> +DALEPENA = 0x00000000
>>>>
>>>> Thanks for the hints.
>>>>
>>>> This problem is because reason dwc3_gadget_run_stop() is timing out
>>>> during the suspend sequence and so dwc3_disconnect_gadget() and
>>>> __dwc3_gadget_stop() are not being called.
>>>
>>> I see
>>>
>>>> dwc3_suspend() does not consider dwc3_gadget_suspend()'s return value
>>>> and happily continues suspending the machine.
>>>>
>>>> If I force dwc3_gadget_run_stop() to return 0 then everything works fine.
>>>>
>>>> Any ideas why DWC3_DSTS_DEVCTRLHLT is not getting set?
>>>
>>> no idea. It should always get set when run_stop is cleared. Can you
>>> check if suspending with cable detached has any difference?
>>
>> After cable detach, it still timed out the next suspend. But on
>> subsequent suspends there were no timeouts. (I didn't plug the cable
>> back at all)
>>
>> This behaviour is on dra7. I will test the behaviour on am43x as well.
>
> wonder if there's something odd with 2.02a. AM437x is 2.40a IIRC,
> testing that is, indeed, a good idea.
What if your platform just takes longer to halt?
Can you try below?
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 4db97ecae885..d2e405793b1f 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1586,7 +1586,7 @@ static int dwc3_gadget_set_selfpowered(struct usb_gadget *g,
static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on, int suspend)
{
u32 reg;
- u32 timeout = 500;
+ u32 timeout = 500000;
if (pm_runtime_suspended(dwc->dev))
return 0;
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2017-01-30 13:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-19 11:46 dwc3 gadget breaks on system suspend/resume Roger Quadros
[not found] ` <54bdc1b7-69ed-d580-fd17-3e7499ac1c27-l0cyMroinI0@public.gmane.org>
2017-01-19 11:59 ` Felipe Balbi
[not found] ` <87a8anjm5z.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-01-19 12:16 ` Roger Quadros
[not found] ` <a0cc2705-b1f5-7b6e-d73c-ff9b525eead2-l0cyMroinI0@public.gmane.org>
2017-01-27 13:55 ` Roger Quadros
[not found] ` <e64bc4ee-1c71-d72c-cdc7-f5857f49a90e-l0cyMroinI0@public.gmane.org>
2017-01-27 14:17 ` Felipe Balbi
[not found] ` <87inp07fkx.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-01-27 14:46 ` Roger Quadros
[not found] ` <57fbf2b6-3811-3202-0e69-7cf82662d50f-l0cyMroinI0@public.gmane.org>
2017-01-27 15:03 ` Felipe Balbi
[not found] ` <8760l07dfh.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-01-27 15:25 ` Roger Quadros
2017-01-27 15:47 ` Felipe Balbi
[not found] ` <87wpdg5wtx.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-01-30 12:46 ` Roger Quadros
[not found] ` <a91c7564-5bfa-c77f-8fa2-1c1b0bcfd815-l0cyMroinI0@public.gmane.org>
2017-01-30 12:59 ` Felipe Balbi
[not found] ` <87o9yo66w7.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-01-30 13:03 ` Roger Quadros
[not found] ` <19de4c77-0e95-f7b5-0f56-a705134fd4cc-l0cyMroinI0@public.gmane.org>
2017-01-30 13:16 ` Felipe Balbi
[not found] ` <87inow662n.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-01-30 13:47 ` Felipe Balbi [this message]
[not found] ` <87d1f464mp.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-01-31 11:38 ` Roger Quadros
[not found] ` <90f70eb2-8b87-d33e-71cd-335c05c6f65a-l0cyMroinI0@public.gmane.org>
2017-01-31 12:03 ` Felipe Balbi
[not found] ` <87mve74esx.fsf-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-01-31 13:25 ` Roger Quadros
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d1f464mp.fsf@linux.intel.com \
--to=balbi-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=rogerq-l0cyMroinI0@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox