From: Wesley Cheng <quic_wcheng@quicinc.com>
To: Thinh Nguyen <Thinh.Nguyen@synopsys.com>,
"balbi@kernel.org" <balbi@kernel.org>,
"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"quic_jackp@quicinc.com" <quic_jackp@quicinc.com>
Subject: Re: [PATCH 4/5] usb: dwc3: Allow end transfer commands to be sent during soft disconnect
Date: Tue, 12 Jul 2022 15:08:49 -0700 [thread overview]
Message-ID: <8029f6bb-4704-0495-00d2-ee78ee684eb3@quicinc.com> (raw)
In-Reply-To: <06498069-db45-202b-eba6-47bfa6948143@synopsys.com>
Hi Thinh,
On 7/8/2022 6:58 PM, Thinh Nguyen wrote:
> On 7/8/2022, Wesley Cheng wrote:
>> If soft disconnect is in progress, allow the endxfer command to be sent,
>> without this, there is an issue where the stop active transfer call
>> (during pullup disable) wouldn't actually issue the endxfer command,
>> while clearing the DEP flag.
>>
>> In addition, if the DWC3_EP_DELAY_STOP flag was set before soft disconnect
>> started (i.e. from the dequeue path), ensure that when the EP0 transaction
>> completes during soft disconnect, to issue the endxfer with the force
>> parameter set, as it does not expect a command complete event.
>>
>> Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
>> ---
>> drivers/usb/dwc3/ep0.c | 3 +--
>> drivers/usb/dwc3/gadget.c | 5 ++++-
>> 2 files changed, 5 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
>> index 506ef717fdc0..5851b0e9db0a 100644
>> --- a/drivers/usb/dwc3/ep0.c
>> +++ b/drivers/usb/dwc3/ep0.c
>> @@ -290,8 +290,7 @@ void dwc3_ep0_out_start(struct dwc3 *dwc)
>> if (!(dwc3_ep->flags & DWC3_EP_DELAY_STOP))
>> continue;
>>
>> - dwc3_ep->flags &= ~DWC3_EP_DELAY_STOP;
>> - dwc3_stop_active_transfer(dwc3_ep, true, true);
>> + dwc3_stop_active_transfer(dwc3_ep, true, dwc->connected);
>> }
>> }
>>
>> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
>> index bd40608b19df..fba2797ad9ae 100644
>> --- a/drivers/usb/dwc3/gadget.c
>> +++ b/drivers/usb/dwc3/gadget.c
>> @@ -3696,8 +3696,10 @@ void dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force,
>> if (dep->number <= 1 && dwc->ep0state != EP0_DATA_PHASE)
>> return;
>>
>> + if (interrupt && (dep->flags & DWC3_EP_DELAY_STOP))
>> + return;
>> +
>> if (!(dep->flags & DWC3_EP_TRANSFER_STARTED) ||
>> - (dep->flags & DWC3_EP_DELAY_STOP) ||
>> (dep->flags & DWC3_EP_END_TRANSFER_PENDING))
>> return;
>>
>> @@ -3744,6 +3746,7 @@ void dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force,
>> __dwc3_stop_active_transfer(dep, force, interrupt);
>> spin_lock(&dwc->lock);
>>
>> + dep->flags &= ~DWC3_EP_DELAY_STOP;
>
> Can we clear this flag in __dwc3_stop_active_transfer(). It should apply
> if End Transfer command was sent.
I wanted to make sure that we weren't modifying the DEP flags outside of
a spin lock. Patch#3 modifies it where we unlock before calling
__dwc3_stop_active_transfer(), so we can allow the dwc3 threaded IRQ
handle events while the cmd status polling happens.
Maybe we can unlock/lock the dwc3->lock inside
__dwc3_stop_active_transfer() and that way we can ensure DEP flags are
modified properly?
Thanks
Wesley Cheng
next prev parent reply other threads:[~2022-07-12 22:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-07-08 18:50 [PATCH 0/5] Fix controller halt and endxfer timeout issues Wesley Cheng
2022-07-08 18:50 ` [PATCH 1/5] usb: dwc3: Do not service EP0 and conndone events if soft disconnected Wesley Cheng
2022-07-08 18:50 ` [PATCH 2/5] usb: dwc3: gadget: Force sending delayed status during soft disconnect Wesley Cheng
2022-07-08 18:50 ` [PATCH 3/5] usb: dwc3: gadget: Adjust IRQ management during soft disconnect/connect Wesley Cheng
2022-07-09 2:26 ` kernel test robot
2022-07-09 4:47 ` kernel test robot
2022-07-08 18:50 ` [PATCH 4/5] usb: dwc3: Allow end transfer commands to be sent during soft disconnect Wesley Cheng
2022-07-09 1:58 ` Thinh Nguyen
2022-07-12 22:08 ` Wesley Cheng [this message]
2022-07-13 1:42 ` Thinh Nguyen
2022-07-13 17:45 ` Wesley Cheng
2022-07-14 0:19 ` Thinh Nguyen
2022-07-14 0:33 ` Wesley Cheng
2022-07-14 0:41 ` Thinh Nguyen
2022-07-08 18:50 ` [PATCH 5/5] usb: dwc3: gadget: Increase DWC3 controller halt timeout Wesley Cheng
2022-07-09 1:47 ` Thinh Nguyen
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=8029f6bb-4704-0495-00d2-ee78ee684eb3@quicinc.com \
--to=quic_wcheng@quicinc.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=balbi@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=quic_jackp@quicinc.com \
/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
all inboxes | Powered by JetHome®