aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpio
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2011-08-22 03:49:07 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2011-08-22 04:13:44 -0400
commit2428835fc6a579b68dde16d37e0b72ca29259c96 (patch)
tree3118e3f4793d2032c0d469f2f4d6e86992918547 /drivers/gpio
parent9c587c05d715ca8461342c2cb3b4a67036b5c22b (diff)
ARM: 7049/1: mach-sa1100: move SA1100 GPIO driver to GPIO subsystem
As per example from the other ARM boards, push the SA100 GPIO driver down to the GPIO subsystem so it can be consolidated. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/Makefile2
-rw-r--r--drivers/gpio/gpio-sa1100.c63
2 files changed, 64 insertions, 1 deletions
diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 33e095bdb65c..84bc7389e367 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -45,7 +45,7 @@ obj-$(CONFIG_GPIO_RDC321X) += gpio-rdc321x.o
45obj-$(CONFIG_GPIO_PLAT_SAMSUNG) += gpio-plat-samsung.o 45obj-$(CONFIG_GPIO_PLAT_SAMSUNG) += gpio-plat-samsung.o
46obj-$(CONFIG_GPIO_S5PC100) += gpio-s5pc100.o 46obj-$(CONFIG_GPIO_S5PC100) += gpio-s5pc100.o
47obj-$(CONFIG_GPIO_S5PV210) += gpio-s5pv210.o 47obj-$(CONFIG_GPIO_S5PV210) += gpio-s5pv210.o
48 48obj-$(CONFIG_ARCH_SA1100) += gpio-sa1100.o
49obj-$(CONFIG_GPIO_SCH) += gpio-sch.o 49obj-$(CONFIG_GPIO_SCH) += gpio-sch.o
50obj-$(CONFIG_GPIO_STMPE) += gpio-stmpe.o 50obj-$(CONFIG_GPIO_STMPE) += gpio-stmpe.o
51obj-$(CONFIG_GPIO_SX150X) += gpio-sx150x.o 51obj-$(CONFIG_GPIO_SX150X) += gpio-sx150x.o
diff --git a/drivers/gpio/gpio-sa1100.c b/drivers/gpio/gpio-sa1100.c
new file mode 100644
index 000000000000..b6c1f6d80649
--- /dev/null
+++ b/drivers/gpio/gpio-sa1100.c
@@ -0,0 +1,63 @@
1/*
2 * linux/arch/arm/mach-sa1100/gpio.c
3 *
4 * Generic SA-1100 GPIO handling
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#include <linux/gpio.h>
11#include <linux/init.h>
12#include <linux/module.h>
13
14#include <mach/hardware.h>
15
16static int sa1100_gpio_get(struct gpio_chip *chip, unsigned offset)
17{
18 return GPLR & GPIO_GPIO(offset);
19}
20
21static void sa1100_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
22{
23 if (value)
24 GPSR = GPIO_GPIO(offset);
25 else
26 GPCR = GPIO_GPIO(offset);
27}
28
29static int sa1100_direction_input(struct gpio_chip *chip, unsigned offset)
30{
31 unsigned long flags;
32
33 local_irq_save(flags);
34 GPDR &= ~GPIO_GPIO(offset);
35 local_irq_restore(flags);
36 return 0;
37}
38
39static int sa1100_direction_output(struct gpio_chip *chip, unsigned offset, int value)
40{
41 unsigned long flags;
42
43 local_irq_save(flags);
44 sa1100_gpio_set(chip, offset, value);
45 GPDR |= GPIO_GPIO(offset);
46 local_irq_restore(flags);
47 return 0;
48}
49
50static struct gpio_chip sa1100_gpio_chip = {
51 .label = "gpio",
52 .direction_input = sa1100_direction_input,
53 .direction_output = sa1100_direction_output,
54 .set = sa1100_gpio_set,
55 .get = sa1100_gpio_get,
56 .base = 0,
57 .ngpio = GPIO_MAX + 1,
58};
59
60void __init sa1100_init_gpio(void)
61{
62 gpiochip_add(&sa1100_gpio_chip);
63}