linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: gadget: Fix .udc_set_speed()
@ 2017-10-31 13:01 Roger Quadros
  2017-10-31 13:24 ` Felipe Balbi
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Roger Quadros @ 2017-10-31 13:01 UTC (permalink / raw)
  To: balbi; +Cc: Dylan.Howey, linux-usb, linux-kernel, Roger Quadros, # v4 . 13+

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);
+
 	spin_lock_irqsave(&dwc->lock, flags);
 	reg = dwc3_readl(dwc->regs, DWC3_DCFG);
 	reg &= ~(DWC3_DCFG_SPEED_MASK);
-- 
cheers,
-roger

Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-11-02 14:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-31 13:01 [PATCH] usb: dwc3: gadget: Fix .udc_set_speed() Roger Quadros
2017-10-31 13:24 ` Felipe Balbi
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).