diff options
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-omap1/gpio15xx.c | 98 | ||||
-rw-r--r-- | arch/arm/plat-omap/gpio.c | 10 | ||||
-rw-r--r-- | arch/arm/plat-omap/include/plat/gpio.h | 18 |
3 files changed, 118 insertions, 8 deletions
diff --git a/arch/arm/mach-omap1/gpio15xx.c b/arch/arm/mach-omap1/gpio15xx.c new file mode 100644 index 000000000000..dbd81688eada --- /dev/null +++ b/arch/arm/mach-omap1/gpio15xx.c | |||
@@ -0,0 +1,98 @@ | |||
1 | /* | ||
2 | * OMAP15xx specific gpio init | ||
3 | * | ||
4 | * Copyright (C) 2010 Texas Instruments Incorporated - http://www.ti.com/ | ||
5 | * | ||
6 | * Author: | ||
7 | * Charulatha V <charu@ti.com> | ||
8 | * | ||
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. | ||
12 | * | ||
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. | ||
17 | */ | ||
18 | |||
19 | #include <linux/gpio.h> | ||
20 | |||
21 | #define OMAP1_MPUIO_VBASE OMAP1_MPUIO_BASE | ||
22 | #define OMAP1510_GPIO_BASE 0xFFFCE000 | ||
23 | |||
24 | /* gpio1 */ | ||
25 | static struct __initdata resource omap15xx_mpu_gpio_resources[] = { | ||
26 | { | ||
27 | .start = OMAP1_MPUIO_VBASE, | ||
28 | .end = OMAP1_MPUIO_VBASE + SZ_2K - 1, | ||
29 | .flags = IORESOURCE_MEM, | ||
30 | }, | ||
31 | { | ||
32 | .start = INT_MPUIO, | ||
33 | .flags = IORESOURCE_IRQ, | ||
34 | }, | ||
35 | }; | ||
36 | |||
37 | static struct __initdata omap_gpio_platform_data omap15xx_mpu_gpio_config = { | ||
38 | .virtual_irq_start = IH_MPUIO_BASE, | ||
39 | .bank_type = METHOD_MPUIO, | ||
40 | .bank_width = 16, | ||
41 | }; | ||
42 | |||
43 | static struct __initdata platform_device omap15xx_mpu_gpio = { | ||
44 | .name = "omap_gpio", | ||
45 | .id = 0, | ||
46 | .dev = { | ||
47 | .platform_data = &omap15xx_mpu_gpio_config, | ||
48 | }, | ||
49 | .num_resources = ARRAY_SIZE(omap15xx_mpu_gpio_resources), | ||
50 | .resource = omap15xx_mpu_gpio_resources, | ||
51 | }; | ||
52 | |||
53 | /* gpio2 */ | ||
54 | static struct __initdata resource omap15xx_gpio_resources[] = { | ||
55 | { | ||
56 | .start = OMAP1510_GPIO_BASE, | ||
57 | .end = OMAP1510_GPIO_BASE + SZ_2K - 1, | ||
58 | .flags = IORESOURCE_MEM, | ||
59 | }, | ||
60 | { | ||
61 | .start = INT_GPIO_BANK1, | ||
62 | .flags = IORESOURCE_IRQ, | ||
63 | }, | ||
64 | }; | ||
65 | |||
66 | static struct __initdata omap_gpio_platform_data omap15xx_gpio_config = { | ||
67 | .virtual_irq_start = IH_GPIO_BASE, | ||
68 | .bank_type = METHOD_GPIO_1510, | ||
69 | .bank_width = 16, | ||
70 | }; | ||
71 | |||
72 | static struct __initdata platform_device omap15xx_gpio = { | ||
73 | .name = "omap_gpio", | ||
74 | .id = 1, | ||
75 | .dev = { | ||
76 | .platform_data = &omap15xx_gpio_config, | ||
77 | }, | ||
78 | .num_resources = ARRAY_SIZE(omap15xx_gpio_resources), | ||
79 | .resource = omap15xx_gpio_resources, | ||
80 | }; | ||
81 | |||
82 | /* | ||
83 | * omap15xx_gpio_init needs to be done before | ||
84 | * machine_init functions access gpio APIs. | ||
85 | * Hence omap15xx_gpio_init is a postcore_initcall. | ||
86 | */ | ||
87 | static int __init omap15xx_gpio_init(void) | ||
88 | { | ||
89 | if (!cpu_is_omap15xx()) | ||
90 | return -EINVAL; | ||
91 | |||
92 | platform_device_register(&omap15xx_mpu_gpio); | ||
93 | platform_device_register(&omap15xx_gpio); | ||
94 | |||
95 | gpio_bank_count = 2; | ||
96 | return 0; | ||
97 | } | ||
98 | postcore_initcall(omap15xx_gpio_init); | ||
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c index e4741905285b..2b0d90109828 100644 --- a/arch/arm/plat-omap/gpio.c +++ b/arch/arm/plat-omap/gpio.c | |||
@@ -205,13 +205,6 @@ struct gpio_bank { | |||
205 | u32 dbck_enable_mask; | 205 | u32 dbck_enable_mask; |
206 | }; | 206 | }; |
207 | 207 | ||
208 | #define METHOD_MPUIO 0 | ||
209 | #define METHOD_GPIO_1510 1 | ||
210 | #define METHOD_GPIO_1610 2 | ||
211 | #define METHOD_GPIO_7XX 3 | ||
212 | #define METHOD_GPIO_24XX 5 | ||
213 | #define METHOD_GPIO_44XX 6 | ||
214 | |||
215 | #ifdef CONFIG_ARCH_OMAP16XX | 208 | #ifdef CONFIG_ARCH_OMAP16XX |
216 | static struct gpio_bank gpio_bank_1610[5] = { | 209 | static struct gpio_bank gpio_bank_1610[5] = { |
217 | { OMAP1_MPUIO_VBASE, NULL, INT_MPUIO, IH_MPUIO_BASE, | 210 | { OMAP1_MPUIO_VBASE, NULL, INT_MPUIO, IH_MPUIO_BASE, |
@@ -335,7 +328,8 @@ static struct gpio_bank gpio_bank_44xx[6] = { | |||
335 | #endif | 328 | #endif |
336 | 329 | ||
337 | static struct gpio_bank *gpio_bank; | 330 | static struct gpio_bank *gpio_bank; |
338 | static int gpio_bank_count; | 331 | /* TODO: Analyze removing gpio_bank_count usage from driver code */ |
332 | int gpio_bank_count; | ||
339 | 333 | ||
340 | static inline struct gpio_bank *get_gpio_bank(int gpio) | 334 | static inline struct gpio_bank *get_gpio_bank(int gpio) |
341 | { | 335 | { |
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h index de1c604962eb..5bef86d76a6a 100644 --- a/arch/arm/plat-omap/include/plat/gpio.h +++ b/arch/arm/plat-omap/include/plat/gpio.h | |||
@@ -27,6 +27,7 @@ | |||
27 | #define __ASM_ARCH_OMAP_GPIO_H | 27 | #define __ASM_ARCH_OMAP_GPIO_H |
28 | 28 | ||
29 | #include <linux/io.h> | 29 | #include <linux/io.h> |
30 | #include <linux/platform_device.h> | ||
30 | #include <mach/irqs.h> | 31 | #include <mach/irqs.h> |
31 | 32 | ||
32 | #define OMAP1_MPUIO_BASE 0xfffb5000 | 33 | #define OMAP1_MPUIO_BASE 0xfffb5000 |
@@ -71,6 +72,23 @@ | |||
71 | IH_MPUIO_BASE + ((nr) & 0x0f) : \ | 72 | IH_MPUIO_BASE + ((nr) & 0x0f) : \ |
72 | IH_GPIO_BASE + (nr)) | 73 | IH_GPIO_BASE + (nr)) |
73 | 74 | ||
75 | #define METHOD_MPUIO 0 | ||
76 | #define METHOD_GPIO_1510 1 | ||
77 | #define METHOD_GPIO_1610 2 | ||
78 | #define METHOD_GPIO_7XX 3 | ||
79 | #define METHOD_GPIO_24XX 5 | ||
80 | #define METHOD_GPIO_44XX 6 | ||
81 | |||
82 | struct omap_gpio_platform_data { | ||
83 | u16 virtual_irq_start; | ||
84 | int bank_type; | ||
85 | int bank_width; /* GPIO bank width */ | ||
86 | bool dbck_flag; /* dbck required or not - True for OMAP3&4 */ | ||
87 | }; | ||
88 | |||
89 | /* TODO: Analyze removing gpio_bank_count usage from driver code */ | ||
90 | extern int gpio_bank_count; | ||
91 | |||
74 | extern int omap_gpio_init(void); /* Call from board init only */ | 92 | extern int omap_gpio_init(void); /* Call from board init only */ |
75 | extern void omap2_gpio_prepare_for_idle(int power_state); | 93 | extern void omap2_gpio_prepare_for_idle(int power_state); |
76 | extern void omap2_gpio_resume_after_idle(void); | 94 | extern void omap2_gpio_resume_after_idle(void); |