1 #ifndef __ASM_MACH_GPIO_PXA_H
2 #define __ASM_MACH_GPIO_PXA_H
3 
4 #include <mach/addr-map.h>
5 #include <mach/cputype.h>
6 #include <mach/irqs.h>
7 
8 #define GPIO_REGS_VIRT	(APB_VIRT_BASE + 0x19000)
9 
10 #define BANK_OFF(n)	(((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
11 #define GPIO_REG(x)	(*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
12 
13 #define gpio_to_bank(gpio)	((gpio) >> 5)
14 
15 /* NOTE: these macros are defined here to make optimization of
16  * gpio_{get,set}_value() to work when 'gpio' is a constant.
17  * Usage of these macros otherwise is no longer recommended,
18  * use generic GPIO API whenever possible.
19  */
20 #define GPIO_bit(gpio)	(1 << ((gpio) & 0x1f))
21 
22 #define GPLR(x)		GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x00)
23 #define GPDR(x)		GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x0c)
24 #define GPSR(x)		GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x18)
25 #define GPCR(x)		GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x24)
26 
27 #include <plat/gpio-pxa.h>
28 
29 #endif /* __ASM_MACH_GPIO_PXA_H */
30