From owner-svn-src-all@FreeBSD.ORG Thu Jan 8 00:11:12 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 8E04B71F; Thu, 8 Jan 2015 00:11:12 +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 5FE1D76F; Thu, 8 Jan 2015 00:11:12 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t080BCs8000457; Thu, 8 Jan 2015 00:11:12 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t080BCGg000456; Thu, 8 Jan 2015 00:11:12 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <201501080011.t080BCGg000456@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Thu, 8 Jan 2015 00:11:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r276798 - 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-all@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 08 Jan 2015 00:11:12 -0000 Author: hselasky Date: Thu Jan 8 00:11:11 2015 New Revision: 276798 URL: https://svnweb.freebsd.org/changeset/base/276798 Log: Fix handling of an error case when the MUSB driver is operating in USB device side mode. MFC after: 1 week Reported by: br@ Modified: head/sys/dev/usb/controller/musb_otg.c Modified: head/sys/dev/usb/controller/musb_otg.c ============================================================================== --- head/sys/dev/usb/controller/musb_otg.c Wed Jan 7 22:08:09 2015 (r276797) +++ head/sys/dev/usb/controller/musb_otg.c Thu Jan 8 00:11:11 2015 (r276798) @@ -412,7 +412,7 @@ musbotg_dev_ctrl_setup_rx(struct musbotg /* do not stall at this point */ td->did_stall = 1; /* wait for interrupt */ - DPRINTFN(0, "CSR0 DATAEND\n"); + DPRINTFN(1, "CSR0 DATAEND\n"); goto not_complete; } @@ -434,32 +434,37 @@ musbotg_dev_ctrl_setup_rx(struct musbotg sc->sc_ep0_busy = 0; } if (sc->sc_ep0_busy) { - DPRINTFN(0, "EP0 BUSY\n"); + DPRINTFN(1, "EP0 BUSY\n"); goto not_complete; } if (!(csr & MUSB2_MASK_CSR0L_RXPKTRDY)) { goto not_complete; } - /* clear did stall flag */ - td->did_stall = 0; /* get the packet byte count */ count = MUSB2_READ_2(sc, MUSB2_REG_RXCOUNT); /* verify data length */ if (count != td->remainder) { - DPRINTFN(0, "Invalid SETUP packet " + DPRINTFN(1, "Invalid SETUP packet " "length, %d bytes\n", count); MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, MUSB2_MASK_CSR0L_RXPKTRDY_CLR); + /* don't clear stall */ + td->did_stall = 1; goto not_complete; } if (count != sizeof(req)) { - DPRINTFN(0, "Unsupported SETUP packet " + DPRINTFN(1, "Unsupported SETUP packet " "length, %d bytes\n", count); MUSB2_WRITE_1(sc, MUSB2_REG_TXCSRL, MUSB2_MASK_CSR0L_RXPKTRDY_CLR); + /* don't clear stall */ + td->did_stall = 1; goto not_complete; } + /* clear did stall flag */ + td->did_stall = 0; + /* receive data */ bus_space_read_multi_1(sc->sc_io_tag, sc->sc_io_hdl, MUSB2_REG_EPFIFO(0), (void *)&req, sizeof(req));