Patch "usb: dwc3: Fix assignment of EP transfer resources" has been added to the 4.4-stable tree
Subsystems (3)
This is a note to let you know that I've just added the patch titled
usb: dwc3: Fix assignment of EP transfer resources
to the 4.4-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-dwc3-fix-assignment-of-ep-transfer-resources.patch
and it can be found in the queue-4.4 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
c450960187f45d4260db87c7dd4fc0bceb5565d8Mon Sep 17 00:00:00 2001
From: John Youn <[email protected]>
Date: Tue, 16 Feb 2016 20:10:53 -0800
Subject: usb: dwc3: Fix assignment of EP transfer resources
From: John Youn <[email protected]>
commit c450960187f45d4260db87c7dd4fc0bceb5565d8 upstream.
The assignement of EP transfer resources was not handled properly in the dwc3 driver. Commit aebda6187181 ("usb: dwc3: Reset the transfer resource index on SET_INTERFACE") previously fixed one aspect of this where resources may be exhausted with multiple calls to SET_INTERFACE. However, it introduced an issue where composite devices with multiple interfaces can be assigned the same transfer resources for different endpoints. This patch solves both issues.
The assignment of transfer resources cannot perfectly follow the data book due to the fact that the controller driver does not have all knowledge of the configuration in advance. It is given this information piecemeal by the composite gadget framework after every SET_CONFIGURATION and SET_INTERFACE. Trying to follow the databook programming model in this scenario can cause errors. For two reasons:
1) The databook says to do DEPSTARTCFG for every SET_CONFIGURATION and SET_INTERFACE (8.1.5). This is incorrect in the scenario of multiple interfaces.
2) The databook does not mention doing more DEPXFERCFG for new endpoint on alt setting (8.1.6).
The following simplified method is used instead:
All hardware endpoints can be assigned a transfer resource and this setting will stay persistent until either a core reset or hibernation. So whenever we do a DEPSTARTCFG(0) we can go ahead and do DEPXFERCFG for every hardware endpoint as well. We are guaranteed that there are as many transfer resources as endpoints.
This patch triggers off of the calling dwc3_gadget_start_config() for EP0-out, which always happens first, and which should only happen in one of the above conditions.
--- drivers/usb/dwc3/core.h | 1 drivers/usb/dwc3/ep0.c | 5 --- drivers/usb/dwc3/gadget.c | 70 ++++++++++++++++++++++++++++++++++------------ 3 files changed, 52 insertions(+), 24 deletions(-)
drivers/usb/dwc3/core.h +0 -1
@@ -853,7 +853,6 @@ struct dwc3 { unsigned pullups_connected:1; unsigned resize_fifos:1; unsigned setup_packet_pending:1; - unsigned start_config_issued:1; unsigned three_stage_setup:1; unsigned usb3_lpm_capable:1;
drivers/usb/dwc3/ep0.c +0 -5
@@ -555,7 +555,6 @@ static int dwc3_ep0_set_config(struct dwint ret;u32 reg; - dwc->start_config_issued = false; cfg =le16_to_cpu (ctrl->wValue);switch (state) {
@@ -737,10 +736,6 @@ static int dwc3_ep0_std_request(struct ddwc3_trace (trace_dwc3_ep0,"USB_REQ_SET_ISOCH_DELAY" ); ret =dwc3_ep0_set_isoch_delay (dwc, ctrl);break ; -case USB_REQ_SET_INTERFACE : -dwc3_trace (trace_dwc3_ep0,"USB_REQ_SET_INTERFACE" ); - dwc->start_config_issued = false; -/* Fall through */ default :dwc3_trace (trace_dwc3_ep0,"Forwarding to gadget driver" ); ret =dwc3_ep0_delegate_req (dwc, ctrl);
drivers/usb/dwc3/gadget.c +52 -18
108 lines not on this page · raw message
Patches currently in stable-queue which might be from [email protected] are
queue-4.4/usb-dwc3-fix-assignment-of-ep-transfer-resources.patch