RT-AC56 3.0.0.4.374.37 core
[tomato.git] / release / src-rt-6.x.4708 / linux / linux-2.6.36 / arch / arm / mach-mv78xx0 / include / mach / gpio.h
blobd9d1535ea100d8482c75406bd5bbc2046c701abe
1 /*
2 * arch/asm-arm/mach-mv78xx0/include/mach/gpio.h
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 */
9 #ifndef __ASM_ARCH_GPIO_H
10 #define __ASM_ARCH_GPIO_H
12 #include <mach/irqs.h>
13 #include <plat/gpio.h>
14 #include <asm-generic/gpio.h> /* cansleep wrappers */
16 extern int mv78xx0_core_index(void);
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)
29 static inline int gpio_to_irq(int pin)
31 return pin + IRQ_MV78XX0_GPIO_START;
34 static inline int irq_to_gpio(int irq)
36 return irq - IRQ_MV78XX0_GPIO_START;
40 #endif