diff options
Diffstat (limited to 'arch/m68k/platform/coldfire/gpio.c')
-rw-r--r-- | arch/m68k/platform/coldfire/gpio.c | 34 |
1 files changed, 23 insertions, 11 deletions
diff --git a/arch/m68k/platform/coldfire/gpio.c b/arch/m68k/platform/coldfire/gpio.c index 9cd2b5c..e7e4286 100644 --- a/arch/m68k/platform/coldfire/gpio.c +++ b/arch/m68k/platform/coldfire/gpio.c @@ -76,10 +76,7 @@ int __mcfgpio_direction_output(unsigned gpio, int value) local_irq_save(flags); data = mcfgpio_read(__mcfgpio_pddr(gpio)); - if (value) - data |= mcfgpio_bit(gpio); - else - data &= mcfgpio_bit(gpio); + data |= mcfgpio_bit(gpio); mcfgpio_write(data, __mcfgpio_pddr(gpio)); /* now set the data to output */ @@ -117,37 +114,51 @@ EXPORT_SYMBOL(__mcfgpio_free); #ifdef CONFIG_GPIOLIB -int mcfgpio_direction_input(struct gpio_chip *chip, unsigned offset) +static int mcfgpio_direction_input(struct gpio_chip *chip, unsigned offset) { return __mcfgpio_direction_input(offset); } -int mcfgpio_get_value(struct gpio_chip *chip, unsigned offset) +static int mcfgpio_get_value(struct gpio_chip *chip, unsigned offset) { return __mcfgpio_get_value(offset); } -int mcfgpio_direction_output(struct gpio_chip *chip, unsigned offset, int value) +static int mcfgpio_direction_output(struct gpio_chip *chip, unsigned offset, + int value) { return __mcfgpio_direction_output(offset, value); } -void mcfgpio_set_value(struct gpio_chip *chip, unsigned offset, int value) +static void mcfgpio_set_value(struct gpio_chip *chip, unsigned offset, + int value) { __mcfgpio_set_value(offset, value); } -int mcfgpio_request(struct gpio_chip *chip, unsigned offset) +static int mcfgpio_request(struct gpio_chip *chip, unsigned offset) { return __mcfgpio_request(offset); } -void mcfgpio_free(struct gpio_chip *chip, unsigned offset) +static void mcfgpio_free(struct gpio_chip *chip, unsigned offset) { __mcfgpio_free(offset); } -struct bus_type mcfgpio_subsys = { +static int mcfgpio_to_irq(struct gpio_chip *chip, unsigned offset) +{ +#if defined(MCFGPIO_IRQ_MIN) + if ((offset >= MCFGPIO_IRQ_MIN) && (offset < MCFGPIO_IRQ_MAX)) +#else + if (offset < MCFGPIO_IRQ_MAX) +#endif + return MCFGPIO_IRQ_VECBASE + offset; + else + return -EINVAL; +} + +static struct bus_type mcfgpio_subsys = { .name = "gpio", .dev_name = "gpio", }; @@ -160,6 +171,7 @@ static struct gpio_chip mcfgpio_chip = { .direction_output = mcfgpio_direction_output, .get = mcfgpio_get_value, .set = mcfgpio_set_value, + .to_irq = mcfgpio_to_irq, .base = 0, .ngpio = MCFGPIO_PIN_MAX, }; |