]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
usb: musb: make use of new usb_endpoint_maxp_mult()
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Wed, 28 Sep 2016 10:40:40 +0000 (13:40 +0300)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Thu, 3 Nov 2016 08:38:21 +0000 (10:38 +0200)
We have introduced a helper to calculate multiplier
value from wMaxPacketSize. Start using it.

Cc: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/musb/musb_gadget.c
drivers/usb/musb/musb_host.c

index 4042ea017985de56346d0ac1dd070f33db079d77..47304560f105fb1c4ab2123f520b8a9e6a8a8583 100644 (file)
@@ -974,8 +974,8 @@ static int musb_gadget_enable(struct usb_ep *ep,
                goto fail;
 
        /* REVISIT this rules out high bandwidth periodic transfers */
-       tmp = usb_endpoint_maxp(desc);
-       if (tmp & ~0x07ff) {
+       tmp = usb_endpoint_maxp_mult(desc) - 1;
+       if (tmp) {
                int ok;
 
                if (usb_endpoint_dir_in(desc))
@@ -987,12 +987,12 @@ static int musb_gadget_enable(struct usb_ep *ep,
                        musb_dbg(musb, "no support for high bandwidth ISO");
                        goto fail;
                }
-               musb_ep->hb_mult = (tmp >> 11) & 3;
+               musb_ep->hb_mult = tmp;
        } else {
                musb_ep->hb_mult = 0;
        }
 
-       musb_ep->packet_sz = tmp & 0x7ff;
+       musb_ep->packet_sz = usb_endpoint_maxp(desc);
        tmp = musb_ep->packet_sz * (musb_ep->hb_mult + 1);
 
        /* enable the interrupts for the endpoint, set the endpoint
index 53bc4ceefe89ad16dcb576fb2fd18c37ad404e23..f6cdbad00daceb5837a8cfcdec37438389aae800 100644 (file)
@@ -2237,7 +2237,7 @@ static int musb_urb_enqueue(
         * Some musb cores don't support high bandwidth ISO transfers; and
         * we don't (yet!) support high bandwidth interrupt transfers.
         */
-       qh->hb_mult = 1 + ((qh->maxpacket >> 11) & 0x03);
+       qh->hb_mult = usb_endpoint_maxp_mult(epd);
        if (qh->hb_mult > 1) {
                int ok = (qh->type == USB_ENDPOINT_XFER_ISOC);