Skip to content

Commit e9ab4d0

Browse files
Mian Yousaf KaukabFelipe Balbi
authored andcommitted
usb: gadget: autoconf: net2280: match hardware and usb ep address
USB3380 GPEP can be used in IN and OUT directions however, both directions should use same endpoint address. Fulfil this requirement by mapping usb endpoint to hardware endpoint with the same address. Tested-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
1 parent c65c4f0 commit e9ab4d0

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

drivers/usb/gadget/epautoconf.c

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,15 +258,25 @@ struct usb_ep *usb_ep_autoconfig_ss(
258258
/* First, apply chip-specific "best usage" knowledge.
259259
* This might make a good usb_gadget_ops hook ...
260260
*/
261-
if (gadget_is_net2280 (gadget) && type == USB_ENDPOINT_XFER_INT) {
262-
/* ep-e, ep-f are PIO with only 64 byte fifos */
263-
ep = find_ep (gadget, "ep-e");
264-
if (ep && ep_matches(gadget, ep, desc, ep_comp))
265-
goto found_ep;
266-
ep = find_ep (gadget, "ep-f");
261+
if (gadget_is_net2280(gadget)) {
262+
char name[8];
263+
264+
if (type == USB_ENDPOINT_XFER_INT) {
265+
/* ep-e, ep-f are PIO with only 64 byte fifos */
266+
ep = find_ep(gadget, "ep-e");
267+
if (ep && ep_matches(gadget, ep, desc, ep_comp))
268+
goto found_ep;
269+
ep = find_ep(gadget, "ep-f");
270+
if (ep && ep_matches(gadget, ep, desc, ep_comp))
271+
goto found_ep;
272+
}
273+
274+
/* USB3380: use same address for usb and hardware endpoints */
275+
snprintf(name, sizeof(name), "ep%d%s", usb_endpoint_num(desc),
276+
usb_endpoint_dir_in(desc) ? "in" : "out");
277+
ep = find_ep(gadget, name);
267278
if (ep && ep_matches(gadget, ep, desc, ep_comp))
268279
goto found_ep;
269-
270280
} else if (gadget_is_goku (gadget)) {
271281
if (USB_ENDPOINT_XFER_INT == type) {
272282
/* single buffering is enough */

0 commit comments

Comments
 (0)