Loading drivers/usb/dwc3/dwc3-msm.c +0 −8 Original line number Original line Diff line number Diff line Loading @@ -1089,11 +1089,6 @@ static void gsi_free_trbs(struct usb_ep *ep) dep->trb_pool = NULL; dep->trb_pool = NULL; dep->trb_pool_dma = 0; dep->trb_pool_dma = 0; dep->trb_dma_pool = NULL; dep->trb_dma_pool = NULL; /* * Reset the ep_type to NORMAL, for next compostion * switch which may be non-gsi. */ dep->endpoint.ep_type = EP_TYPE_NORMAL; } } } } /* /* Loading @@ -1114,9 +1109,6 @@ static void gsi_configure_ep(struct usb_ep *ep, struct usb_gsi_request *request) memset(¶ms, 0x00, sizeof(params)); memset(¶ms, 0x00, sizeof(params)); /* Set the ep_type as GSI */ dep->endpoint.ep_type = EP_TYPE_GSI; /* Configure GSI EP */ /* Configure GSI EP */ params.param0 = DWC3_DEPCFG_EP_TYPE(usb_endpoint_type(desc)) params.param0 = DWC3_DEPCFG_EP_TYPE(usb_endpoint_type(desc)) | DWC3_DEPCFG_MAX_PACKET_SIZE(usb_endpoint_maxp(desc)); | DWC3_DEPCFG_MAX_PACKET_SIZE(usb_endpoint_maxp(desc)); Loading drivers/usb/dwc3/gadget.c +37 −5 Original line number Original line Diff line number Diff line Loading @@ -745,9 +745,12 @@ static int dwc3_gadget_ep_disable(struct usb_ep *ep) return 0; return 0; } } /* Keep GSI ep names with "-gsi" suffix */ if (!strnstr(dep->name, "gsi", 10)) { snprintf(dep->name, sizeof(dep->name), "ep%d%s", snprintf(dep->name, sizeof(dep->name), "ep%d%s", dep->number >> 1, dep->number >> 1, (dep->number & 1) ? "in" : "out"); (dep->number & 1) ? "in" : "out"); } spin_lock_irqsave(&dwc->lock, flags); spin_lock_irqsave(&dwc->lock, flags); ret = __dwc3_gadget_ep_disable(dep); ret = __dwc3_gadget_ep_disable(dep); Loading Loading @@ -2249,11 +2252,27 @@ static const struct usb_gadget_ops dwc3_gadget_ops = { /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ #define NUM_GSI_OUT_EPS 1 #define NUM_GSI_IN_EPS 2 static int dwc3_gadget_init_hw_endpoints(struct dwc3 *dwc, static int dwc3_gadget_init_hw_endpoints(struct dwc3 *dwc, u8 num, u32 direction) u8 num, u32 direction) { { struct dwc3_ep *dep; struct dwc3_ep *dep; u8 i; u8 i, gsi_ep_count, gsi_ep_index = 0; /* Read number of event buffers to check if we need * to update gsi_ep_count. For non GSI targets this * will be 0 and we will skip reservation of GSI eps. * There is one event buffer for each GSI EP. */ gsi_ep_count = dwc->num_gsi_event_buffers; /* OUT GSI EPs based on direction field */ if (gsi_ep_count && !direction) gsi_ep_count = NUM_GSI_OUT_EPS; /* IN GSI EPs */ else if (gsi_ep_count && direction) gsi_ep_count = NUM_GSI_IN_EPS; for (i = 0; i < num; i++) { for (i = 0; i < num; i++) { u8 epnum = (i << 1) | (!!direction); u8 epnum = (i << 1) | (!!direction); Loading @@ -2267,12 +2286,25 @@ static int dwc3_gadget_init_hw_endpoints(struct dwc3 *dwc, dep->direction = !!direction; dep->direction = !!direction; dwc->eps[epnum] = dep; dwc->eps[epnum] = dep; snprintf(dep->name, sizeof(dep->name), "ep%d%s", epnum >> 1, /* Reserve EPs at the end for GSI based on gsi_ep_count */ (epnum & 1) ? "in" : "out"); if ((gsi_ep_index < gsi_ep_count) && (i > (num - 1 - gsi_ep_count))) { gsi_ep_index++; /* For GSI EPs, name eps as "gsi-epin" or "gsi-epout" */ snprintf(dep->name, sizeof(dep->name), "%s", (epnum & 1) ? "gsi-epin" : "gsi-epout"); /* Set ep type as GSI */ dep->endpoint.ep_type = EP_TYPE_GSI; } else { snprintf(dep->name, sizeof(dep->name), "ep%d%s", epnum >> 1, (epnum & 1) ? "in" : "out"); } dep->endpoint.ep_num = epnum >> 1; dep->endpoint.name = dep->name; dep->endpoint.name = dep->name; dev_vdbg(dwc->dev, "initializing %s\n", dep->name); dev_vdbg(dwc->dev, "initializing %s %d\n", dep->name, epnum >> 1); if (epnum == 0 || epnum == 1) { if (epnum == 0 || epnum == 1) { usb_ep_set_maxpacket_limit(&dep->endpoint, 512); usb_ep_set_maxpacket_limit(&dep->endpoint, 512); Loading include/linux/usb/gadget.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -268,6 +268,7 @@ struct usb_ep { const struct usb_endpoint_descriptor *desc; const struct usb_endpoint_descriptor *desc; const struct usb_ss_ep_comp_descriptor *comp_desc; const struct usb_ss_ep_comp_descriptor *comp_desc; enum ep_type ep_type; enum ep_type ep_type; u8 ep_num; u8 ep_intr_num; u8 ep_intr_num; bool endless; bool endless; }; }; Loading Loading
drivers/usb/dwc3/dwc3-msm.c +0 −8 Original line number Original line Diff line number Diff line Loading @@ -1089,11 +1089,6 @@ static void gsi_free_trbs(struct usb_ep *ep) dep->trb_pool = NULL; dep->trb_pool = NULL; dep->trb_pool_dma = 0; dep->trb_pool_dma = 0; dep->trb_dma_pool = NULL; dep->trb_dma_pool = NULL; /* * Reset the ep_type to NORMAL, for next compostion * switch which may be non-gsi. */ dep->endpoint.ep_type = EP_TYPE_NORMAL; } } } } /* /* Loading @@ -1114,9 +1109,6 @@ static void gsi_configure_ep(struct usb_ep *ep, struct usb_gsi_request *request) memset(¶ms, 0x00, sizeof(params)); memset(¶ms, 0x00, sizeof(params)); /* Set the ep_type as GSI */ dep->endpoint.ep_type = EP_TYPE_GSI; /* Configure GSI EP */ /* Configure GSI EP */ params.param0 = DWC3_DEPCFG_EP_TYPE(usb_endpoint_type(desc)) params.param0 = DWC3_DEPCFG_EP_TYPE(usb_endpoint_type(desc)) | DWC3_DEPCFG_MAX_PACKET_SIZE(usb_endpoint_maxp(desc)); | DWC3_DEPCFG_MAX_PACKET_SIZE(usb_endpoint_maxp(desc)); Loading
drivers/usb/dwc3/gadget.c +37 −5 Original line number Original line Diff line number Diff line Loading @@ -745,9 +745,12 @@ static int dwc3_gadget_ep_disable(struct usb_ep *ep) return 0; return 0; } } /* Keep GSI ep names with "-gsi" suffix */ if (!strnstr(dep->name, "gsi", 10)) { snprintf(dep->name, sizeof(dep->name), "ep%d%s", snprintf(dep->name, sizeof(dep->name), "ep%d%s", dep->number >> 1, dep->number >> 1, (dep->number & 1) ? "in" : "out"); (dep->number & 1) ? "in" : "out"); } spin_lock_irqsave(&dwc->lock, flags); spin_lock_irqsave(&dwc->lock, flags); ret = __dwc3_gadget_ep_disable(dep); ret = __dwc3_gadget_ep_disable(dep); Loading Loading @@ -2249,11 +2252,27 @@ static const struct usb_gadget_ops dwc3_gadget_ops = { /* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */ #define NUM_GSI_OUT_EPS 1 #define NUM_GSI_IN_EPS 2 static int dwc3_gadget_init_hw_endpoints(struct dwc3 *dwc, static int dwc3_gadget_init_hw_endpoints(struct dwc3 *dwc, u8 num, u32 direction) u8 num, u32 direction) { { struct dwc3_ep *dep; struct dwc3_ep *dep; u8 i; u8 i, gsi_ep_count, gsi_ep_index = 0; /* Read number of event buffers to check if we need * to update gsi_ep_count. For non GSI targets this * will be 0 and we will skip reservation of GSI eps. * There is one event buffer for each GSI EP. */ gsi_ep_count = dwc->num_gsi_event_buffers; /* OUT GSI EPs based on direction field */ if (gsi_ep_count && !direction) gsi_ep_count = NUM_GSI_OUT_EPS; /* IN GSI EPs */ else if (gsi_ep_count && direction) gsi_ep_count = NUM_GSI_IN_EPS; for (i = 0; i < num; i++) { for (i = 0; i < num; i++) { u8 epnum = (i << 1) | (!!direction); u8 epnum = (i << 1) | (!!direction); Loading @@ -2267,12 +2286,25 @@ static int dwc3_gadget_init_hw_endpoints(struct dwc3 *dwc, dep->direction = !!direction; dep->direction = !!direction; dwc->eps[epnum] = dep; dwc->eps[epnum] = dep; snprintf(dep->name, sizeof(dep->name), "ep%d%s", epnum >> 1, /* Reserve EPs at the end for GSI based on gsi_ep_count */ (epnum & 1) ? "in" : "out"); if ((gsi_ep_index < gsi_ep_count) && (i > (num - 1 - gsi_ep_count))) { gsi_ep_index++; /* For GSI EPs, name eps as "gsi-epin" or "gsi-epout" */ snprintf(dep->name, sizeof(dep->name), "%s", (epnum & 1) ? "gsi-epin" : "gsi-epout"); /* Set ep type as GSI */ dep->endpoint.ep_type = EP_TYPE_GSI; } else { snprintf(dep->name, sizeof(dep->name), "ep%d%s", epnum >> 1, (epnum & 1) ? "in" : "out"); } dep->endpoint.ep_num = epnum >> 1; dep->endpoint.name = dep->name; dep->endpoint.name = dep->name; dev_vdbg(dwc->dev, "initializing %s\n", dep->name); dev_vdbg(dwc->dev, "initializing %s %d\n", dep->name, epnum >> 1); if (epnum == 0 || epnum == 1) { if (epnum == 0 || epnum == 1) { usb_ep_set_maxpacket_limit(&dep->endpoint, 512); usb_ep_set_maxpacket_limit(&dep->endpoint, 512); Loading
include/linux/usb/gadget.h +1 −0 Original line number Original line Diff line number Diff line Loading @@ -268,6 +268,7 @@ struct usb_ep { const struct usb_endpoint_descriptor *desc; const struct usb_endpoint_descriptor *desc; const struct usb_ss_ep_comp_descriptor *comp_desc; const struct usb_ss_ep_comp_descriptor *comp_desc; enum ep_type ep_type; enum ep_type ep_type; u8 ep_num; u8 ep_intr_num; u8 ep_intr_num; bool endless; bool endless; }; }; Loading