svn commit: r247390 - head/sys/arm/ti

Oleksandr Tymoshenko gonzo at FreeBSD.org
Wed Feb 27 08:32:35 UTC 2013


Author: gonzo
Date: Wed Feb 27 08:32:34 2013
New Revision: 247390
URL: http://svnweb.freebsd.org/changeset/base/247390

Log:
  - Initialize GPIO_OE register based on pinmux configuration
  
  Although AM335x TRM states that GPIO_OE register is not used and just
  reflects pads configuration in practice it does control pin behavior
  and shoiuld be set in addition to pinmux setup

Modified:
  head/sys/arm/ti/ti_gpio.c

Modified: head/sys/arm/ti/ti_gpio.c
==============================================================================
--- head/sys/arm/ti/ti_gpio.c	Wed Feb 27 07:34:09 2013	(r247389)
+++ head/sys/arm/ti/ti_gpio.c	Wed Feb 27 08:32:34 2013	(r247390)
@@ -653,6 +653,9 @@ ti_gpio_attach(device_t dev)
 	struct ti_gpio_softc *sc = device_get_softc(dev);
 	unsigned int i;
 	int err = 0;
+	int pin;
+	uint32_t flags;
+	uint32_t reg_oe;
 
 	sc->sc_dev = dev;
 
@@ -720,6 +723,17 @@ ti_gpio_attach(device_t dev)
 			/* Disable interrupts for all pins */
 			ti_gpio_write_4(sc, i, TI_GPIO_CLEARIRQENABLE1, 0xffffffff);
 			ti_gpio_write_4(sc, i, TI_GPIO_CLEARIRQENABLE2, 0xffffffff);
+
+			/* Init OE registger based on pads configuration */
+			reg_oe = 0xffffffff;
+			for (pin = 0; pin < 32; pin++) {
+				ti_scm_padconf_get_gpioflags(
+				    PINS_PER_BANK*i + pin, &flags);
+				if (flags & GPIO_PIN_OUTPUT)
+					reg_oe &= ~(1U << pin);
+			}
+
+			ti_gpio_write_4(sc, i, TI_GPIO_OE, reg_oe);
 		}
 	}
 


More information about the svn-src-all mailing list