Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/rric/oprofile
[pandora-kernel.git] / arch / arm / mach-kirkwood / include / mach / gpio.h
1 /*
2  * arch/asm-arm/mach-kirkwood/include/mach/gpio.h
3  *
4  * This file is licensed under the terms of the GNU General Public
5  * License version 2.  This program is licensed "as is" without any
6  * warranty of any kind, whether express or implied.
7  */
8
9 #ifndef __ASM_ARCH_GPIO_H
10 #define __ASM_ARCH_GPIO_H
11
12 #include <mach/irqs.h>
13 #include <plat/gpio.h>
14 #include <asm-generic/gpio.h>           /* cansleep wrappers */
15
16 #define GPIO_MAX                50
17 #define GPIO_OFF(pin)           (((pin) >> 5) ? 0x0140 : 0x0100)
18 #define GPIO_OUT(pin)           (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x00)
19 #define GPIO_IO_CONF(pin)       (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x04)
20 #define GPIO_BLINK_EN(pin)      (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x08)
21 #define GPIO_IN_POL(pin)        (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x0c)
22 #define GPIO_DATA_IN(pin)       (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x10)
23 #define GPIO_EDGE_CAUSE(pin)    (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x14)
24 #define GPIO_EDGE_MASK(pin)     (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x18)
25 #define GPIO_LEVEL_MASK(pin)    (DEV_BUS_VIRT_BASE + GPIO_OFF(pin) + 0x1c)
26
27 static inline int gpio_to_irq(int pin)
28 {
29         return pin + IRQ_KIRKWOOD_GPIO_START;
30 }
31
32 static inline int irq_to_gpio(int irq)
33 {
34         return irq - IRQ_KIRKWOOD_GPIO_START;
35 }
36
37
38 #endif