From: Felipe Balbi <balbi@kernel.org>
To: Roger Quadros <rogerq@ti.com>
Cc: Dylan.Howey@tennantco.com, linux-usb@vger.kernel.org,
linux-kernel@vger.kernel.org, Roger Quadros <rogerq@ti.com>,
"# v4 . 13+" <stable@vger.kernel.org>
Subject: Re: [PATCH] usb: dwc3: gadget: Fix .udc_set_speed()
Date: Tue, 31 Oct 2017 15:24:56 +0200 [thread overview]
Message-ID: <87a807cuvr.fsf@linux.intel.com> (raw)
In-Reply-To: <1509454904-4966-1-git-send-email-rogerq@ti.com>
[-- Attachment #1: Type: text/plain, Size: 1666 bytes --]
Roger Quadros <rogerq@ti.com> writes:
> UDC core calls .udc_set_speed() with the speed parameter
> containing the maximum speed supported by the gadget function
> driver. This might very well be more or less than that
> supported by the dwc3 controller driver.
>
> Select the lesser of the 2 speeds so both are operating
> within limits.
>
> This fixes PHY Erratic errors and 2 second enumeration delay on
> TI's AM437x platforms.
>
> Fixes: 7d8d0639565f ("usb: dwc3: gadget: implement ->udc_set_speed()")
> Cc: <stable@vger.kernel.org> # v4.13+
> Reported-by: Dylan Howey <Dylan.Howey@tennantco.com>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
> drivers/usb/dwc3/gadget.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index f064f15..9f27ec0 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -2008,6 +2008,8 @@ static void dwc3_gadget_set_speed(struct usb_gadget *g,
> unsigned long flags;
> u32 reg;
>
> + speed = min(g->max_speed, speed);
should we do that in udc core itself?
@@ -1080,8 +1080,12 @@ static inline void usb_gadget_udc_stop(struct usb_udc *udc)
static inline void usb_gadget_udc_set_speed(struct usb_udc *udc,
enum usb_device_speed speed)
{
- if (udc->gadget->ops->udc_set_speed)
- udc->gadget->ops->udc_set_speed(udc->gadget, speed);
+ if (udc->gadget->ops->udc_set_speed) {
+ enum usb_device_speed s;
+
+ s = min(speed, udc->gadget->max_speed);
+ udc->gadget->ops->udc_set_speed(udc->gadget, s);
+ }
}
/**
then the fix applies for all UDCs.
--
balbi
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
next prev parent reply other threads:[~2017-10-31 13:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-31 13:01 [PATCH] usb: dwc3: gadget: Fix .udc_set_speed() Roger Quadros
2017-10-31 13:24 ` Felipe Balbi [this message]
2017-10-31 13:27 ` Roger Quadros
2017-10-31 13:47 ` [PATCH v2] " Roger Quadros
2017-10-31 13:54 ` Roger Quadros
2017-10-31 13:56 ` [PATCH v2][RESEND] usb: gadget: core: Fix ->udc_set_speed() speed handling Roger Quadros
2017-11-01 14:24 ` Alan Stern
2017-11-01 15:11 ` Roger Quadros
2017-11-01 15:45 ` Alan Stern
2017-11-02 8:53 ` Roger Quadros
2017-11-02 14:14 ` Alan Stern
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=87a807cuvr.fsf@linux.intel.com \
--to=balbi@kernel.org \
--cc=Dylan.Howey@tennantco.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rogerq@ti.com \
--cc=stable@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.