[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <8fb5bfd8-966e-4f55-9563-b580ad3bb892@quicinc.com>
Date: Tue, 8 Oct 2024 09:54:20 +0530
From: Prashanth K <quic_prashk@...cinc.com>
To: Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
Greg Kroah-Hartman
<gregkh@...uxfoundation.org>
CC: <linux-kernel@...r.kernel.org>, <linux-usb@...r.kernel.org>,
<stable@...r.kernel.org>
Subject: Re: [PATCH] usb: dwc3: Wait for EndXfer completion before restoring
GUSB2PHYCFG
On 24-09-24 03:02 pm, Prashanth K wrote:
> DWC3 programming guide mentions that when operating in USB2.0 speeds,
> if GUSB2PHYCFG[6] or GUSB2PHYCFG[8] is set, it must be cleared prior
> to issuing commands and may be set again after the command completes.
> But currently while issuing EndXfer command without CmdIOC set, we
> wait for 1ms after GUSB2PHYCFG is restored. This results in cases
> where EndXfer command doesn't get completed and causes SMMU faults
> since requests are unmapped afterwards. Hence restore GUSB2PHYCFG
> after waiting for EndXfer command completion.
>
> Cc: stable@...r.kernel.org
> Fixes: 1d26ba0944d3 ("usb: dwc3: Wait unconditionally after issuing EndXfer command")
> Signed-off-by: Prashanth K <quic_prashk@...cinc.com>
> ---
> drivers/usb/dwc3/gadget.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index 291bc549935b..50772d611582 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -438,6 +438,10 @@ int dwc3_send_gadget_ep_cmd(struct dwc3_ep *dep, unsigned int cmd,
> dwc3_gadget_ep_get_transfer_index(dep);
> }
>
> + if (DWC3_DEPCMD_CMD(cmd) == DWC3_DEPCMD_ENDTRANSFER &&
> + !(cmd & DWC3_DEPCMD_CMDIOC))
> + mdelay(1);
> +
> if (saved_config) {
> reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
> reg |= saved_config;
> @@ -1715,12 +1719,10 @@ static int __dwc3_stop_active_transfer(struct dwc3_ep *dep, bool force, bool int
> WARN_ON_ONCE(ret);
> dep->resource_index = 0;
>
> - if (!interrupt) {
> - mdelay(1);
> + if (!interrupt)
> dep->flags &= ~DWC3_EP_TRANSFER_STARTED;
> - } else if (!ret) {
> + else if (!ret)
> dep->flags |= DWC3_EP_END_TRANSFER_PENDING;
> - }
>
> dep->flags &= ~DWC3_EP_DELAY_STOP;
> return ret;
Hi Thinh,
In case you have missed, can you please review this?
Thanks in advance,
Prashanth K
Powered by blists - more mailing lists