Author: hselasky
Date: Fri Sep 28 15:24:14 2012
New Revision: 241032
URL: http://svn.freebsd.org/changeset/base/241032

Log:
  Correct NYET handling. Remove superfluous transfer complete interrupt mask.

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 Sep 28 13:50:37 2012        
(r241031)
+++ head/sys/dev/usb/controller/dwc_otg.c       Fri Sep 28 15:24:14 2012        
(r241032)
@@ -222,7 +222,7 @@ dwc_otg_init_fifo(struct dwc_otg_softc *
                        /* enable interrupts */
                        DWC_OTG_WRITE_4(sc, DOTG_HCINTMSK(x),
                            HCINT_STALL | HCINT_BBLERR |
-                           HCINT_XACTERR | HCINT_XFERCOMPL |
+                           HCINT_XACTERR |
                            HCINT_NAK | HCINT_ACK | HCINT_NYET |
                            HCINT_CHHLTD | HCINT_FRMOVRUN |
                            HCINT_DATATGLERR);
@@ -524,6 +524,10 @@ dwc_otg_host_channel_wait(struct dwc_otg
        if (x == 0)
                return (0);     /* wait */
 
+       /* assume NAK-ing is next */
+       if (sc->sc_chan_state[x].hcint & HCINT_NYET)
+               return (0);     /* wait */
+
        /* find new disabled channel */
        for (x = 1; x != sc->sc_host_ch_max; x++) {
 
@@ -701,15 +705,6 @@ dwc_otg_host_setup_tx(struct dwc_otg_td 
                }
        }
 
-       /* treat NYET like NAK, if SPLIT transactions are used */
-       if (hcint & HCINT_NYET) {
-               if (td->hcsplt != 0) {
-                       DPRINTF("CH=%d NYET+SPLIT\n", td->channel);
-                       hcint &= ~HCINT_NYET;
-                       hcint |= HCINT_NAK;
-               }
-       }
-
        /* channel must be disabled before we can complete the transfer */
 
        if (hcint & (HCINT_ERRORS | HCINT_RETRY |
@@ -755,13 +750,18 @@ dwc_otg_host_setup_tx(struct dwc_otg_td 
                }
                break;
        case DWC_CHAN_ST_WAIT_C_ANE:
+               if (hcint & HCINT_NYET) {
+                       if (!dwc_otg_host_channel_wait(td))
+                               break;
+                       goto send_cpkt;
+               }
                if (hcint & (HCINT_RETRY | HCINT_ERRORS)) {
                        if (!dwc_otg_host_channel_wait(td))
                                break;
                        td->did_nak = 1;
-                       goto send_cpkt;
+                       goto send_pkt;
                }
-               if (hcint & (HCINT_ACK | HCINT_NYET)) {
+               if (hcint & HCINT_ACK) {
                        if (!dwc_otg_host_channel_wait(td))
                                break;
                        td->offset += td->tx_bytes;
@@ -1043,15 +1043,6 @@ dwc_otg_host_data_rx(struct dwc_otg_td *
                }
        }
 
-       /* treat NYET like NAK, if SPLIT transactions are used */
-       if (hcint & HCINT_NYET) {
-               if (td->hcsplt != 0) {
-                       DPRINTF("CH=%d NYET+SPLIT\n", td->channel);
-                       hcint &= ~HCINT_NYET;
-                       hcint |= HCINT_NAK;
-               }
-       }
-
        /* channel must be disabled before we can complete the transfer */
 
        if (hcint & (HCINT_ERRORS | HCINT_RETRY |
@@ -1136,12 +1127,15 @@ check_state:
                                break;
 
                        td->did_nak = 1;
-
                        if (td->hcsplt != 0)
                                goto receive_spkt;
                        else
                                goto receive_pkt;
                }
+               if (hcint & HCINT_NYET) {
+                       if (td->hcsplt != 0)
+                               goto receive_pkt;
+               }
                if (!(hcint & HCINT_SOFTWARE_ONLY))
                        break;
                if (hcint & (HCINT_ACK | HCINT_NYET)) {
@@ -1171,7 +1165,6 @@ check_state:
                                break;
 
                        td->did_nak = 1;
-
                        goto receive_spkt;
                }
                if (hcint & (HCINT_ACK | HCINT_NYET)) {
@@ -1401,15 +1394,6 @@ dwc_otg_host_data_tx(struct dwc_otg_td *
                }
        }
 
-       /* treat NYET like NAK, if SPLIT transactions are used */
-       if (hcint & HCINT_NYET) {
-               if (td->hcsplt != 0) {
-                       DPRINTF("CH=%d NYET+SPLIT\n", td->channel);
-                       hcint &= ~HCINT_NYET;
-                       hcint |= HCINT_NAK;
-               }
-       }
-
        /* channel must be disabled before we can complete the transfer */
 
        if (hcint & (HCINT_ERRORS | HCINT_RETRY |
@@ -1467,13 +1451,18 @@ dwc_otg_host_data_tx(struct dwc_otg_td *
                }
                break;
        case DWC_CHAN_ST_WAIT_C_ANE:
+               if (hcint & HCINT_NYET) {
+                       if (!dwc_otg_host_channel_wait(td))
+                               break;
+                       goto send_cpkt;
+               }
                if (hcint & (HCINT_RETRY | HCINT_ERRORS)) {
                        if (!dwc_otg_host_channel_wait(td))
                                break;
                        td->did_nak = 1;
-                       goto send_cpkt;
+                       goto send_pkt;
                }
-               if (hcint & (HCINT_ACK | HCINT_NYET)) {
+               if (hcint & HCINT_ACK) {
                        if (!dwc_otg_host_channel_wait(td))
                                break;
                        td->offset += td->tx_bytes;
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to