aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2008-04-13 10:47:13 +0000
committerGabor Juhos <juhosg@openwrt.org>2008-04-13 10:47:13 +0000
commit96348cd4e62da2e4d92a41dbce782c5d0595ae3a (patch)
tree884d475392b665ebcf227c5805fd0e9d3cb3fe66
parent90d64af430a0a2a23ae81d5aff01537f662ba6ee (diff)
downloadupstream-96348cd4e62da2e4d92a41dbce782c5d0595ae3a.tar.gz
upstream-96348cd4e62da2e4d92a41dbce782c5d0595ae3a.tar.bz2
upstream-96348cd4e62da2e4d92a41dbce782c5d0595ae3a.zip
[atheros] fix GPIO direction setup on ar5312, and fix compiler warnings
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@10811 3c298f89-4303-0410-b956-a3cf2f4a3e73
-rw-r--r--target/linux/atheros/files/include/asm-mips/mach-atheros/gpio.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/target/linux/atheros/files/include/asm-mips/mach-atheros/gpio.h b/target/linux/atheros/files/include/asm-mips/mach-atheros/gpio.h
index 560b8cc0dc..db7347c221 100644
--- a/target/linux/atheros/files/include/asm-mips/mach-atheros/gpio.h
+++ b/target/linux/atheros/files/include/asm-mips/mach-atheros/gpio.h
@@ -26,9 +26,8 @@ static inline int gpio_direction_input(unsigned gpio) {
return -ENXIO; \
} else { \
sysRegWrite(AR531X_GPIO_CR, \
- ( sysRegRead(AR531X_GPIO_CR) & \
- ~(AR531X_GPIO_CR_M(gpio)) ) | \
- AR531X_GPIO_CR_I(gpio) ); \
+ sysRegRead(AR531X_GPIO_CR) | \
+ AR531X_GPIO_CR_I(gpio) ); \
return 0; \
} \
)
@@ -42,6 +41,7 @@ static inline int gpio_direction_input(unsigned gpio) {
return 0; \
} \
)
+ return -ENXIO;
}
/* Sets a gpio to output with value, or returns ENXIO for non-existent gpio */
@@ -54,8 +54,8 @@ static inline int gpio_direction_output(unsigned gpio, int value) {
~(1 << gpio) ) | \
((value!=0) << gpio)) ); \
sysRegWrite(AR531X_GPIO_CR, \
- sysRegRead(AR531X_GPIO_CR) | \
- AR531X_GPIO_CR_O(gpio) ); \
+ ( sysRegRead(AR531X_GPIO_CR) & \
+ ~(AR531X_GPIO_CR_M(gpio)) )); \
return 0; \
} \
)
@@ -72,12 +72,14 @@ static inline int gpio_direction_output(unsigned gpio, int value) {
return 0; \
} \
)
+ return -ENXIO;
}
/* Reads the gpio pin. Unchecked function */
static inline int gpio_get_value(unsigned gpio) {
DO_AR5312(return (sysRegRead(AR531X_GPIO_DI) & (1 << gpio));)
DO_AR5315(return (sysRegRead(AR5315_GPIO_DI) & (1 << gpio));)
+ return 0;
}
/* Writes to the gpio pin. Unchecked function */