diff options
author | Arnaud Patard <arnaud.patard@rtp-net.org> | 2008-07-08 18:07:48 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-07-09 18:31:42 -0400 |
commit | 63f385cd1f649b3f4f2d59fc609e051981215fd7 (patch) | |
tree | b0c1d0bf186c701284ba63dda9514cec333037a5 /arch/arm/plat-iop/gpio.c | |
parent | 543cf4cb3fe6f6cae3651ba918b9c56200b257d0 (diff) |
[ARM] 5160/1: IOP3XX: gpio/gpiolib support
This patch brings support for gpio/gpiolib framework to Intel IOP3xx
platforms.
Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/plat-iop/gpio.c')
-rw-r--r-- | arch/arm/plat-iop/gpio.c | 43 |
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 | ||
16 | void gpio_line_config(int line, int direction) | 20 | void 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 | } |
48 | EXPORT_SYMBOL(gpio_line_set); | 52 | EXPORT_SYMBOL(gpio_line_set); |
53 | |||
54 | static int iop3xx_gpio_direction_input(struct gpio_chip *chip, unsigned gpio) | ||
55 | { | ||
56 | gpio_line_config(gpio, GPIO_IN); | ||
57 | return 0; | ||
58 | } | ||
59 | |||
60 | static 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 | |||
67 | static int iop3xx_gpio_get_value(struct gpio_chip *chip, unsigned gpio) | ||
68 | { | ||
69 | return gpio_line_get(gpio); | ||
70 | } | ||
71 | |||
72 | static void iop3xx_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value) | ||
73 | { | ||
74 | gpio_line_set(gpio, value); | ||
75 | } | ||
76 | |||
77 | static 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 | |||
87 | static int __init iop3xx_gpio_setup(void) | ||
88 | { | ||
89 | return gpiochip_add(&iop3xx_chip); | ||
90 | } | ||
91 | arch_initcall(iop3xx_gpio_setup); | ||