aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/plat-iop/gpio.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/plat-iop/gpio.c')
-rw-r--r--arch/arm/plat-iop/gpio.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/arch/arm/plat-iop/gpio.c b/arch/arm/plat-iop/gpio.c
index eda436083417..640e498c12ef 100644
--- a/arch/arm/plat-iop/gpio.c
+++ b/arch/arm/plat-iop/gpio.c
@@ -11,6 +11,10 @@
11 */ 11 */
12 12
13#include <linux/device.h> 13#include <linux/device.h>
14#include <linux/init.h>
15#include <linux/types.h>
16#include <linux/errno.h>
17#include <linux/gpio.h>
14#include <asm/hardware/iop3xx.h> 18#include <asm/hardware/iop3xx.h>
15 19
16void gpio_line_config(int line, int direction) 20void gpio_line_config(int line, int direction)
@@ -46,3 +50,42 @@ void gpio_line_set(int line, int value)
46 local_irq_restore(flags); 50 local_irq_restore(flags);
47} 51}
48EXPORT_SYMBOL(gpio_line_set); 52EXPORT_SYMBOL(gpio_line_set);
53
54static int iop3xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
55{
56 gpio_line_config(gpio, GPIO_IN);
57 return 0;
58}
59
60static int iop3xx_gpio_direction_output(struct gpio_chip *chip, unsigned gpio, int level)
61{
62 gpio_line_set(gpio, level);
63 gpio_line_config(gpio, GPIO_OUT);
64 return 0;
65}
66
67static int iop3xx_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
68{
69 return gpio_line_get(gpio);
70}
71
72static void iop3xx_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value)
73{
74 gpio_line_set(gpio, value);
75}
76
77static struct gpio_chip iop3xx_chip = {
78 .label = "iop3xx",
79 .direction_input = iop3xx_gpio_direction_input,
80 .get = iop3xx_gpio_get_value,
81 .direction_output = iop3xx_gpio_direction_output,
82 .set = iop3xx_gpio_set_value,
83 .base = 0,
84 .ngpio = IOP3XX_N_GPIOS,
85};
86
87static int __init iop3xx_gpio_setup(void)
88{
89 return gpiochip_add(&iop3xx_chip);
90}
91arch_initcall(iop3xx_gpio_setup);