[Midnightbsd-cvs] src [12250] trunk/sys/dev/usb/controller/dwc_otg.c: Fix for reception of large full speed isochronous frames via the transaction translator.

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Aug 10 10:45:58 EDT 2019


Revision: 12250
          http://svnweb.midnightbsd.org/src/?rev=12250
Author:   laffer1
Date:     2019-08-10 10:45:57 -0400 (Sat, 10 Aug 2019)
Log Message:
-----------
Fix for reception of large full speed isochronous frames via the transaction translator.

Fix retries.

Modified Paths:
--------------
    trunk/sys/dev/usb/controller/dwc_otg.c

Modified: trunk/sys/dev/usb/controller/dwc_otg.c
===================================================================
--- trunk/sys/dev/usb/controller/dwc_otg.c	2019-08-10 14:44:18 UTC (rev 12249)
+++ trunk/sys/dev/usb/controller/dwc_otg.c	2019-08-10 14:45:57 UTC (rev 12250)
@@ -1,5 +1,5 @@
 /* $MidnightBSD$ */
-/* $FreeBSD: stable/10/sys/dev/usb/controller/dwc_otg.c 302563 2016-07-11 13:01:42Z hselasky $ */
+/* $FreeBSD: stable/10/sys/dev/usb/controller/dwc_otg.c 340317 2018-11-10 10:32:55Z hselasky $ */
 /*-
  * Copyright (c) 2015 Daisuke Aoyama. All rights reserved.
  * Copyright (c) 2012-2015 Hans Petter Selasky. All rights reserved.
@@ -1436,6 +1436,19 @@
 					goto receive_pkt;
 				}
 			} else if (td->ep_type == UE_ISOCHRONOUS) {
+				if (td->hcsplt != 0) {
+					/*
+					 * Sometimes the complete
+					 * split packet may be queued
+					 * too early and the
+					 * transaction translator will
+					 * return a NAK. Ignore
+					 * this message and retry the
+					 * complete split instead.
+					 */
+					DPRINTF("Retrying complete split\n");
+					goto receive_pkt;
+				}
 				goto complete;
 			}
 			td->did_nak = 1;
@@ -1462,6 +1475,8 @@
 				/* check if we are complete */
 				if (td->tt_xactpos == HCSPLT_XACTPOS_BEGIN) {
 					goto complete;
+				} else if (td->hcsplt != 0) {
+					goto receive_pkt;
 				} else {
 					/* get more packets */
 					goto busy;
@@ -1520,8 +1535,10 @@
   	if (td->hcsplt != 0) {
 		delta = td->tt_complete_slot - sc->sc_last_frame_num - 1;
 		if (td->tt_scheduled == 0 || delta < DWC_OTG_TT_SLOT_MAX) {
-			td->state = DWC_CHAN_ST_WAIT_C_PKT;
-			goto busy;
+			if (td->ep_type != UE_ISOCHRONOUS) {
+				td->state = DWC_CHAN_ST_WAIT_C_PKT;
+				goto busy;
+			}
 		}
 		delta = sc->sc_last_frame_num - td->tt_start_slot;
 		if (delta > DWC_OTG_TT_SLOT_MAX) {
@@ -1567,12 +1584,23 @@
 		hcchar = td->hcchar;
 		hcchar |= HCCHAR_EPDIR_IN;
 
-		/* receive complete split ASAP */
-		if ((sc->sc_last_frame_num & 1) != 0 &&
-		    td->ep_type == UE_ISOCHRONOUS)
-			hcchar |= HCCHAR_ODDFRM;
-		else
+		if (td->ep_type == UE_ISOCHRONOUS) {
+			if (td->hcsplt != 0) {
+				/* continously buffer */
+				if (sc->sc_last_frame_num & 1)
+					hcchar &= ~HCCHAR_ODDFRM;
+				else
+					hcchar |= HCCHAR_ODDFRM;
+			} else {
+				/* multi buffer, if any */
+				if (sc->sc_last_frame_num & 1)
+					hcchar |= HCCHAR_ODDFRM;
+				else
+					hcchar &= ~HCCHAR_ODDFRM;
+			}
+		} else {
 			hcchar &= ~HCCHAR_ODDFRM;
+		}
 
 		/* must enable channel before data can be received */
 		DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(channel), hcchar);



More information about the Midnightbsd-cvs mailing list