[Zrouter-src-freebsd] ZRouter.org: push to FreeBSD HEAD tree

zrouter-src-freebsd at zrouter.org zrouter-src-freebsd at zrouter.org
Fri Feb 3 15:30:58 UTC 2012


details:   http://zrouter.org/hg/FreeBSD/head//rev/50c9e3c9e7d2
changeset: 333:50c9e3c9e7d2
user:      ray at terran.dlink.ua
date:      Fri Feb 03 17:26:02 2012 +0200
description:
Enable software GPIO_INVOUT bit handling

diffstat:

 head/sys/mips/cavium/octeon_gpio.c |  12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)

diffs (39 lines):

diff -r 5e6a19879249 -r 50c9e3c9e7d2 head/sys/mips/cavium/octeon_gpio.c
--- a/head/sys/mips/cavium/octeon_gpio.c	Wed Feb 01 12:56:16 2012 +0200
+++ b/head/sys/mips/cavium/octeon_gpio.c	Fri Feb 03 17:26:02 2012 +0200
@@ -54,7 +54,8 @@
 
 #include "gpio_if.h"
 
-#define	DEFAULT_CAPS	(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)
+#define	DEFAULT_CAPS	(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | GPIO_PIN_INVIN | \
+    GPIO_PIN_INVOUT)
 
 struct octeon_gpio_pin {
 	const char *name;
@@ -115,10 +116,13 @@
 			pin->gp_flags |= GPIO_PIN_INPUT;
 			gpio_cfgx.s.tx_oe = 0;
 		}
-		if (flags & GPIO_PIN_INVIN)
+		if ((flags & GPIO_PIN_INPUT) && (flags & GPIO_PIN_INVIN))
 			gpio_cfgx.s.rx_xor = 1;
 		else
 			gpio_cfgx.s.rx_xor = 0;
+
+		pin->gp_flags |= flags & (GPIO_PIN_INVIN|GPIO_PIN_INVOUT);
+
 		cvmx_write_csr(CVMX_GPIO_BIT_CFGX(pin->gp_pin), gpio_cfgx.u64);
 	}
 
@@ -237,6 +241,10 @@
 	if (i >= sc->gpio_npins)
 		return (EINVAL);
 
+	/* Handle Invert Output */
+	if (sc->gpio_pins[i].gp_flags & GPIO_PIN_INVOUT)
+		value = (value) ? 0 : 1;
+
 	GPIO_LOCK(sc);
 	if (value)
 		cvmx_gpio_set(1 << pin);


More information about the Zrouter-src-freebsd mailing list