diff --git a/arch/mips/include/asm/mach-loongson/gpio.h b/arch/mips/include/asm/mach-loongson/gpio.h index 0fd06bf..a27c003 100644 --- a/arch/mips/include/asm/mach-loongson/gpio.h +++ b/arch/mips/include/asm/mach-loongson/gpio.h @@ -14,7 +14,11 @@ #define __STLS2F_GPIO_H #ifdef CONFIG_GENERIC_GPIO +#ifdef CONFIG_DEXXON_GDIUM +#define ARCH_NR_GPIOS 256 +#else #define ARCH_NR_GPIOS 4 +#endif #include extern void gpio_set_value(unsigned gpio, int value); diff --git a/arch/mips/loongson/common/gpio.c b/arch/mips/loongson/common/gpio.c index a8645f8..e8a0ffa 100644 --- a/arch/mips/loongson/common/gpio.c +++ b/arch/mips/loongson/common/gpio.c @@ -19,6 +19,7 @@ #include #include +#define STLS2F_N_GPIO 4 #define STLS2F_GPIO_IN_OFFSET 16 static DEFINE_SPINLOCK(gpio_lock); @@ -28,7 +29,7 @@ int gpio_get_value(unsigned gpio) u32 val; u32 mask; - if (gpio >= ARCH_NR_GPIOS) + if (gpio >= STLS2F_N_GPIO) return __gpio_get_value(gpio); mask = 1 << (gpio + STLS2F_GPIO_IN_OFFSET); @@ -45,7 +46,7 @@ void gpio_set_value(unsigned gpio, int state) u32 val; u32 mask; - if (gpio >= ARCH_NR_GPIOS) { + if (gpio >= STLS2F_N_GPIO) { __gpio_set_value(gpio, state); return ; } @@ -65,7 +66,7 @@ EXPORT_SYMBOL(gpio_set_value); int gpio_cansleep(unsigned gpio) { - if (gpio < ARCH_NR_GPIOS) + if (gpio < STLS2F_N_GPIO) return 0; else return __gpio_cansleep(gpio); @@ -77,7 +78,7 @@ static int ls2f_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) u32 temp; u32 mask; - if (gpio >= ARCH_NR_GPIOS) + if (gpio >= STLS2F_N_GPIO) return -EINVAL; spin_lock(&gpio_lock); @@ -96,7 +97,7 @@ static int ls2f_gpio_direction_output(struct gpio_chip *chip, u32 temp; u32 mask; - if (gpio >= ARCH_NR_GPIOS) + if (gpio >= STLS2F_N_GPIO) return -EINVAL; gpio_set_value(gpio, level); @@ -128,7 +129,7 @@ static struct gpio_chip ls2f_chip = { .direction_output = ls2f_gpio_direction_output, .set = ls2f_gpio_set_value, .base = 0, - .ngpio = ARCH_NR_GPIOS, + .ngpio = STLS2F_N_GPIO, }; static int __init ls2f_gpio_setup(void)