aboutsummaryrefslogtreecommitdiffstats
path: root/arch
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 /arch
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 'arch')
-rw-r--r--arch/arm/mach-sa1100/Makefile2
-rw-r--r--arch/arm/mach-sa1100/gpio.c64
2 files changed, 1 insertions, 65 deletions
diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile
index 41252d22e659..73a5c6431792 100644
--- a/arch/arm/mach-sa1100/Makefile
+++ b/arch/arm/mach-sa1100/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := clock.o generic.o gpio.o irq.o dma.o time.o #nmi-oopser.o 6obj-y := clock.o generic.o irq.o dma.o time.o #nmi-oopser.o
7obj-m := 7obj-m :=
8obj-n := 8obj-n :=
9obj- := 9obj- :=
diff --git a/arch/arm/mach-sa1100/gpio.c b/arch/arm/mach-sa1100/gpio.c
deleted file mode 100644
index e547ed41ec6b..000000000000
--- a/arch/arm/mach-sa1100/gpio.c
+++ /dev/null
@@ -1,64 +0,0 @@
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#include "generic.h"
16
17static int sa1100_gpio_get(struct gpio_chip *chip, unsigned offset)
18{
19 return GPLR & GPIO_GPIO(offset);
20}
21
22static void sa1100_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
23{
24 if (value)
25 GPSR = GPIO_GPIO(offset);
26 else
27 GPCR = GPIO_GPIO(offset);
28}
29
30static int sa1100_direction_input(struct gpio_chip *chip, unsigned offset)
31{
32 unsigned long flags;
33
34 local_irq_save(flags);
35 GPDR &= ~GPIO_GPIO(offset);
36 local_irq_restore(flags);
37 return 0;
38}
39
40static int sa1100_direction_output(struct gpio_chip *chip, unsigned offset, int value)
41{
42 unsigned long flags;
43
44 local_irq_save(flags);
45 sa1100_gpio_set(chip, offset, value);
46 GPDR |= GPIO_GPIO(offset);
47 local_irq_restore(flags);
48 return 0;
49}
50
51static struct gpio_chip sa1100_gpio_chip = {
52 .label = "gpio",
53 .direction_input = sa1100_direction_input,
54 .direction_output = sa1100_direction_output,
55 .set = sa1100_gpio_set,
56 .get = sa1100_gpio_get,
57 .base = 0,
58 .ngpio = GPIO_MAX + 1,
59};
60
61void __init sa1100_init_gpio(void)
62{
63 gpiochip_add(&sa1100_gpio_chip);
64}