diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2008-09-12 12:41:29 +0000 |
---|---|---|
committer | Gabor Juhos <juhosg@openwrt.org> | 2008-09-12 12:41:29 +0000 |
commit | 1abbb27f865a841a42f6f60db34d592c1a23c31a (patch) | |
tree | be340ef61a74c7095cefe34c155fb49930938c60 /target/linux/adm5120/files-2.6.26/include/asm-mips | |
parent | 3601e8b9bb576ca62b99442b7d5c436705fbb521 (diff) | |
download | upstream-1abbb27f865a841a42f6f60db34d592c1a23c31a.tar.gz upstream-1abbb27f865a841a42f6f60db34d592c1a23c31a.tar.bz2 upstream-1abbb27f865a841a42f6f60db34d592c1a23c31a.zip |
convert to GPIOLIB
SVN-Revision: 12571
Diffstat (limited to 'target/linux/adm5120/files-2.6.26/include/asm-mips')
-rw-r--r-- | target/linux/adm5120/files-2.6.26/include/asm-mips/mach-adm5120/gpio.h | 77 |
1 files changed, 40 insertions, 37 deletions
diff --git a/target/linux/adm5120/files-2.6.26/include/asm-mips/mach-adm5120/gpio.h b/target/linux/adm5120/files-2.6.26/include/asm-mips/mach-adm5120/gpio.h index 6007693d76..7ba7efca1f 100644 --- a/target/linux/adm5120/files-2.6.26/include/asm-mips/mach-adm5120/gpio.h +++ b/target/linux/adm5120/files-2.6.26/include/asm-mips/mach-adm5120/gpio.h @@ -9,8 +9,12 @@ * */ -#ifndef _ASM_MACH_ADM5120_GPIO_H -#define _ASM_MACH_ADM5120_GPIO_H +#ifndef _ASM_MIPS_MACH_ADM5120_GPIO_H +#define _ASM_MIPS_MACH_ADM5120_GPIO_H + +#define ARCH_NR_GPIOS 64 + +#include <asm-generic/gpio.h> #include <asm/mach-adm5120/adm5120_switch.h> @@ -55,46 +59,45 @@ #define ADM5120_GPIO_10M_ACT (ADM5120_GPIO_SWITCH | LED_MODE_10M_ACT) #define ADM5120_GPIO_100M_ACT (ADM5120_GPIO_SWITCH | LED_MODE_100M_ACT) -extern int adm5120_gpio_direction_input(unsigned gpio); -extern int adm5120_gpio_direction_output(unsigned gpio, int value); -extern int adm5120_gpio_get_value(unsigned gpio); -extern void adm5120_gpio_set_value(unsigned gpio, int value); -extern int adm5120_gpio_request(unsigned gpio, const char *label); -extern void adm5120_gpio_free(unsigned gpio); -extern int adm5120_gpio_to_irq(unsigned gpio); -extern int adm5120_irq_to_gpio(unsigned irq); - -/* - * Wrappers for the generic GPIO layer - */ -static inline int gpio_direction_input(unsigned gpio) -{ - return adm5120_gpio_direction_input(gpio); -} - -static inline int gpio_direction_output(unsigned gpio, int value) -{ - return adm5120_gpio_direction_output(gpio,value); -} +extern int __adm5120_gpio0_get_value(unsigned gpio); +extern void __adm5120_gpio0_set_value(unsigned gpio, int value); +extern int __adm5120_gpio1_get_value(unsigned gpio); +extern void __adm5120_gpio1_set_value(unsigned gpio, int value); +extern int adm5120_gpio_to_irq(unsigned gpio); +extern int adm5120_irq_to_gpio(unsigned irq); static inline int gpio_get_value(unsigned gpio) { - return adm5120_gpio_get_value(gpio); + int ret; + + switch (gpio) { + case ADM5120_GPIO_PIN0 ... ADM5120_GPIO_PIN7: + ret = __adm5120_gpio0_get_value(gpio); + break; + case ADM5120_GPIO_P0L0 ... ADM5120_GPIO_P4L2: + ret = __adm5120_gpio1_get_value(gpio - ADM5120_GPIO_P0L0); + break; + default: + ret = __gpio_get_value(gpio); + break; + } + + return ret; } static inline void gpio_set_value(unsigned gpio, int value) { - adm5120_gpio_set_value(gpio, value); -} - -static inline int gpio_request(unsigned gpio, const char *label) -{ - return adm5120_gpio_request(gpio, label); -} - -static inline void gpio_free(unsigned gpio) -{ - adm5120_gpio_free(gpio); + switch (gpio) { + case ADM5120_GPIO_PIN0 ... ADM5120_GPIO_PIN7: + __adm5120_gpio0_set_value(gpio, value); + break; + case ADM5120_GPIO_P0L0 ... ADM5120_GPIO_P4L2: + __adm5120_gpio1_set_value(gpio - ADM5120_GPIO_P0L0, value); + break; + default: + __gpio_set_value(gpio, value); + break; + } } static inline int gpio_to_irq(unsigned gpio) @@ -107,6 +110,6 @@ static inline int irq_to_gpio(unsigned irq) return adm5120_irq_to_gpio(irq); } -#include <asm-generic/gpio.h> /* cansleep wrappers */ +#define gpio_cansleep __gpio_cansleep -#endif /* _ASM_MACH_ADM5120_GPIO_H */ +#endif /* _ASM_MIPS_MACH_ADM5120_GPIO_H */ |