From owner-svn-src-head@FreeBSD.ORG Fri Sep 28 15:24:15 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EA8111065670; Fri, 28 Sep 2012 15:24:14 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D59038FC0A; Fri, 28 Sep 2012 15:24:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q8SFOElf063231; Fri, 28 Sep 2012 15:24:14 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q8SFOECM063229; Fri, 28 Sep 2012 15:24:14 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201209281524.q8SFOECM063229@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 28 Sep 2012 15:24:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r241032 - head/sys/dev/usb/controller X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Sep 2012 15:24:15 -0000 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;