2 * OMAP7xx specific gpio init
4 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
7 * Charulatha V <charu@ti.com>
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License as
11 * published by the Free Software Foundation version 2.
13 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
14 * kind, whether express or implied; without even the implied warranty
15 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
19 #include <linux/gpio.h>
21 #define OMAP7XX_GPIO1_BASE 0xfffbc000
22 #define OMAP7XX_GPIO2_BASE 0xfffbc800
23 #define OMAP7XX_GPIO3_BASE 0xfffbd000
24 #define OMAP7XX_GPIO4_BASE 0xfffbd800
25 #define OMAP7XX_GPIO5_BASE 0xfffbe000
26 #define OMAP7XX_GPIO6_BASE 0xfffbe800
27 #define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE
30 static struct __initdata resource omap7xx_mpu_gpio_resources
[] = {
32 .start
= OMAP1_MPUIO_VBASE
,
33 .end
= OMAP1_MPUIO_VBASE
+ SZ_2K
- 1,
34 .flags
= IORESOURCE_MEM
,
37 .start
= INT_7XX_MPUIO
,
38 .flags
= IORESOURCE_IRQ
,
42 static struct __initdata omap_gpio_platform_data omap7xx_mpu_gpio_config
= {
43 .virtual_irq_start
= IH_MPUIO_BASE
,
44 .bank_type
= METHOD_MPUIO
,
49 static struct __initdata platform_device omap7xx_mpu_gpio
= {
53 .platform_data
= &omap7xx_mpu_gpio_config
,
55 .num_resources
= ARRAY_SIZE(omap7xx_mpu_gpio_resources
),
56 .resource
= omap7xx_mpu_gpio_resources
,
60 static struct __initdata resource omap7xx_gpio1_resources
[] = {
62 .start
= OMAP7XX_GPIO1_BASE
,
63 .end
= OMAP7XX_GPIO1_BASE
+ SZ_2K
- 1,
64 .flags
= IORESOURCE_MEM
,
67 .start
= INT_7XX_GPIO_BANK1
,
68 .flags
= IORESOURCE_IRQ
,
72 static struct __initdata omap_gpio_platform_data omap7xx_gpio1_config
= {
73 .virtual_irq_start
= IH_GPIO_BASE
,
74 .bank_type
= METHOD_GPIO_7XX
,
78 static struct __initdata platform_device omap7xx_gpio1
= {
82 .platform_data
= &omap7xx_gpio1_config
,
84 .num_resources
= ARRAY_SIZE(omap7xx_gpio1_resources
),
85 .resource
= omap7xx_gpio1_resources
,
89 static struct __initdata resource omap7xx_gpio2_resources
[] = {
91 .start
= OMAP7XX_GPIO2_BASE
,
92 .end
= OMAP7XX_GPIO2_BASE
+ SZ_2K
- 1,
93 .flags
= IORESOURCE_MEM
,
96 .start
= INT_7XX_GPIO_BANK2
,
97 .flags
= IORESOURCE_IRQ
,
101 static struct __initdata omap_gpio_platform_data omap7xx_gpio2_config
= {
102 .virtual_irq_start
= IH_GPIO_BASE
+ 32,
103 .bank_type
= METHOD_GPIO_7XX
,
107 static struct __initdata platform_device omap7xx_gpio2
= {
111 .platform_data
= &omap7xx_gpio2_config
,
113 .num_resources
= ARRAY_SIZE(omap7xx_gpio2_resources
),
114 .resource
= omap7xx_gpio2_resources
,
118 static struct __initdata resource omap7xx_gpio3_resources
[] = {
120 .start
= OMAP7XX_GPIO3_BASE
,
121 .end
= OMAP7XX_GPIO3_BASE
+ SZ_2K
- 1,
122 .flags
= IORESOURCE_MEM
,
125 .start
= INT_7XX_GPIO_BANK3
,
126 .flags
= IORESOURCE_IRQ
,
130 static struct __initdata omap_gpio_platform_data omap7xx_gpio3_config
= {
131 .virtual_irq_start
= IH_GPIO_BASE
+ 64,
132 .bank_type
= METHOD_GPIO_7XX
,
136 static struct __initdata platform_device omap7xx_gpio3
= {
140 .platform_data
= &omap7xx_gpio3_config
,
142 .num_resources
= ARRAY_SIZE(omap7xx_gpio3_resources
),
143 .resource
= omap7xx_gpio3_resources
,
147 static struct __initdata resource omap7xx_gpio4_resources
[] = {
149 .start
= OMAP7XX_GPIO4_BASE
,
150 .end
= OMAP7XX_GPIO4_BASE
+ SZ_2K
- 1,
151 .flags
= IORESOURCE_MEM
,
154 .start
= INT_7XX_GPIO_BANK4
,
155 .flags
= IORESOURCE_IRQ
,
159 static struct __initdata omap_gpio_platform_data omap7xx_gpio4_config
= {
160 .virtual_irq_start
= IH_GPIO_BASE
+ 96,
161 .bank_type
= METHOD_GPIO_7XX
,
165 static struct __initdata platform_device omap7xx_gpio4
= {
169 .platform_data
= &omap7xx_gpio4_config
,
171 .num_resources
= ARRAY_SIZE(omap7xx_gpio4_resources
),
172 .resource
= omap7xx_gpio4_resources
,
176 static struct __initdata resource omap7xx_gpio5_resources
[] = {
178 .start
= OMAP7XX_GPIO5_BASE
,
179 .end
= OMAP7XX_GPIO5_BASE
+ SZ_2K
- 1,
180 .flags
= IORESOURCE_MEM
,
183 .start
= INT_7XX_GPIO_BANK5
,
184 .flags
= IORESOURCE_IRQ
,
188 static struct __initdata omap_gpio_platform_data omap7xx_gpio5_config
= {
189 .virtual_irq_start
= IH_GPIO_BASE
+ 128,
190 .bank_type
= METHOD_GPIO_7XX
,
194 static struct __initdata platform_device omap7xx_gpio5
= {
198 .platform_data
= &omap7xx_gpio5_config
,
200 .num_resources
= ARRAY_SIZE(omap7xx_gpio5_resources
),
201 .resource
= omap7xx_gpio5_resources
,
205 static struct __initdata resource omap7xx_gpio6_resources
[] = {
207 .start
= OMAP7XX_GPIO6_BASE
,
208 .end
= OMAP7XX_GPIO6_BASE
+ SZ_2K
- 1,
209 .flags
= IORESOURCE_MEM
,
212 .start
= INT_7XX_GPIO_BANK6
,
213 .flags
= IORESOURCE_IRQ
,
217 static struct __initdata omap_gpio_platform_data omap7xx_gpio6_config
= {
218 .virtual_irq_start
= IH_GPIO_BASE
+ 160,
219 .bank_type
= METHOD_GPIO_7XX
,
223 static struct __initdata platform_device omap7xx_gpio6
= {
227 .platform_data
= &omap7xx_gpio6_config
,
229 .num_resources
= ARRAY_SIZE(omap7xx_gpio6_resources
),
230 .resource
= omap7xx_gpio6_resources
,
233 static struct __initdata platform_device
* omap7xx_gpio_dev
[] = {
244 * omap7xx_gpio_init needs to be done before
245 * machine_init functions access gpio APIs.
246 * Hence omap7xx_gpio_init is a postcore_initcall.
248 static int __init
omap7xx_gpio_init(void)
252 if (!cpu_is_omap7xx())
255 for (i
= 0; i
< ARRAY_SIZE(omap7xx_gpio_dev
); i
++)
256 platform_device_register(omap7xx_gpio_dev
[i
]);
258 gpio_bank_count
= ARRAY_SIZE(omap7xx_gpio_dev
);
262 postcore_initcall(omap7xx_gpio_init
);