2 * OMAP16xx 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 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
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,
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,
47 static struct __initdata platform_device omap16xx_mpu_gpio = {
51 .platform_data = &omap16xx_mpu_gpio_config,
53 .num_resources = ARRAY_SIZE(omap16xx_mpu_gpio_resources),
54 .resource = omap16xx_mpu_gpio_resources,
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,
76 static struct __initdata platform_device omap16xx_gpio1 = {
80 .platform_data = &omap16xx_gpio1_config,
82 .num_resources = ARRAY_SIZE(omap16xx_gpio1_resources),
83 .resource = omap16xx_gpio1_resources,
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,
105 static struct __initdata platform_device omap16xx_gpio2 = {
109 .platform_data = &omap16xx_gpio2_config,
111 .num_resources = ARRAY_SIZE(omap16xx_gpio2_resources),
112 .resource = omap16xx_gpio2_resources,
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,
134 static struct __initdata platform_device omap16xx_gpio3 = {
138 .platform_data = &omap16xx_gpio3_config,
140 .num_resources = ARRAY_SIZE(omap16xx_gpio3_resources),
141 .resource = omap16xx_gpio3_resources,
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,
163 static struct __initdata platform_device omap16xx_gpio4 = {
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[] = {
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)
190 if (!cpu_is_omap16xx())
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);
200 postcore_initcall(omap16xx_gpio_init);