Skip to contentSkip to conversation

Patch "usb: gadget: core: Fix ->udc_set_speed() speed handling" has been added to the 4.14-stable tree

PATCH [email protected] 1 participant 1 message Dec 10, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

    usb: gadget: core: Fix ->udc_set_speed() speed handling

to the 4.14-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
usb-gadget-core-fix-udc_set_speed-speed-handling.patch
and it can be found in the queue-4.14 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From a4f0927ef588cf62bb864707261482c874352942 Mon Sep 17 00:00:00 2001

From: Roger Quadros <[email protected]>
Date: Tue, 31 Oct 2017 15:56:29 +0200
Subject: usb: gadget: core: Fix ->udc_set_speed() speed handling

From: Roger Quadros <[email protected]>

commit a4f0927ef588cf62bb864707261482c874352942 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")
---
 drivers/usb/gadget/udc/core.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/usb/gadget/udc/core.c +6 -2
@@ -1080,8 +1080,12 @@ static inline void usb_gadget_udc_stop(s
 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);
+	}
 }
 
 /**

Patches currently in stable-queue which might be from [email protected] are

queue-4.14/usb-gadget-core-fix-udc_set_speed-speed-handling.patch