From owner-svn-src-stable-11@freebsd.org Tue Sep 27 16:06:02 2016 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F40EBEC7B1; Tue, 27 Sep 2016 16:06:02 +0000 (UTC) (envelope-from loos@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 mx1.freebsd.org (Postfix) with ESMTPS id 2E0C33EC; Tue, 27 Sep 2016 16:06:02 +0000 (UTC) (envelope-from loos@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u8RG61gj076748; Tue, 27 Sep 2016 16:06:01 GMT (envelope-from loos@FreeBSD.org) Received: (from loos@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u8RG61iP076747; Tue, 27 Sep 2016 16:06:01 GMT (envelope-from loos@FreeBSD.org) Message-Id: <201609271606.u8RG61iP076747@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: loos set sender to loos@FreeBSD.org using -f From: Luiz Otavio O Souza Date: Tue, 27 Sep 2016 16:06:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r306368 - stable/11/sys/arm/ti/am335x X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Sep 2016 16:06:02 -0000 Author: loos Date: Tue Sep 27 16:06:01 2016 New Revision: 306368 URL: https://svnweb.freebsd.org/changeset/base/306368 Log: MFC r306050: If present, honor the USB port mode (host or peripheral) set on DTS, if not, keep the beaglebone defaults: USB0 -> peripheral/gadget, USB1 -> host. This is only a workaround as in fact fact this hardware is capable of detect the USB port mode based on type of cable and act according with the detected mode. Unfortunately the driver does not handle that at moment. Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/sys/arm/ti/am335x/am335x_musb.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/ti/am335x/am335x_musb.c ============================================================================== --- stable/11/sys/arm/ti/am335x/am335x_musb.c Tue Sep 27 13:46:00 2016 (r306367) +++ stable/11/sys/arm/ti/am335x/am335x_musb.c Tue Sep 27 16:06:01 2016 (r306368) @@ -237,6 +237,7 @@ static int musbotg_attach(device_t dev) { struct musbotg_super_softc *sc = device_get_softc(dev); + char mode[16]; int err; uint32_t reg; @@ -308,10 +309,19 @@ musbotg_attach(device_t dev) } sc->sc_otg.sc_platform_data = sc; - if (sc->sc_otg.sc_id == 0) - sc->sc_otg.sc_mode = MUSB2_DEVICE_MODE; - else - sc->sc_otg.sc_mode = MUSB2_HOST_MODE; + if (OF_getprop(ofw_bus_get_node(dev), "dr_mode", mode, + sizeof(mode)) > 0) { + if (strcasecmp(mode, "host") == 0) + sc->sc_otg.sc_mode = MUSB2_HOST_MODE; + else + sc->sc_otg.sc_mode = MUSB2_DEVICE_MODE; + } else { + /* Beaglebone defaults: USB0 device, USB1 HOST. */ + if (sc->sc_otg.sc_id == 0) + sc->sc_otg.sc_mode = MUSB2_DEVICE_MODE; + else + sc->sc_otg.sc_mode = MUSB2_HOST_MODE; + } /* * software-controlled function