fuse: make fuse_dentry_revalidate() RCU aware
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / arm / mach-omap1 / gpio16xx.c
blob5dd0d4c82b247601fd8ceafbb690df17d236f600
1 /*
2 * OMAP16xx 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 OMAP1610_GPIO1_BASE 0xfffbe400
22 #define OMAP1610_GPIO2_BASE 0xfffbec00
23 #define OMAP1610_GPIO3_BASE 0xfffbb400
24 #define OMAP1610_GPIO4_BASE 0xfffbbc00
25 #define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE
27 /* mpu gpio */
28 static struct __initdata resource omap16xx_mpu_gpio_resources[] = {
30 .start = OMAP1_MPUIO_VBASE,
31 .end = OMAP1_MPUIO_VBASE + SZ_2K - 1,
32 .flags = IORESOURCE_MEM,
35 .start = INT_MPUIO,
36 .flags = IORESOURCE_IRQ,
40 static struct __initdata omap_gpio_platform_data omap16xx_mpu_gpio_config = {
41 .virtual_irq_start = IH_MPUIO_BASE,
42 .bank_type = METHOD_MPUIO,
43 .bank_width = 16,
44 .bank_stride = 1,
47 static struct __initdata platform_device omap16xx_mpu_gpio = {
48 .name = "omap_gpio",
49 .id = 0,
50 .dev = {
51 .platform_data = &omap16xx_mpu_gpio_config,
53 .num_resources = ARRAY_SIZE(omap16xx_mpu_gpio_resources),
54 .resource = omap16xx_mpu_gpio_resources,
57 /* gpio1 */
58 static struct __initdata resource omap16xx_gpio1_resources[] = {
60 .start = OMAP1610_GPIO1_BASE,
61 .end = OMAP1610_GPIO1_BASE + SZ_2K - 1,
62 .flags = IORESOURCE_MEM,
65 .start = INT_GPIO_BANK1,
66 .flags = IORESOURCE_IRQ,
70 static struct __initdata omap_gpio_platform_data omap16xx_gpio1_config = {
71 .virtual_irq_start = IH_GPIO_BASE,
72 .bank_type = METHOD_GPIO_1610,
73 .bank_width = 16,
76 static struct __initdata platform_device omap16xx_gpio1 = {
77 .name = "omap_gpio",
78 .id = 1,
79 .dev = {
80 .platform_data = &omap16xx_gpio1_config,
82 .num_resources = ARRAY_SIZE(omap16xx_gpio1_resources),
83 .resource = omap16xx_gpio1_resources,
86 /* gpio2 */
87 static struct __initdata resource omap16xx_gpio2_resources[] = {
89 .start = OMAP1610_GPIO2_BASE,
90 .end = OMAP1610_GPIO2_BASE + SZ_2K - 1,
91 .flags = IORESOURCE_MEM,
94 .start = INT_1610_GPIO_BANK2,
95 .flags = IORESOURCE_IRQ,
99 static struct __initdata omap_gpio_platform_data omap16xx_gpio2_config = {
100 .virtual_irq_start = IH_GPIO_BASE + 16,
101 .bank_type = METHOD_GPIO_1610,
102 .bank_width = 16,
105 static struct __initdata platform_device omap16xx_gpio2 = {
106 .name = "omap_gpio",
107 .id = 2,
108 .dev = {
109 .platform_data = &omap16xx_gpio2_config,
111 .num_resources = ARRAY_SIZE(omap16xx_gpio2_resources),
112 .resource = omap16xx_gpio2_resources,
115 /* gpio3 */
116 static struct __initdata resource omap16xx_gpio3_resources[] = {
118 .start = OMAP1610_GPIO3_BASE,
119 .end = OMAP1610_GPIO3_BASE + SZ_2K - 1,
120 .flags = IORESOURCE_MEM,
123 .start = INT_1610_GPIO_BANK3,
124 .flags = IORESOURCE_IRQ,
128 static struct __initdata omap_gpio_platform_data omap16xx_gpio3_config = {
129 .virtual_irq_start = IH_GPIO_BASE + 32,
130 .bank_type = METHOD_GPIO_1610,
131 .bank_width = 16,
134 static struct __initdata platform_device omap16xx_gpio3 = {
135 .name = "omap_gpio",
136 .id = 3,
137 .dev = {
138 .platform_data = &omap16xx_gpio3_config,
140 .num_resources = ARRAY_SIZE(omap16xx_gpio3_resources),
141 .resource = omap16xx_gpio3_resources,
144 /* gpio4 */
145 static struct __initdata resource omap16xx_gpio4_resources[] = {
147 .start = OMAP1610_GPIO4_BASE,
148 .end = OMAP1610_GPIO4_BASE + SZ_2K - 1,
149 .flags = IORESOURCE_MEM,
152 .start = INT_1610_GPIO_BANK4,
153 .flags = IORESOURCE_IRQ,
157 static struct __initdata omap_gpio_platform_data omap16xx_gpio4_config = {
158 .virtual_irq_start = IH_GPIO_BASE + 48,
159 .bank_type = METHOD_GPIO_1610,
160 .bank_width = 16,
163 static struct __initdata platform_device omap16xx_gpio4 = {
164 .name = "omap_gpio",
165 .id = 4,
166 .dev = {
167 .platform_data = &omap16xx_gpio4_config,
169 .num_resources = ARRAY_SIZE(omap16xx_gpio4_resources),
170 .resource = omap16xx_gpio4_resources,
173 static struct __initdata platform_device * omap16xx_gpio_dev[] = {
174 &omap16xx_mpu_gpio,
175 &omap16xx_gpio1,
176 &omap16xx_gpio2,
177 &omap16xx_gpio3,
178 &omap16xx_gpio4,
182 * omap16xx_gpio_init needs to be done before
183 * machine_init functions access gpio APIs.
184 * Hence omap16xx_gpio_init is a postcore_initcall.
186 static int __init omap16xx_gpio_init(void)
188 int i;
190 if (!cpu_is_omap16xx())
191 return -EINVAL;
193 for (i = 0; i < ARRAY_SIZE(omap16xx_gpio_dev); i++)
194 platform_device_register(omap16xx_gpio_dev[i]);
196 gpio_bank_count = ARRAY_SIZE(omap16xx_gpio_dev);
198 return 0;
200 postcore_initcall(omap16xx_gpio_init);