ARM: 7049/1: mach-sa1100: move SA1100 GPIO driver to GPIO subsystem
authorLinus Walleij <linus.walleij@linaro.org>
Mon, 22 Aug 2011 07:49:07 +0000 (08:49 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Mon, 22 Aug 2011 08:13:44 +0000 (09:13 +0100)
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>
arch/arm/mach-sa1100/Makefile
arch/arm/mach-sa1100/gpio.c [deleted file]
drivers/gpio/Makefile
drivers/gpio/gpio-sa1100.c [new file with mode: 0644]

index 41252d22e6591d437e274d967126ed86dee0112a..73a5c643179209e3192ffe65dd4a5bcf6c1c21e7 100644 (file)
@@ -3,7 +3,7 @@
 #
 
 # Common support
-obj-y := clock.o generic.o gpio.o irq.o dma.o time.o #nmi-oopser.o
+obj-y := clock.o generic.o irq.o dma.o time.o #nmi-oopser.o
 obj-m :=
 obj-n :=
 obj-  :=
diff --git a/arch/arm/mach-sa1100/gpio.c b/arch/arm/mach-sa1100/gpio.c
deleted file mode 100644 (file)
index e547ed4..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * linux/arch/arm/mach-sa1100/gpio.c
- *
- * Generic SA-1100 GPIO handling
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/gpio.h>
-#include <linux/init.h>
-#include <linux/module.h>
-
-#include <mach/hardware.h>
-#include "generic.h"
-
-static int sa1100_gpio_get(struct gpio_chip *chip, unsigned offset)
-{
-       return GPLR & GPIO_GPIO(offset);
-}
-
-static void sa1100_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
-{
-       if (value)
-               GPSR = GPIO_GPIO(offset);
-       else
-               GPCR = GPIO_GPIO(offset);
-}
-
-static int sa1100_direction_input(struct gpio_chip *chip, unsigned offset)
-{
-       unsigned long flags;
-
-       local_irq_save(flags);
-       GPDR &= ~GPIO_GPIO(offset);
-       local_irq_restore(flags);
-       return 0;
-}
-
-static int sa1100_direction_output(struct gpio_chip *chip, unsigned offset, int value)
-{
-       unsigned long flags;
-
-       local_irq_save(flags);
-       sa1100_gpio_set(chip, offset, value);
-       GPDR |= GPIO_GPIO(offset);
-       local_irq_restore(flags);
-       return 0;
-}
-
-static struct gpio_chip sa1100_gpio_chip = {
-       .label                  = "gpio",
-       .direction_input        = sa1100_direction_input,
-       .direction_output       = sa1100_direction_output,
-       .set                    = sa1100_gpio_set,
-       .get                    = sa1100_gpio_get,
-       .base                   = 0,
-       .ngpio                  = GPIO_MAX + 1,
-};
-
-void __init sa1100_init_gpio(void)
-{
-       gpiochip_add(&sa1100_gpio_chip);
-}
index 33e095bdb65cf55150102323c0738acb99092f70..84bc7389e367a1625cf1069d7d64a2ac09dee491 100644 (file)
@@ -45,7 +45,7 @@ obj-$(CONFIG_GPIO_RDC321X)    += gpio-rdc321x.o
 obj-$(CONFIG_GPIO_PLAT_SAMSUNG)        += gpio-plat-samsung.o
 obj-$(CONFIG_GPIO_S5PC100)     += gpio-s5pc100.o
 obj-$(CONFIG_GPIO_S5PV210)     += gpio-s5pv210.o
-
+obj-$(CONFIG_ARCH_SA1100)      += gpio-sa1100.o
 obj-$(CONFIG_GPIO_SCH)         += gpio-sch.o
 obj-$(CONFIG_GPIO_STMPE)       += gpio-stmpe.o
 obj-$(CONFIG_GPIO_SX150X)      += gpio-sx150x.o
diff --git a/drivers/gpio/gpio-sa1100.c b/drivers/gpio/gpio-sa1100.c
new file mode 100644 (file)
index 0000000..b6c1f6d
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * linux/arch/arm/mach-sa1100/gpio.c
+ *
+ * Generic SA-1100 GPIO handling
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/gpio.h>
+#include <linux/init.h>
+#include <linux/module.h>
+
+#include <mach/hardware.h>
+
+static int sa1100_gpio_get(struct gpio_chip *chip, unsigned offset)
+{
+       return GPLR & GPIO_GPIO(offset);
+}
+
+static void sa1100_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
+{
+       if (value)
+               GPSR = GPIO_GPIO(offset);
+       else
+               GPCR = GPIO_GPIO(offset);
+}
+
+static int sa1100_direction_input(struct gpio_chip *chip, unsigned offset)
+{
+       unsigned long flags;
+
+       local_irq_save(flags);
+       GPDR &= ~GPIO_GPIO(offset);
+       local_irq_restore(flags);
+       return 0;
+}
+
+static int sa1100_direction_output(struct gpio_chip *chip, unsigned offset, int value)
+{
+       unsigned long flags;
+
+       local_irq_save(flags);
+       sa1100_gpio_set(chip, offset, value);
+       GPDR |= GPIO_GPIO(offset);
+       local_irq_restore(flags);
+       return 0;
+}
+
+static struct gpio_chip sa1100_gpio_chip = {
+       .label                  = "gpio",
+       .direction_input        = sa1100_direction_input,
+       .direction_output       = sa1100_direction_output,
+       .set                    = sa1100_gpio_set,
+       .get                    = sa1100_gpio_get,
+       .base                   = 0,
+       .ngpio                  = GPIO_MAX + 1,
+};
+
+void __init sa1100_init_gpio(void)
+{
+       gpiochip_add(&sa1100_gpio_chip);
+}