Merge git://git.kernel.org/pub/scm/linux/kernel/git/hirofumi/fatfs-2.6
[sfrench/cifs-2.6.git] / arch / arm / mach-mv78xx0 / include / mach / gpio.h
1 /*
2  * arch/asm-arm/mach-mv78xx0/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 extern int mv78xx0_core_index(void);
17
18 #define GPIO_MAX                32
19 #define GPIO_OUT(pin)           (DEV_BUS_VIRT_BASE + 0x0100)
20 #define GPIO_IO_CONF(pin)       (DEV_BUS_VIRT_BASE + 0x0104)
21 #define GPIO_BLINK_EN(pin)      (DEV_BUS_VIRT_BASE + 0x0108)
22 #define GPIO_IN_POL(pin)        (DEV_BUS_VIRT_BASE + 0x010c)
23 #define GPIO_DATA_IN(pin)       (DEV_BUS_VIRT_BASE + 0x0110)
24 #define GPIO_EDGE_CAUSE(pin)    (DEV_BUS_VIRT_BASE + 0x0114)
25 #define GPIO_MASK_OFF           (mv78xx0_core_index() ? 0x18 : 0)
26 #define GPIO_EDGE_MASK(pin)     (DEV_BUS_VIRT_BASE + 0x0118 + GPIO_MASK_OFF)
27 #define GPIO_LEVEL_MASK(pin)    (DEV_BUS_VIRT_BASE + 0x011c + GPIO_MASK_OFF)
28
29 static inline int gpio_to_irq(int pin)
30 {
31         return pin + IRQ_MV78XX0_GPIO_START;
32 }
33
34 static inline int irq_to_gpio(int irq)
35 {
36         return irq - IRQ_MV78XX0_GPIO_START;
37 }
38
39
40 #endif