Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 9 May 2014 16:40:41 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r265783 - head/sys/dev/usb/controller
Message-ID:  <201405091640.s49Gef37054742@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri May  9 16:40:41 2014
New Revision: 265783
URL: http://svnweb.freebsd.org/changeset/base/265783

Log:
  Fix a regression issue:
  - ACK can be received before data arrives in RX FIFO. Handle this.
  - Remove obsolete comment.
  - Some minor code styling.
  
  MFC after:	2 weeks

Modified:
  head/sys/dev/usb/controller/dwc_otg.c

Modified: head/sys/dev/usb/controller/dwc_otg.c
==============================================================================
--- head/sys/dev/usb/controller/dwc_otg.c	Fri May  9 16:20:55 2014	(r265782)
+++ head/sys/dev/usb/controller/dwc_otg.c	Fri May  9 16:40:41 2014	(r265783)
@@ -1240,6 +1240,10 @@ check_state:
 				goto complete;
 			}
 		} else if (hcint & HCINT_ACK) {
+			/* wait for data - ACK arrived first */
+			if (!(hcint & HCINT_SOFTWARE_ONLY))
+				goto busy;
+
 			if (td->ep_type == UE_ISOCHRONOUS) {
 				/* check if we are complete */
 				if ((td->remainder == 0) ||
@@ -1595,8 +1599,6 @@ dwc_otg_host_data_tx(struct dwc_otg_td *
 		}
 	}
 
-	/* channel must be disabled before we can complete the transfer */
-
 	if (hcint & (HCINT_ERRORS | HCINT_RETRY |
 	    HCINT_ACK | HCINT_NYET)) {
 
@@ -1646,15 +1648,13 @@ check_state:
 		break;
 
 	case DWC_CHAN_ST_WAIT_C_ANE:
-		if (hcint & HCINT_NYET)
+		if (hcint & HCINT_NYET) {
 			goto send_cpkt;
-
-		if (hcint & (HCINT_RETRY | HCINT_ERRORS)) {
+		} else if (hcint & (HCINT_RETRY | HCINT_ERRORS)) {
 			td->did_nak = 1;
 			td->tt_scheduled = 0;
 			goto send_pkt;
-		}
-		if (hcint & HCINT_ACK) {
+		} else if (hcint & HCINT_ACK) {
 			td->offset += td->tx_bytes;
 			td->remainder -= td->tx_bytes;
 			td->toggle ^= 1;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405091640.s49Gef37054742>