summaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLennert Buytenhek <buytenh@wantstofly.org>2006-09-18 23:23:07 +0100
committerRussell King <rmk+kernel@arm.linux.org.uk>2006-09-25 10:25:47 +0100
commit72edd84a6b2db1a21d1ed07929cae560e276a0a6 (patch)
treeb67000e2bbf7447968c784cc3696a680ad66c47e /arch
parent610300e8f4f833904096ca1233ffd9dbd73fb11f (diff)
downloadblackbird-op-linux-72edd84a6b2db1a21d1ed07929cae560e276a0a6.tar.gz
blackbird-op-linux-72edd84a6b2db1a21d1ed07929cae560e276a0a6.zip
[ARM] 3827/1: iop3xx: add common gpio module
Implement the gpio_line_{config,get,set} API for iop3xx. Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/plat-iop/Makefile2
-rw-r--r--arch/arm/plat-iop/gpio.c48
2 files changed, 49 insertions, 1 deletions
diff --git a/arch/arm/plat-iop/Makefile b/arch/arm/plat-iop/Makefile
index d20cdec3a944..23da00b11517 100644
--- a/arch/arm/plat-iop/Makefile
+++ b/arch/arm/plat-iop/Makefile
@@ -2,7 +2,7 @@
# Makefile for the linux kernel.
#
-obj-y := i2c.o pci.o setup.o time.o
+obj-y := gpio.o i2c.o pci.o setup.o time.o
obj-m :=
obj-n :=
obj- :=
diff --git a/arch/arm/plat-iop/gpio.c b/arch/arm/plat-iop/gpio.c
new file mode 100644
index 000000000000..eda436083417
--- /dev/null
+++ b/arch/arm/plat-iop/gpio.c
@@ -0,0 +1,48 @@
+/*
+ * arch/arm/plat-iop/gpio.c
+ * GPIO handling for Intel IOP3xx processors.
+ *
+ * Copyright (C) 2006 Lennert Buytenhek <buytenh@wantstofly.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or (at
+ * your option) any later version.
+ */
+
+#include <linux/device.h>
+#include <asm/hardware/iop3xx.h>
+
+void gpio_line_config(int line, int direction)
+{
+ unsigned long flags;
+
+ local_irq_save(flags);
+ if (direction == GPIO_IN) {
+ *IOP3XX_GPOE |= 1 << line;
+ } else if (direction == GPIO_OUT) {
+ *IOP3XX_GPOE &= ~(1 << line);
+ }
+ local_irq_restore(flags);
+}
+EXPORT_SYMBOL(gpio_line_config);
+
+int gpio_line_get(int line)
+{
+ return !!(*IOP3XX_GPID & (1 << line));
+}
+EXPORT_SYMBOL(gpio_line_get);
+
+void gpio_line_set(int line, int value)
+{
+ unsigned long flags;
+
+ local_irq_save(flags);
+ if (value == GPIO_LOW) {
+ *IOP3XX_GPOD &= ~(1 << line);
+ } else if (value == GPIO_HIGH) {
+ *IOP3XX_GPOD |= 1 << line;
+ }
+ local_irq_restore(flags);
+}
+EXPORT_SYMBOL(gpio_line_set);
OpenPOWER on IntegriCloud