From owner-freebsd-usb@FreeBSD.ORG Tue Sep 10 11:40:01 2013 Return-Path: Delivered-To: freebsd-usb@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7E49A8F5 for ; Tue, 10 Sep 2013 11:40:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6B8AF205F for ; Tue, 10 Sep 2013 11:40:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id r8ABe018006443 for ; Tue, 10 Sep 2013 11:40:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id r8ABe0T8006384; Tue, 10 Sep 2013 11:40:00 GMT (envelope-from gnats) Date: Tue, 10 Sep 2013 11:40:00 GMT Message-Id: <201309101140.r8ABe0T8006384@freefall.freebsd.org> To: freebsd-usb@FreeBSD.org Cc: From: SAITOU Toshihide Subject: Re: usb/181987: USB isochronous transfer of the USB driver (Mentor Graphics OTG: musb_otg) is not working. X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: SAITOU Toshihide List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Sep 2013 11:40:01 -0000 The following reply was made to PR usb/181987; it has been noted by GNATS. From: SAITOU Toshihide To: bug-followup@FreeBSD.org Cc: Subject: Re: usb/181987: USB isochronous transfer of the USB driver (Mentor Graphics OTG: musb_otg) is not working. Date: Tue, 10 Sep 2013 20:37:53 +0900 (JST) A missing patch.txt of the previous mail is here: --- musb_otg.c.orig 2013-09-10 19:57:53.000000000 +0900 +++ musb_otg.c 2013-09-10 19:57:53.000000000 +0900 @@ -1689,7 +1689,6 @@ uint16_t count; uint8_t csr, csrh; uint8_t to; - uint8_t got_short; /* get pointer to softc */ sc = MUSBOTG_PC2SC(td->pc); @@ -1704,7 +1703,7 @@ DPRINTFN(1, "ep_no=%d\n", td->channel); to = 8; /* don't loop forever! */ - got_short = 0; + td->short_pkt = 0; /* select endpoint */ MUSB2_WRITE_1(sc, MUSB2_REG_EPINDEX, td->channel); @@ -1726,7 +1725,10 @@ td->hport); /* RX NAK timeout */ - MUSB2_WRITE_1(sc, MUSB2_REG_RXNAKLIMIT, MAX_NAK_TO); + if (td->transfer_type & MUSB2_MASK_TI_PROTO_ISOC) + MUSB2_WRITE_1(sc, MUSB2_REG_RXNAKLIMIT, 0); + else + MUSB2_WRITE_1(sc, MUSB2_REG_RXNAKLIMIT, MAX_NAK_TO); /* Protocol, speed, device endpoint */ MUSB2_WRITE_1(sc, MUSB2_REG_RXTI, td->transfer_type); @@ -1797,11 +1799,10 @@ /* * Check for short or invalid packet: */ - if (count != td->max_frame_size) { + if (count < td->max_frame_size) { if (count < td->max_frame_size) { /* we have a short packet */ td->short_pkt = 1; - got_short = 1; } else { /* invalid USB packet */ td->error = 1; @@ -1884,13 +1885,18 @@ MUSB2_WRITE_1(sc, MUSB2_REG_RXCSRL, 0); /* check if we are complete */ - if ((td->remainder == 0) || got_short) { - if (td->short_pkt) { - /* we are complete */ - musbotg_channel_free(sc, td); - return (0); - } - /* else need to receive a zero length packet */ + if (td->remainder == 0 || td->short_pkt) { + /* we are complete */ + musbotg_channel_free(sc, td); + return (0); + } + + else if (td->transfer_type & MUSB2_MASK_TI_PROTO_ISOC) { + if (td->remainder != 0) { + /* not short_pkt and now getting DATA2 or DATA1 */ + td->transaction_started = 0; + return (1); + } } /* Reset transaction state and restart */ @@ -3159,9 +3165,9 @@ if (dynfifo) { if (frx && (temp <= nrx)) { if (temp < 8) { - frx = 10; /* 1K */ + frx = 12; /* 4K */ MUSB2_WRITE_1(sc, MUSB2_REG_RXFIFOSZ, - MUSB2_VAL_FIFOSZ_512 | + MUSB2_VAL_FIFOSZ_4096 | MUSB2_MASK_FIFODB); } else { frx = 7; /* 128 bytes */ @@ -4042,7 +4048,7 @@ * reasonable dummies: */ parm->hc_max_packet_size = 0x400; - parm->hc_max_frame_size = 0x400; + parm->hc_max_frame_size = 0xc00; if ((parm->methods == &musbotg_device_isoc_methods) || (parm->methods == &musbotg_device_intr_methods)) @@ -4116,7 +4122,10 @@ td = USB_ADD_BYTES(parm->buf, parm->size[0]); /* init TD */ - td->max_frame_size = xfer->max_frame_size; + if (parm->methods == &musbotg_device_isoc_methods) + td->max_frame_size = xfer->max_frame_size/3; + else + td->max_frame_size = xfer->max_frame_size; td->ep_no = ep_no; td->obj_next = last_obj;