From: Wojciech Zajac Date: Mon, 23 Jun 2014 10:59:39 +0000 (+0200) Subject: Make MUSB use 'interval' for bulk transfers X-Git-Tag: v3.3.0~181 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/named-checkconf.html?a=commitdiff_plain;h=e858b9b5e905be8db8141a09e13dc93c40ea981c;p=minix.git Make MUSB use 'interval' for bulk transfers --- diff --git a/drivers/usbd/hcd/hcd.c b/drivers/usbd/hcd/hcd.c index 934e2e2e8..20339c63e 100755 --- a/drivers/usbd/hcd/hcd.c +++ b/drivers/usbd/hcd/hcd.c @@ -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; diff --git a/drivers/usbd/hcd/musb/musb_core.c b/drivers/usbd/hcd/musb/musb_core.c index cc05066fa..2b6c61da3 100755 --- a/drivers/usbd/hcd/musb/musb_core.c +++ b/drivers/usbd/hcd/musb/musb_core.c @@ -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 { diff --git a/drivers/usbd/hcd/musb/musb_regs.h b/drivers/usbd/hcd/musb/musb_regs.h index e0ac4a847..02028a0f5 100755 --- a/drivers/usbd/hcd/musb/musb_regs.h +++ b/drivers/usbd/hcd/musb/musb_regs.h @@ -141,12 +141,6 @@ 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)