summaryrefslogtreecommitdiffstats
path: root/sys/mips
diff options
context:
space:
mode:
authoradrian <adrian@FreeBSD.org>2012-04-20 22:44:00 +0000
committeradrian <adrian@FreeBSD.org>2012-04-20 22:44:00 +0000
commit02336162cdc01550209fb04b5e543777ce6fe70c (patch)
tree8abd39f654e6f28fcc4bc4a4bbf98f4551c96d0b /sys/mips
parent6ad6e04dc4bed223d8545b897162eb2953de8f40 (diff)
downloadFreeBSD-src-02336162cdc01550209fb04b5e543777ce6fe70c.zip
FreeBSD-src-02336162cdc01550209fb04b5e543777ce6fe70c.tar.gz
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 <stb@lassitu.de>
Diffstat (limited to 'sys/mips')
-rw-r--r--sys/mips/atheros/ar71xx_gpio.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/mips/atheros/ar71xx_gpio.c b/sys/mips/atheros/ar71xx_gpio.c
index 592cd2b..9639d1f 100644
--- a/sys/mips/atheros/ar71xx_gpio.c
+++ b/sys/mips/atheros/ar71xx_gpio.c
@@ -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));
OpenPOWER on IntegriCloud