From owner-svn-src-all@freebsd.org Fri Mar 23 11:08:59 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7F6FF606E3; Fri, 23 Mar 2018 11:08:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A6246DDFD; Fri, 23 Mar 2018 11:08:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 60A891F0BD; Fri, 23 Mar 2018 11:08:59 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w2NB8xec035953; Fri, 23 Mar 2018 11:08:59 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w2NB8xdM035952; Fri, 23 Mar 2018 11:08:59 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201803231108.w2NB8xdM035952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 23 Mar 2018 11:08:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r331421 - head/sys/dev/usb/controller X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/usb/controller X-SVN-Commit-Revision: 331421 X-SVN-Commit-Repository: base 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.25 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: Fri, 23 Mar 2018 11:08:59 -0000 Author: andrew Date: Fri Mar 23 11:08:59 2018 New Revision: 331421 URL: https://svnweb.freebsd.org/changeset/base/331421 Log: If sc->sc_ep_max is already set use it to find the number of RX and TX endpoints. The Allwinner driver will need to set this as the EPINFO register isn't useful there. Submitted by: jmcneill Reviewed by: hselasky Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D5881 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 Fri Mar 23 09:42:47 2018 (r331420) +++ head/sys/dev/usb/controller/musb_otg.c Fri Mar 23 11:08:59 2018 (r331421) @@ -3168,19 +3168,24 @@ musbotg_init(struct musbotg_softc *sc) MUSB2_WRITE_1(sc, MUSB2_REG_EPINDEX, 0); - /* read out number of endpoints */ + if (sc->sc_ep_max == 0) { + /* read out number of endpoints */ - nrx = - (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) / 16); + nrx = + (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) / 16); - ntx = - (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) % 16); + ntx = + (MUSB2_READ_1(sc, MUSB2_REG_EPINFO) % 16); + sc->sc_ep_max = (nrx > ntx) ? nrx : ntx; + } else { + nrx = ntx = sc->sc_ep_max; + } + /* these numbers exclude the control endpoint */ DPRINTFN(2, "RX/TX endpoints: %u/%u\n", nrx, ntx); - sc->sc_ep_max = (nrx > ntx) ? nrx : ntx; if (sc->sc_ep_max == 0) { DPRINTFN(2, "ERROR: Looks like the clocks are off!\n"); }