mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 02:21:52 +09:00
usb: gadget: core: Fix ->udc_set_speed() speed handling
commit a4f0927ef5 upstream.
Currently 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 than that supported by the
UDC controller driver.
Select the lesser of the 2 speeds so both UDC and gadget function
driver are operating within limits.
This fixes PHY Erratic errors and 2 second enumeration delay on
TI's AM437x platforms.
Fixes: 6099eca796ae ("usb: gadget: core: introduce ->udc_set_speed() method")
Reported-by: Dylan Howey <Dylan.Howey@tennantco.com>
Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
cb6c13d914
commit
28ddc2b45f
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user