summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-mv78xx0/include/mach/gpio.h
diff options
context:
space:
mode:
authorLennert Buytenhek2008-10-20 01:51:04 +0200
committerNicolas Pitre2008-12-20 18:27:13 +0100
commitb95a13d79c0e92c9c844fa8aa089c9bd2ed10705 (patch)
treee1c4c855de14abe955d12e6436eb8dca64dad027 /arch/arm/mach-mv78xx0/include/mach/gpio.h
parent[ARM] Kirkwood: implement GPIO and GPIO interrupt support (diff)
downloadkernel-qcow2-linux-b95a13d79c0e92c9c844fa8aa089c9bd2ed10705.tar.gz
kernel-qcow2-linux-b95a13d79c0e92c9c844fa8aa089c9bd2ed10705.tar.xz
kernel-qcow2-linux-b95a13d79c0e92c9c844fa8aa089c9bd2ed10705.zip
[ARM] mv78xx0: implement GPIO and GPIO interrupt support
Signed-off-by: Lennert Buytenhek <buytenh@marvell.com> Signed-off-by: Nicolas Pitre <nico@marvell.com>
Diffstat (limited to 'arch/arm/mach-mv78xx0/include/mach/gpio.h')
-rw-r--r--arch/arm/mach-mv78xx0/include/mach/gpio.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/arch/arm/mach-mv78xx0/include/mach/gpio.h b/arch/arm/mach-mv78xx0/include/mach/gpio.h
new file mode 100644
index 000000000000..d9d1535ea100
--- /dev/null
+++ b/arch/arm/mach-mv78xx0/include/mach/gpio.h
@@ -0,0 +1,40 @@
+/*
+ * arch/asm-arm/mach-mv78xx0/include/mach/gpio.h
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2. This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#ifndef __ASM_ARCH_GPIO_H
+#define __ASM_ARCH_GPIO_H
+
+#include <mach/irqs.h>
+#include <plat/gpio.h>
+#include <asm-generic/gpio.h> /* cansleep wrappers */
+
+extern int mv78xx0_core_index(void);
+
+#define GPIO_MAX 32
+#define GPIO_OUT(pin) (DEV_BUS_VIRT_BASE + 0x0100)
+#define GPIO_IO_CONF(pin) (DEV_BUS_VIRT_BASE + 0x0104)
+#define GPIO_BLINK_EN(pin) (DEV_BUS_VIRT_BASE + 0x0108)
+#define GPIO_IN_POL(pin) (DEV_BUS_VIRT_BASE + 0x010c)
+#define GPIO_DATA_IN(pin) (DEV_BUS_VIRT_BASE + 0x0110)
+#define GPIO_EDGE_CAUSE(pin) (DEV_BUS_VIRT_BASE + 0x0114)
+#define GPIO_MASK_OFF (mv78xx0_core_index() ? 0x18 : 0)
+#define GPIO_EDGE_MASK(pin) (DEV_BUS_VIRT_BASE + 0x0118 + GPIO_MASK_OFF)
+#define GPIO_LEVEL_MASK(pin) (DEV_BUS_VIRT_BASE + 0x011c + GPIO_MASK_OFF)
+
+static inline int gpio_to_irq(int pin)
+{
+ return pin + IRQ_MV78XX0_GPIO_START;
+}
+
+static inline int irq_to_gpio(int irq)
+{
+ return irq - IRQ_MV78XX0_GPIO_START;
+}
+
+
+#endif