From owner-svn-src-head@FreeBSD.ORG Fri May 9 16:40:42 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 07346549; Fri, 9 May 2014 16:40:42 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E86CE9A2; Fri, 9 May 2014 16:40:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s49GefFW054743; Fri, 9 May 2014 16:40:41 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s49Gef37054742; Fri, 9 May 2014 16:40:41 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201405091640.s49Gef37054742@svn.freebsd.org> From: Hans Petter Selasky Date: Fri, 9 May 2014 16:40:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r265783 - head/sys/dev/usb/controller X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.18 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, 09 May 2014 16:40:42 -0000 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;