summaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-ux500/include/mach/gpio.h
blob: d548a622e7d24eeb8f54cb5dcb03caa9268370e6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef __ASM_ARCH_GPIO_H
#define __ASM_ARCH_GPIO_H

/*
 * 288 (#267 is the highest one actually hooked up) onchip GPIOs, plus enough
 * room for a couple of GPIO expanders.
 */
#define ARCH_NR_GPIOS	350

#include <plat/gpio.h>

#define __GPIO_RESOURCE(soc, block)					\
	{								\
		.start	= soc##_GPIOBANK##block##_BASE,			\
		.end	= soc##_GPIOBANK##block##_BASE + 127,		\
		.flags	= IORESOURCE_MEM,				\
	},								\
	{								\
		.start	= IRQ_GPIO##block,				\
		.end	= IRQ_GPIO##block,				\
		.flags	= IORESOURCE_IRQ,				\
	}

#define __GPIO_DEVICE(soc, block)					\
	{								\
		.name		= "gpio",				\
		.id		= block,				\
		.num_resources	= 2,					\
		.resource	= &soc##_gpio_resources[block * 2],	\
		.dev = {						\
			.platform_data = &soc##_gpio_data[block],	\
		},							\
	}

#define GPIO_DATA(_name, first)						\
	{								\
		.name		= _name,				\
		.first_gpio	= first,				\
		.first_irq	= NOMADIK_GPIO_TO_IRQ(first),		\
	}

#ifdef CONFIG_UX500_SOC_DB8500
#define GPIO_RESOURCE(block)	__GPIO_RESOURCE(U8500, block)
#define GPIO_DEVICE(block)	__GPIO_DEVICE(u8500, block)
#elif defined(CONFIG_UX500_SOC_DB5500)
#define GPIO_RESOURCE(block)	__GPIO_RESOURCE(U5500, block)
#define GPIO_DEVICE(block)	__GPIO_DEVICE(u5500, block)
#endif

#endif /* __ASM_ARCH_GPIO_H */