summaryrefslogtreecommitdiff
path: root/arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2011-11-02 05:46:10 +0400
committerArnd Bergmann <arnd@arndb.de>2011-11-02 05:46:10 +0400
commit884897e6a10a86de0e611a76f4bf3fd0068a672c (patch)
tree019689fb9d129404af1efba4df10975bc9e0a57a /arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h
parentc72dbae971400e466ad9ff16c920cd6d9d8c55a1 (diff)
parent8b61f37440388ebbd2a894178fe098f2e70ab392 (diff)
downloadlinux-884897e6a10a86de0e611a76f4bf3fd0068a672c.tar.xz
Merge branch 'highbank/soc' into next/soc
Conflicts: arch/arm/mach-mxs/include/mach/gpio.h arch/arm/mach-omap2/board-generic.c arch/arm/plat-mxc/include/mach/gpio.h
Diffstat (limited to 'arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h')
-rw-r--r--arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h48
1 files changed, 48 insertions, 0 deletions
diff --git a/arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h b/arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h
new file mode 100644
index 000000000000..af836c76c3f1
--- /dev/null
+++ b/arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h
@@ -0,0 +1,48 @@
+/*
+ * arch/arm/mach-ixp2000/include/mach/gpio.h
+ *
+ * Copyright (C) 2002 Intel Corporation.
+ *
+ * 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.
+ */
+
+/*
+ * IXP2000 GPIO in/out, edge/level detection for IRQs:
+ * IRQs are generated on Falling-edge, Rising-Edge, Level-low, Level-High
+ * or both Falling-edge and Rising-edge.
+ * This must be called *before* the corresponding IRQ is registerd.
+ * Use this instead of directly setting the GPIO registers.
+ * GPIOs may also be used as GPIOs (e.g. for emulating i2c/smb)
+ */
+#ifndef __ASM_ARCH_GPIO_H
+#define __ASM_ARCH_GPIO_H
+
+#ifndef __ASSEMBLY__
+
+#define GPIO_IN 0
+#define GPIO_OUT 1
+
+#define IXP2000_GPIO_LOW 0
+#define IXP2000_GPIO_HIGH 1
+
+extern void gpio_line_config(int line, int direction);
+
+static inline int gpio_line_get(int line)
+{
+ return (((*IXP2000_GPIO_PLR) >> line) & 1);
+}
+
+static inline void gpio_line_set(int line, int value)
+{
+ if (value == IXP2000_GPIO_HIGH) {
+ ixp2000_reg_write(IXP2000_GPIO_POSR, 1 << line);
+ } else if (value == IXP2000_GPIO_LOW) {
+ ixp2000_reg_write(IXP2000_GPIO_POCR, 1 << line);
+ }
+}
+
+#endif /* !__ASSEMBLY__ */
+
+#endif /* ASM_ARCH_IXP2000_GPIO_H_ */