diff --git a/drivers/usb/gadget/epautoconf.c b/drivers/usb/gadget/epautoconf.c index 1eb4fa2e623f..be3a7f2e5c17 100644 --- a/drivers/usb/gadget/epautoconf.c +++ b/drivers/usb/gadget/epautoconf.c @@ -67,6 +67,9 @@ struct usb_ep *usb_ep_autoconfig_ss( ) { struct usb_ep *ep; +#ifdef CONFIG_ARCH_ROCKCHIP + u8 type = desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK; +#endif if (gadget->ops->match_ep) { ep = gadget->ops->match_ep(gadget, desc, ep_comp); @@ -110,6 +113,27 @@ found_ep: ep->desc = NULL; ep->comp_desc = NULL; ep->claimed = true; +#ifdef CONFIG_ARCH_ROCKCHIP + ep->transfer_type = type; + if (gadget_is_superspeed(gadget) && ep_comp) { + switch (type) { + case USB_ENDPOINT_XFER_ISOC: + /* mult: bits 1:0 of bmAttributes */ + ep->mult = (ep_comp->bmAttributes & 0x3) + 1; + fallthrough; + case USB_ENDPOINT_XFER_BULK: + case USB_ENDPOINT_XFER_INT: + ep->maxburst = ep_comp->bMaxBurst + 1; + break; + default: + break; + } + } else if (gadget_is_dualspeed(gadget) && + (type == USB_ENDPOINT_XFER_ISOC || + type == USB_ENDPOINT_XFER_INT)) { + ep->mult = usb_endpoint_maxp_mult(desc); + } +#endif return ep; } EXPORT_SYMBOL_GPL(usb_ep_autoconfig_ss); diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index ea02847923bf..2711181c0092 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -218,6 +218,7 @@ struct usb_ep_caps { * enabled and remains valid until the endpoint is disabled. * @comp_desc: In case of SuperSpeed support, this is the endpoint companion * descriptor that is used to configure the endpoint + * @transfer_type: Used to specify transfer type of EP. * * the bus controller driver lists all the general purpose endpoints in * gadget->ep_list. the control endpoint (gadget->ep0) is not in that list, @@ -241,6 +242,9 @@ struct usb_ep { u8 address; const struct usb_endpoint_descriptor *desc; const struct usb_ss_ep_comp_descriptor *comp_desc; +#ifdef CONFIG_ARCH_ROCKCHIP + u8 transfer_type; +#endif }; /*-------------------------------------------------------------------------*/