- DWC_USB3_NUM indicates the number of Device mode single directional endpoints, including OUT and IN endpoint 0. - DWC_USB3_NUM_IN_EPS indicates the maximum number of Device mode IN endpoints active at any time, including control endpoint 0. It's possible to configure RTL such that DWC_USB3_NUM_EPS is equal to DWC_USB3_NUM_IN_EPS. dwc3-core calculates the number of OUT endpoints as DWC_USB3_NUM minus DWC_USB3_NUM_IN_EPS. If RTL has been configured with DWC_USB3_NUM_IN_EPS equal to DWC_USB3_NUM then dwc3-core will calculate the number of OUT endpoints as zero. For example a from dwc3_core_num_eps() shows: [ 1.565000] /usb0@f01d0000: found 8 IN and 0 OUT endpoints This patch works around this case by detecting when DWC_USB3_NUM_EPS is equal to DWC3_USB3_NUM_IN_EPS and over-rides the calculation of the number of OUT and IN endpoints to make dwc->num_in_eps equal to half DWC_USB3_NUM_EPS. If DWC_USB3_NUM_EPS is equal to DWC3_USB3_NUM_IN_EPS and the endpoint count is an odd number then dwc->num_out_eps will be assigned the extra endpoint. Suggested-by: Felipe Balbi <balbi@xxxxxxxxxx> Signed-off-by: Bryan O'Donoghue <pure.logic@xxxxxxxxxxxxxxxxx> --- drivers/usb/dwc3/core.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 369bab1..91f0d9c 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -398,7 +398,12 @@ static void dwc3_core_num_eps(struct dwc3 *dwc) struct dwc3_hwparams *parms = &dwc->hwparams; dwc->num_in_eps = DWC3_NUM_IN_EPS(parms); - dwc->num_out_eps = DWC3_NUM_EPS(parms) - dwc->num_in_eps; + dwc->num_out_eps = DWC3_NUM_EPS(parms); + + if (dwc->num_in_eps == dwc->num_out_eps) + dwc->num_in_eps = dwc->num_out_eps / 2; + + dwc->num_out_eps -= dwc->num_in_eps; } static void dwc3_cache_hwparams(struct dwc3 *dwc) -- 2.7.4 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html