]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
usb: dwc3: gadget: Fix dep->interval for fullspeed interrupt
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Mon, 8 Feb 2021 21:53:16 +0000 (13:53 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Mar 2021 15:44:22 +0000 (16:44 +0100)
commit 4b049f55ed95cd889bcdb3034fd75e1f01852b38 upstream.

The dep->interval captures the number of frames/microframes per interval
from bInterval. Fullspeed interrupt endpoint bInterval is the number of
frames per interval and not 2^(bInterval - 1). So fix it here. This
change is only for debugging purpose and should not affect the interrupt
endpoint operation.

Fixes: 72246da40f37 ("usb: Introduce DesignWare USB3 DRD Driver")
Cc: <stable@vger.kernel.org>
Signed-off-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Link: https://lore.kernel.org/r/1263b563dedc4ab8b0fb854fba06ce4bc56bd495.1612820995.git.Thinh.Nguyen@synopsys.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/dwc3/gadget.c

index 3a64271497387940fb83e55d070789c16f8a52dd..34ac8d71d7c808c44340916ae083b409a8b9407c 100644 (file)
@@ -531,8 +531,13 @@ static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, struct dwc3_ep *dep,
                if (dwc->gadget.speed == USB_SPEED_FULL)
                        bInterval_m1 = 0;
 
+               if (usb_endpoint_type(desc) == USB_ENDPOINT_XFER_INT &&
+                   dwc->gadget.speed == USB_SPEED_FULL)
+                       dep->interval = desc->bInterval;
+               else
+                       dep->interval = 1 << (desc->bInterval - 1);
+
                params.param1 |= DWC3_DEPCFG_BINTERVAL_M1(bInterval_m1);
-               dep->interval = 1 << (desc->bInterval - 1);
        }
 
        return dwc3_send_gadget_ep_cmd(dwc, dep->number,