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>
Thu, 29 Apr 2021 07:56:32 +0000 (00:56 -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)
(cherry picked from commit 9d81e87f6fc37b42c28694f3938b1e1c37879904)

drivers/usb/cdns3/gadget.c

index 666eaea..839decd 100644 (file)
@@ -1249,6 +1249,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__,
@@ -1281,6 +1283,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: