d548a622e7d24eeb8f54cb5dcb03caa9268370e6
[linux-2.6.git] / arch / arm / mach-ux500 / include / mach / gpio.h
1 #ifndef __ASM_ARCH_GPIO_H
2 #define __ASM_ARCH_GPIO_H
3
4 /*
5  * 288 (#267 is the highest one actually hooked up) onchip GPIOs, plus enough
6  * room for a couple of GPIO expanders.
7  */
8 #define ARCH_NR_GPIOS   350
9
10 #include <plat/gpio.h>
11
12 #define __GPIO_RESOURCE(soc, block)                                     \
13         {                                                               \
14                 .start  = soc##_GPIOBANK##block##_BASE,                 \
15                 .end    = soc##_GPIOBANK##block##_BASE + 127,           \
16                 .flags  = IORESOURCE_MEM,                               \
17         },                                                              \
18         {                                                               \
19                 .start  = IRQ_GPIO##block,                              \
20                 .end    = IRQ_GPIO##block,                              \
21                 .flags  = IORESOURCE_IRQ,                               \
22         }
23
24 #define __GPIO_DEVICE(soc, block)                                       \
25         {                                                               \
26                 .name           = "gpio",                               \
27                 .id             = block,                                \
28                 .num_resources  = 2,                                    \
29                 .resource       = &soc##_gpio_resources[block * 2],     \
30                 .dev = {                                                \
31                         .platform_data = &soc##_gpio_data[block],       \
32                 },                                                      \
33         }
34
35 #define GPIO_DATA(_name, first)                                         \
36         {                                                               \
37                 .name           = _name,                                \
38                 .first_gpio     = first,                                \
39                 .first_irq      = NOMADIK_GPIO_TO_IRQ(first),           \
40         }
41
42 #ifdef CONFIG_UX500_SOC_DB8500
43 #define GPIO_RESOURCE(block)    __GPIO_RESOURCE(U8500, block)
44 #define GPIO_DEVICE(block)      __GPIO_DEVICE(u8500, block)
45 #elif defined(CONFIG_UX500_SOC_DB5500)
46 #define GPIO_RESOURCE(block)    __GPIO_RESOURCE(U5500, block)
47 #define GPIO_DEVICE(block)      __GPIO_DEVICE(u5500, block)
48 #endif
49
50 #endif /* __ASM_ARCH_GPIO_H */