From owner-svn-src-head@FreeBSD.ORG Fri Apr 20 22:44:00 2012 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id D40DF106564A; Fri, 20 Apr 2012 22:44:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BE6A08FC12; Fri, 20 Apr 2012 22:44:00 +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 q3KMi08a059223; Fri, 20 Apr 2012 22:44:00 GMT (envelope-from adrian@svn.freebsd.org) Received: (from adrian@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q3KMi0bd059221; Fri, 20 Apr 2012 22:44:00 GMT (envelope-from adrian@svn.freebsd.org) Message-Id: <201204202244.q3KMi0bd059221@svn.freebsd.org> From: Adrian Chadd Date: Fri, 20 Apr 2012 22:44:00 +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: r234515 - head/sys/mips/atheros 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, 20 Apr 2012 22:44:00 -0000 Author: adrian Date: Fri Apr 20 22:44:00 2012 New Revision: 234515 URL: http://svn.freebsd.org/changeset/base/234515 Log: Allow for a default GPIO pin "high", which is required for some boards which tie the USB device enable to a GPIO line. Submitted by: Stefan Bethke Modified: head/sys/mips/atheros/ar71xx_gpio.c Modified: head/sys/mips/atheros/ar71xx_gpio.c ============================================================================== --- head/sys/mips/atheros/ar71xx_gpio.c Fri Apr 20 22:43:04 2012 (r234514) +++ head/sys/mips/atheros/ar71xx_gpio.c Fri Apr 20 22:44:00 2012 (r234515) @@ -329,7 +329,7 @@ ar71xx_gpio_attach(device_t dev) struct ar71xx_gpio_softc *sc = device_get_softc(dev); int error = 0; int i, j, maxpin; - int mask; + int mask, pinon; int old = 0; KASSERT((device_get_unit(dev) == 0), @@ -394,6 +394,9 @@ ar71xx_gpio_attach(device_t dev) if (resource_int_value(device_get_name(dev), device_get_unit(dev), "pinmask", &mask) != 0) mask = 0; + if (resource_int_value(device_get_name(dev), device_get_unit(dev), + "pinon", &pinon) != 0) + pinon = 0; device_printf(dev, "gpio pinmask=0x%x\n", mask); for (i = 0, j = 0; j < maxpin; j++) { if ((mask & (1 << j)) == 0) @@ -407,6 +410,11 @@ ar71xx_gpio_attach(device_t dev) i++; } sc->gpio_npins = i; + for (i = 0; i < sc->gpio_npins; i++) { + j = sc->gpio_pins[i].gp_pin; + if ((pinon & (1 << j)) != 0) + ar71xx_gpio_pin_set(dev, j, 1); + } device_add_child(dev, "gpioc", device_get_unit(dev)); device_add_child(dev, "gpiobus", device_get_unit(dev)); return (bus_generic_attach(dev));