aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/adm5120-2.6/files/arch/mips
diff options
context:
space:
mode:
authorGabor Juhos <juhosg@openwrt.org>2007-08-06 17:25:49 +0000
committerGabor Juhos <juhosg@openwrt.org>2007-08-06 17:25:49 +0000
commitfe1b8fca48a3717d25d7d7d39740a2a59bccc137 (patch)
tree8e5985780160e97e96e26a586d04630687ebdb74 /target/linux/adm5120-2.6/files/arch/mips
parent216eb4e8b096c1af825d6b81c1e9398ae1e3706f (diff)
downloadupstream-fe1b8fca48a3717d25d7d7d39740a2a59bccc137.tar.gz
upstream-fe1b8fca48a3717d25d7d7d39740a2a59bccc137.tar.bz2
upstream-fe1b8fca48a3717d25d7d7d39740a2a59bccc137.zip
add special values for GPIO lines in switch
SVN-Revision: 8351
Diffstat (limited to 'target/linux/adm5120-2.6/files/arch/mips')
-rw-r--r--target/linux/adm5120-2.6/files/arch/mips/adm5120/gpio.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/gpio.c b/target/linux/adm5120-2.6/files/arch/mips/adm5120/gpio.c
index 1fac84bb53..41299a9a5e 100644
--- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/gpio.c
+++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/gpio.c
@@ -204,10 +204,27 @@ static inline int leds_direction_output(unsigned led, int value)
t = GPIO_READ(reg);
t &= ~(LED_MODE_MASK << s);
- if (value)
- t |= (LED_MODE_OUT_HIGH << s);
- else
+
+ switch (value) {
+ case ADM5120_GPIO_LOW:
t |= (LED_MODE_OUT_LOW << s);
+ break;
+ case ADM5120_GPIO_FLASH:
+ case ADM5120_GPIO_LINK:
+ case ADM5120_GPIO_SPEED:
+ case ADM5120_GPIO_DUPLEX:
+ case ADM5120_GPIO_ACT:
+ case ADM5120_GPIO_COLL:
+ case ADM5120_GPIO_LINK_ACT:
+ case ADM5120_GPIO_DUPLEX_COLL:
+ case ADM5120_GPIO_10M_ACT:
+ case ADM5120_GPIO_100M_ACT:
+ t |= ((value & LED_MODE_MASK) << s);
+ break;
+ default:
+ t |= (LED_MODE_OUT_HIGH << s);
+ break;
+ }
GPIO_WRITE(t,reg);
@@ -232,24 +249,6 @@ static inline int leds_get_value(unsigned led)
return 1;
}
-static inline void leds_set_value(unsigned led, int value)
-{
- gpio_reg_t *reg;
- u32 s,t;
-
- reg = led_table[led].reg;
- s = led_table[led].mode_shift;
-
- t = GPIO_READ(reg);
- t &= ~(LED_MODE_MASK << s);
- if (value)
- t |= (LED_MODE_OUT_HIGH << s);
- else
- t |= (LED_MODE_OUT_LOW << s);
-
- GPIO_WRITE(t,reg);
-}
-
/*
* Main GPIO support routines
*/
@@ -294,7 +293,7 @@ void adm5120_gpio_set_value(unsigned gpio, int value)
}
gpio -= ADM5120_GPIO_P0L0;
- leds_set_value(gpio, value);
+ leds_direction_output(gpio, value);
}
int adm5120_gpio_request(unsigned gpio, const char *label)