kvm tools, setup: Create private directory
[linux-2.6/next.git] / arch / arm / mach-omap1 / gpio7xx.c
blob1204c8b871af505bd2ccc001271bb15f1d87585f
1 /*
2 * OMAP7xx specific gpio init
4 * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/
6 * Author:
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
29 /* mpu gpio */
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,
45 .bank_width = 32,
46 .bank_stride = 2,
49 static struct __initdata platform_device omap7xx_mpu_gpio = {
50 .name = "omap_gpio",
51 .id = 0,
52 .dev = {
53 .platform_data = &omap7xx_mpu_gpio_config,
55 .num_resources = ARRAY_SIZE(omap7xx_mpu_gpio_resources),
56 .resource = omap7xx_mpu_gpio_resources,
59 /* gpio1 */
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,
75 .bank_width = 32,
78 static struct __initdata platform_device omap7xx_gpio1 = {
79 .name = "omap_gpio",
80 .id = 1,
81 .dev = {
82 .platform_data = &omap7xx_gpio1_config,
84 .num_resources = ARRAY_SIZE(omap7xx_gpio1_resources),
85 .resource = omap7xx_gpio1_resources,
88 /* gpio2 */
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,
104 .bank_width = 32,
107 static struct __initdata platform_device omap7xx_gpio2 = {
108 .name = "omap_gpio",
109 .id = 2,
110 .dev = {
111 .platform_data = &omap7xx_gpio2_config,
113 .num_resources = ARRAY_SIZE(omap7xx_gpio2_resources),
114 .resource = omap7xx_gpio2_resources,
117 /* gpio3 */
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,
133 .bank_width = 32,
136 static struct __initdata platform_device omap7xx_gpio3 = {
137 .name = "omap_gpio",
138 .id = 3,
139 .dev = {
140 .platform_data = &omap7xx_gpio3_config,
142 .num_resources = ARRAY_SIZE(omap7xx_gpio3_resources),
143 .resource = omap7xx_gpio3_resources,
146 /* gpio4 */
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,
162 .bank_width = 32,
165 static struct __initdata platform_device omap7xx_gpio4 = {
166 .name = "omap_gpio",
167 .id = 4,
168 .dev = {
169 .platform_data = &omap7xx_gpio4_config,
171 .num_resources = ARRAY_SIZE(omap7xx_gpio4_resources),
172 .resource = omap7xx_gpio4_resources,
175 /* gpio5 */
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,
191 .bank_width = 32,
194 static struct __initdata platform_device omap7xx_gpio5 = {
195 .name = "omap_gpio",
196 .id = 5,
197 .dev = {
198 .platform_data = &omap7xx_gpio5_config,
200 .num_resources = ARRAY_SIZE(omap7xx_gpio5_resources),
201 .resource = omap7xx_gpio5_resources,
204 /* gpio6 */
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,
220 .bank_width = 32,
223 static struct __initdata platform_device omap7xx_gpio6 = {
224 .name = "omap_gpio",
225 .id = 6,
226 .dev = {
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[] = {
234 &omap7xx_mpu_gpio,
235 &omap7xx_gpio1,
236 &omap7xx_gpio2,
237 &omap7xx_gpio3,
238 &omap7xx_gpio4,
239 &omap7xx_gpio5,
240 &omap7xx_gpio6,
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)
250 int i;
252 if (!cpu_is_omap7xx())
253 return -EINVAL;
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);
260 return 0;
262 postcore_initcall(omap7xx_gpio_init);