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;
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to