]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/devices.c
omap mailbox: remove unnecessary header file inclusion
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / devices.c
1 /*
2  * linux/arch/arm/mach-omap2/devices.c
3  *
4  * OMAP2 platform device setup/initialization
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  */
11
12 #include <linux/module.h>
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/platform_device.h>
16
17 #include <mach/hardware.h>
18 #include <asm/io.h>
19 #include <asm/mach-types.h>
20 #include <asm/mach/map.h>
21
22 #include <mach/tc.h>
23 #include <mach/board.h>
24 #include <mach/mux.h>
25 #include <mach/gpio.h>
26
27 #if     defined(CONFIG_I2C_OMAP) || defined(CONFIG_I2C_OMAP_MODULE)
28
29 #define OMAP2_I2C_BASE2         0x48072000
30 #define OMAP2_I2C_INT2          57
31
32 static struct resource i2c_resources2[] = {
33         {
34                 .start          = OMAP2_I2C_BASE2,
35                 .end            = OMAP2_I2C_BASE2 + 0x3f,
36                 .flags          = IORESOURCE_MEM,
37         },
38         {
39                 .start          = OMAP2_I2C_INT2,
40                 .flags          = IORESOURCE_IRQ,
41         },
42 };
43
44 static struct platform_device omap_i2c_device2 = {
45         .name           = "i2c_omap",
46         .id             = 2,
47         .num_resources  = ARRAY_SIZE(i2c_resources2),
48         .resource       = i2c_resources2,
49 };
50
51 /* See also arch/arm/plat-omap/devices.c for first I2C on 24xx */
52 static void omap_init_i2c(void)
53 {
54         /* REVISIT: Second I2C not in use on H4? */
55         if (machine_is_omap_h4())
56                 return;
57
58         if (!cpu_is_omap2430()) {
59                 omap_cfg_reg(J15_24XX_I2C2_SCL);
60                 omap_cfg_reg(H19_24XX_I2C2_SDA);
61         }
62         (void) platform_device_register(&omap_i2c_device2);
63 }
64
65 #else
66
67 static void omap_init_i2c(void) {}
68
69 #endif
70
71 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
72
73 #define MBOX_REG_SIZE   0x120
74
75 static struct resource omap2_mbox_resources[] = {
76         {
77                 .start          = OMAP24XX_MAILBOX_BASE,
78                 .end            = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
79                 .flags          = IORESOURCE_MEM,
80         },
81         {
82                 .start          = INT_24XX_MAIL_U0_MPU,
83                 .flags          = IORESOURCE_IRQ,
84         },
85         {
86                 .start          = INT_24XX_MAIL_U3_MPU,
87                 .flags          = IORESOURCE_IRQ,
88         },
89 };
90
91 static struct resource omap3_mbox_resources[] = {
92         {
93                 .start          = OMAP34XX_MAILBOX_BASE,
94                 .end            = OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
95                 .flags          = IORESOURCE_MEM,
96         },
97         {
98                 .start          = INT_34XX_MAIL_U0_MPU,
99                 .flags          = IORESOURCE_IRQ,
100         },
101 };
102
103 static struct platform_device mbox_device = {
104         .name           = "omap2-mailbox",
105         .id             = -1,
106 };
107
108 static inline void omap_init_mbox(void)
109 {
110         if (cpu_is_omap2420()) {
111                 mbox_device.num_resources = ARRAY_SIZE(omap2_mbox_resources);
112                 mbox_device.resource = omap2_mbox_resources;
113         } else if (cpu_is_omap3430()) {
114                 mbox_device.num_resources = ARRAY_SIZE(omap3_mbox_resources);
115                 mbox_device.resource = omap3_mbox_resources;
116         } else {
117                 return;
118         }
119         platform_device_register(&mbox_device);
120 }
121 #else
122 static inline void omap_init_mbox(void) { }
123 #endif /* CONFIG_OMAP_MBOX_FWK */
124
125 #if defined(CONFIG_OMAP_STI)
126
127 #define OMAP2_STI_BASE          IO_ADDRESS(0x48068000)
128 #define OMAP2_STI_CHANNEL_BASE  0x54000000
129 #define OMAP2_STI_IRQ           4
130
131 static struct resource sti_resources[] = {
132         {
133                 .start          = OMAP2_STI_BASE,
134                 .end            = OMAP2_STI_BASE + 0x7ff,
135                 .flags          = IORESOURCE_MEM,
136         },
137         {
138                 .start          = OMAP2_STI_CHANNEL_BASE,
139                 .end            = OMAP2_STI_CHANNEL_BASE + SZ_64K - 1,
140                 .flags          = IORESOURCE_MEM,
141         },
142         {
143                 .start          = OMAP2_STI_IRQ,
144                 .flags          = IORESOURCE_IRQ,
145         }
146 };
147
148 static struct platform_device sti_device = {
149         .name           = "sti",
150         .id             = -1,
151         .num_resources  = ARRAY_SIZE(sti_resources),
152         .resource       = sti_resources,
153 };
154
155 static inline void omap_init_sti(void)
156 {
157         platform_device_register(&sti_device);
158 }
159 #else
160 static inline void omap_init_sti(void) {}
161 #endif
162
163 #if defined(CONFIG_SPI_OMAP24XX)
164
165 #include <mach/mcspi.h>
166
167 #define OMAP2_MCSPI1_BASE               0x48098000
168 #define OMAP2_MCSPI2_BASE               0x4809a000
169
170 static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
171         .num_cs         = 4,
172 };
173
174 static struct resource omap2_mcspi1_resources[] = {
175         {
176                 .start          = OMAP2_MCSPI1_BASE,
177                 .end            = OMAP2_MCSPI1_BASE + 0xff,
178                 .flags          = IORESOURCE_MEM,
179         },
180 };
181
182 struct platform_device omap2_mcspi1 = {
183         .name           = "omap2_mcspi",
184         .id             = 1,
185         .num_resources  = ARRAY_SIZE(omap2_mcspi1_resources),
186         .resource       = omap2_mcspi1_resources,
187         .dev            = {
188                 .platform_data = &omap2_mcspi1_config,
189         },
190 };
191
192 static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
193         .num_cs         = 2,
194 };
195
196 static struct resource omap2_mcspi2_resources[] = {
197         {
198                 .start          = OMAP2_MCSPI2_BASE,
199                 .end            = OMAP2_MCSPI2_BASE + 0xff,
200                 .flags          = IORESOURCE_MEM,
201         },
202 };
203
204 struct platform_device omap2_mcspi2 = {
205         .name           = "omap2_mcspi",
206         .id             = 2,
207         .num_resources  = ARRAY_SIZE(omap2_mcspi2_resources),
208         .resource       = omap2_mcspi2_resources,
209         .dev            = {
210                 .platform_data = &omap2_mcspi2_config,
211         },
212 };
213
214 static void omap_init_mcspi(void)
215 {
216         platform_device_register(&omap2_mcspi1);
217         platform_device_register(&omap2_mcspi2);
218 }
219
220 #else
221 static inline void omap_init_mcspi(void) {}
222 #endif
223
224 /*-------------------------------------------------------------------------*/
225
226 static int __init omap2_init_devices(void)
227 {
228         /* please keep these calls, and their implementations above,
229          * in alphabetical order so they're easier to sort through.
230          */
231         omap_init_i2c();
232         omap_init_mbox();
233         omap_init_mcspi();
234         omap_init_sti();
235
236         return 0;
237 }
238 arch_initcall(omap2_init_devices);