diff options
author | Ben Dooks <ben-linux@fluff.org> | 2008-07-15 15:19:14 -0400 |
---|---|---|
committer | Ben Dooks <ben-linux@fluff.org> | 2008-07-15 15:19:14 -0400 |
commit | 0c17e4ceedd35c78b1c7413dbd16279a350be6bc (patch) | |
tree | 313b3b9ca04727f3704464e01d8dd97da1dd534b /arch/arm/plat-iop | |
parent | 19c1d6a34abf73d0baf8e325d018c920fa78dddc (diff) | |
parent | b9d2252c1e44fa83a4e65fdc9eb93db6297c55af (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-rmk
Diffstat (limited to 'arch/arm/plat-iop')
-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); | ||