MLK-22577-2: usb: cdns3: Change the max packetsize of interrupt endpoint
authorSherry Sun <sherry.sun@nxp.com>
Mon, 9 Sep 2019 21:14:16 +0000 (17:14 -0400)
committerYe Li <ye.li@nxp.com>
Sun, 29 Sep 2019 08:33:01 +0000 (01:33 -0700)
When use ep1out interrupt endpoint to receive data in sdp, the max
packetsize of ep1out is set to 1024. But in cdns3 gadget driver, the
max packetsize is limited to 512 bytes in high speed. So we can't
implement data download through ep1out of cdns3 driver, here need
change the max packesize of interrupt endpoints to 1024.

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 17f321b4a32cfaac52339172dc354729e641451a)

drivers/usb/cdns3/gadget.c

index 0a439c6..1b00155 100644 (file)
@@ -1392,6 +1392,8 @@ static void cdns_ep_config(struct usb_ss_endpoint *usb_ss_ep)
        u32 bEndpointAddress = usb_ss_ep->num | usb_ss_ep->dir;
        u32 interrupt_mask = 0;
        bool is_iso_ep = (usb_ss_ep->type == USB_ENDPOINT_XFER_ISOC);
+       __maybe_unused bool is_int_ep =
+                       (usb_ss_ep->type == USB_ENDPOINT_XFER_INT);
 
        dev_dbg(&usb_ss->dev, "%s: %s addr=0x%x, speed %d, is_iso_ep %d\n", __func__,
                        usb_ss_ep->name, bEndpointAddress, usb_ss->gadget.speed, is_iso_ep);
@@ -1422,6 +1424,10 @@ static void cdns_ep_config(struct usb_ss_endpoint *usb_ss_ep)
                max_packet_size = (is_iso_ep ?
                        ENDPOINT_MAX_PACKET_SIZE_1024 :
                        ENDPOINT_MAX_PACKET_SIZE_512);
+#if defined(CONFIG_SPL_USB_SDP_SUPPORT) || defined(CONFIG_USB_FUNCTION_SDP)
+               if (is_int_ep)
+                       max_packet_size = ENDPOINT_MAX_PACKET_SIZE_1024;
+#endif
                break;
 
        case USB_SPEED_WIRELESS: