]> Zhao Yanbai Git Server - minix.git/commitdiff
Make MUSB use 'interval' for bulk transfers
authorWojciech Zajac <wzajac@jpembedded.eu>
Mon, 23 Jun 2014 10:59:39 +0000 (12:59 +0200)
committerLionel Sambuc <lionel@minix3.org>
Mon, 28 Jul 2014 15:05:54 +0000 (17:05 +0200)
drivers/usbd/hcd/hcd.c
drivers/usbd/hcd/musb/musb_core.c
drivers/usbd/hcd/musb/musb_regs.h

index 934e2e2e816f3a67891628e2aa378ae841a68988..20339c63ee53163d9a821a81e672432b0d6f05be 100755 (executable)
@@ -605,6 +605,12 @@ hcd_non_control_urb(hcd_device_state * this_device, hcd_urb * urb)
                return EXIT_FAILURE;
        }
 
+       /* Check if remembered interval matches */
+       if ((hcd_reg1)e->descriptor.bInterval != urb->interval) {
+               USB_MSG("EP interval mismatch");
+               return EXIT_FAILURE;
+       }
+
        /* Assign URB values to data request structure */
        request.type = urb->type;
        request.endpoint = urb->endpoint;
index cc05066fa3586489514b0a6eab71c41e9026a1af..2b6c61da3c5a08ccaa9a978eedf177318f6d7384 100755 (executable)
@@ -503,12 +503,8 @@ musb_rx_stage(void * cfg, hcd_datarequest * request)
        /* Rewrite RXMAXP */
        HCD_WR2(r, MUSB_REG_RXMAXP, request->max_packet_size);
 
-       /* Set HOST_RXINTERVAL based on transfer type */
-       if (HCD_TRANSFER_BULK == request->type)
-               HCD_WR1(r, MUSB_REG_HOST_RXINTERVAL,
-                       MUSB_VAL_HOST_XXINTERVAL_DEFAULT);
-       else if (HCD_TRANSFER_INTERRUPT == request->type)
-               HCD_WR1(r, MUSB_REG_HOST_RXINTERVAL, request->interval);
+       /* Set HOST_RXINTERVAL (which means interval or NAK limit) */
+       HCD_WR1(r, MUSB_REG_HOST_RXINTERVAL, request->interval);
 
 #if 0
        {
@@ -597,12 +593,8 @@ musb_tx_stage(void * cfg, hcd_datarequest * request)
        /* Rewrite TXMAXP */
        HCD_WR2(r, MUSB_REG_TXMAXP, request->max_packet_size);
 
-       /* Set HOST_TXINTERVAL based on transfer type */
-       if (HCD_TRANSFER_BULK == request->type)
-               HCD_WR1(r, MUSB_REG_HOST_TXINTERVAL,
-                       MUSB_VAL_HOST_XXINTERVAL_DEFAULT);
-       else if (HCD_TRANSFER_INTERRUPT == request->type)
-               HCD_WR1(r, MUSB_REG_HOST_TXINTERVAL, request->interval);
+       /* Set HOST_TXINTERVAL (which means interval or NAK limit) */
+       HCD_WR1(r, MUSB_REG_HOST_TXINTERVAL, request->interval);
 
 #if 0
        {
index e0ac4a847513bcc6f6e9c9fce4b4cf4e19658d68..02028a0f5ce9655f43a900df5c8cb70caefc7ca9 100755 (executable)
                                                 HCD_BIT(2) |           \
                                                 HCD_BIT(3))
 
-/* HOST_RXINTERVAL/HOST_TXINTERVAL */
-/* Default NAK limit for non-control transfer
- * When too big this may cause driver to wait for
- * quite long in case of NAK error */
-#define MUSB_VAL_HOST_XXINTERVAL_DEFAULT       0x10u
-
 /* HOST_RXCSR */
 #define MUSB_VAL_HOST_RXCSR_RXPKTRDY           HCD_BIT(0)
 #define MUSB_VAL_HOST_RXCSR_FIFOFULL           HCD_BIT(1)