]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/devices.c
OMAP3 camera driver: OMAP34XXCAM: Camera Base Address.
[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 #include <linux/io.h>
17
18 #include <mach/hardware.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 #include <mach/eac.h>
27
28 #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
29
30 static struct resource cam_resources[] = {
31         {
32                 .start          = OMAP24XX_CAMERA_BASE,
33                 .end            = OMAP24XX_CAMERA_BASE + 0xfff,
34                 .flags          = IORESOURCE_MEM,
35         },
36         {
37                 .start          = INT_24XX_CAM_IRQ,
38                 .flags          = IORESOURCE_IRQ,
39         }
40 };
41
42 static struct platform_device omap_cam_device = {
43         .name           = "omap24xxcam",
44         .id             = -1,
45         .num_resources  = ARRAY_SIZE(cam_resources),
46         .resource       = cam_resources,
47 };
48
49 static inline void omap_init_camera(void)
50 {
51         platform_device_register(&omap_cam_device);
52 }
53
54 #elif defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
55
56 static struct resource cam_resources[] = {
57         {
58                 .start          = OMAP34XX_CAMERA_BASE,
59                 .end            = OMAP34XX_CAMERA_BASE + 0x1B70,
60                 .flags          = IORESOURCE_MEM,
61         },
62         {
63                 .start          = INT_34XX_CAM_IRQ,
64                 .flags          = IORESOURCE_IRQ,
65         }
66 };
67
68 static struct platform_device omap_cam_device = {
69         .name           = "omap34xxcam",
70         .id             = -1,
71         .num_resources  = ARRAY_SIZE(cam_resources),
72         .resource       = cam_resources,
73 };
74
75 static inline void omap_init_camera(void)
76 {
77         platform_device_register(&omap_cam_device);
78 }
79 #else
80 static inline void omap_init_camera(void)
81 {
82 }
83 #endif
84
85 #if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
86 #define OMAP2_MBOX_BASE         IO_ADDRESS(OMAP24XX_MAILBOX_BASE)
87
88 static struct resource mbox_resources[] = {
89         {
90                 .start          = OMAP2_MBOX_BASE,
91                 .end            = OMAP2_MBOX_BASE + 0x11f,
92                 .flags          = IORESOURCE_MEM,
93         },
94         {
95                 .start          = INT_24XX_MAIL_U0_MPU,
96                 .flags          = IORESOURCE_IRQ,
97         },
98         {
99                 .start          = INT_24XX_MAIL_U3_MPU,
100                 .flags          = IORESOURCE_IRQ,
101         },
102 };
103
104 static struct platform_device mbox_device = {
105         .name           = "mailbox",
106         .id             = -1,
107         .num_resources  = ARRAY_SIZE(mbox_resources),
108         .resource       = mbox_resources,
109 };
110
111 static inline void omap_init_mbox(void)
112 {
113         platform_device_register(&mbox_device);
114 }
115 #else
116 static inline void omap_init_mbox(void) { }
117 #endif
118
119 #if defined(CONFIG_OMAP_STI)
120
121 #if defined(CONFIG_ARCH_OMAP2)
122
123 #define OMAP2_STI_BASE          0x48068000
124 #define OMAP2_STI_CHANNEL_BASE  0x54000000
125 #define OMAP2_STI_IRQ           4
126
127 static struct resource sti_resources[] = {
128         {
129                 .start          = OMAP2_STI_BASE,
130                 .end            = OMAP2_STI_BASE + 0x7ff,
131                 .flags          = IORESOURCE_MEM,
132         },
133         {
134                 .start          = OMAP2_STI_CHANNEL_BASE,
135                 .end            = OMAP2_STI_CHANNEL_BASE + SZ_64K - 1,
136                 .flags          = IORESOURCE_MEM,
137         },
138         {
139                 .start          = OMAP2_STI_IRQ,
140                 .flags          = IORESOURCE_IRQ,
141         }
142 };
143 #elif defined(CONFIG_ARCH_OMAP3)
144
145 #define OMAP3_SDTI_BASE         0x54500000
146 #define OMAP3_SDTI_CHANNEL_BASE 0x54600000
147
148 static struct resource sti_resources[] = {
149         {
150                 .start          = OMAP3_SDTI_BASE,
151                 .end            = OMAP3_SDTI_BASE + 0xFFF,
152                 .flags          = IORESOURCE_MEM,
153         },
154         {
155                 .start          = OMAP3_SDTI_CHANNEL_BASE,
156                 .end            = OMAP3_SDTI_CHANNEL_BASE + SZ_1M - 1,
157                 .flags          = IORESOURCE_MEM,
158         }
159 };
160
161 #endif
162
163 static struct platform_device sti_device = {
164         .name           = "sti",
165         .id             = -1,
166         .num_resources  = ARRAY_SIZE(sti_resources),
167         .resource       = sti_resources,
168 };
169
170 static inline void omap_init_sti(void)
171 {
172         platform_device_register(&sti_device);
173 }
174 #else
175 static inline void omap_init_sti(void) {}
176 #endif
177
178 #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
179
180 #include <mach/mcspi.h>
181
182 #define OMAP2_MCSPI1_BASE               0x48098000
183 #define OMAP2_MCSPI2_BASE               0x4809a000
184 #define OMAP2_MCSPI3_BASE               0x480b8000
185 #define OMAP2_MCSPI4_BASE               0x480ba000
186
187 static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
188         .num_cs         = 4,
189 };
190
191 static struct resource omap2_mcspi1_resources[] = {
192         {
193                 .start          = OMAP2_MCSPI1_BASE,
194                 .end            = OMAP2_MCSPI1_BASE + 0xff,
195                 .flags          = IORESOURCE_MEM,
196         },
197 };
198
199 static struct platform_device omap2_mcspi1 = {
200         .name           = "omap2_mcspi",
201         .id             = 1,
202         .num_resources  = ARRAY_SIZE(omap2_mcspi1_resources),
203         .resource       = omap2_mcspi1_resources,
204         .dev            = {
205                 .platform_data = &omap2_mcspi1_config,
206         },
207 };
208
209 static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
210         .num_cs         = 2,
211 };
212
213 static struct resource omap2_mcspi2_resources[] = {
214         {
215                 .start          = OMAP2_MCSPI2_BASE,
216                 .end            = OMAP2_MCSPI2_BASE + 0xff,
217                 .flags          = IORESOURCE_MEM,
218         },
219 };
220
221 static struct platform_device omap2_mcspi2 = {
222         .name           = "omap2_mcspi",
223         .id             = 2,
224         .num_resources  = ARRAY_SIZE(omap2_mcspi2_resources),
225         .resource       = omap2_mcspi2_resources,
226         .dev            = {
227                 .platform_data = &omap2_mcspi2_config,
228         },
229 };
230
231 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3)
232 static struct omap2_mcspi_platform_config omap2_mcspi3_config = {
233         .num_cs         = 2,
234 };
235
236 static struct resource omap2_mcspi3_resources[] = {
237         {
238         .start          = OMAP2_MCSPI3_BASE,
239         .end            = OMAP2_MCSPI3_BASE + 0xff,
240         .flags          = IORESOURCE_MEM,
241         },
242 };
243
244 static struct platform_device omap2_mcspi3 = {
245         .name           = "omap2_mcspi",
246         .id             = 3,
247         .num_resources  = ARRAY_SIZE(omap2_mcspi3_resources),
248         .resource       = omap2_mcspi3_resources,
249         .dev            = {
250                 .platform_data = &omap2_mcspi3_config,
251         },
252 };
253 #endif
254
255 #ifdef CONFIG_ARCH_OMAP3
256 static struct omap2_mcspi_platform_config omap2_mcspi4_config = {
257         .num_cs         = 1,
258 };
259
260 static struct resource omap2_mcspi4_resources[] = {
261         {
262                 .start          = OMAP2_MCSPI4_BASE,
263                 .end            = OMAP2_MCSPI4_BASE + 0xff,
264                 .flags          = IORESOURCE_MEM,
265         },
266 };
267
268 static struct platform_device omap2_mcspi4 = {
269         .name           = "omap2_mcspi",
270         .id             = 4,
271         .num_resources  = ARRAY_SIZE(omap2_mcspi4_resources),
272         .resource       = omap2_mcspi4_resources,
273         .dev            = {
274                 .platform_data = &omap2_mcspi4_config,
275         },
276 };
277 #endif
278
279 static void omap_init_mcspi(void)
280 {
281         platform_device_register(&omap2_mcspi1);
282         platform_device_register(&omap2_mcspi2);
283 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3)
284         if (cpu_is_omap2430() || cpu_is_omap343x())
285                 platform_device_register(&omap2_mcspi3);
286 #endif
287 #ifdef CONFIG_ARCH_OMAP3
288         if (cpu_is_omap343x())
289                 platform_device_register(&omap2_mcspi4);
290 #endif
291 }
292
293 #else
294 static inline void omap_init_mcspi(void) {}
295 #endif
296
297 #ifdef CONFIG_SND_OMAP24XX_EAC
298
299 #define OMAP2_EAC_BASE                  (L4_24XX_BASE + 0x90000)
300
301 static struct resource omap2_eac_resources[] = {
302         {
303                 .start          = OMAP2_EAC_BASE,
304                 .end            = OMAP2_EAC_BASE + 0xfff,
305                 .flags          = IORESOURCE_MEM,
306         },
307 };
308
309 static struct platform_device omap2_eac_device = {
310         .name           = "omap24xx-eac",
311         .id             = -1,
312         .num_resources  = ARRAY_SIZE(omap2_eac_resources),
313         .resource       = omap2_eac_resources,
314         .dev = {
315                 .platform_data = NULL,
316         },
317 };
318
319 void omap_init_eac(struct eac_platform_data *pdata)
320 {
321         omap2_eac_device.dev.platform_data = pdata;
322         platform_device_register(&omap2_eac_device);
323 }
324
325 #else
326 void omap_init_eac(struct eac_platform_data *pdata) {}
327 #endif
328
329 #ifdef CONFIG_OMAP_SHA1_MD5
330 static struct resource sha1_md5_resources[] = {
331         {
332                 .start  = OMAP24XX_SEC_SHA1MD5_BASE,
333                 .end    = OMAP24XX_SEC_SHA1MD5_BASE + 0x64,
334                 .flags  = IORESOURCE_MEM,
335         },
336         {
337                 .start  = INT_24XX_SHA1MD5,
338                 .flags  = IORESOURCE_IRQ,
339         }
340 };
341
342 static struct platform_device sha1_md5_device = {
343         .name           = "OMAP SHA1/MD5",
344         .id             = -1,
345         .num_resources  = ARRAY_SIZE(sha1_md5_resources),
346         .resource       = sha1_md5_resources,
347 };
348
349 static void omap_init_sha1_md5(void)
350 {
351         platform_device_register(&sha1_md5_device);
352 }
353 #else
354 static inline void omap_init_sha1_md5(void) { }
355 #endif
356
357 #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
358 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
359 #define OMAP_HDQ_BASE   0x480B2000
360 #endif
361 static struct resource omap_hdq_resources[] = {
362         {
363                 .start          = OMAP_HDQ_BASE,
364                 .end            = OMAP_HDQ_BASE + 0x1C,
365                 .flags          = IORESOURCE_MEM,
366         },
367         {
368                 .start          = INT_24XX_HDQ_IRQ,
369                 .flags          = IORESOURCE_IRQ,
370         },
371 };
372 static struct platform_device omap_hdq_dev = {
373         .name = "omap_hdq",
374         .id = 0,
375         .dev = {
376                 .platform_data = NULL,
377         },
378         .num_resources  = ARRAY_SIZE(omap_hdq_resources),
379         .resource       = omap_hdq_resources,
380 };
381 static inline void omap_hdq_init(void)
382 {
383         (void) platform_device_register(&omap_hdq_dev);
384 }
385 #else
386 static inline void omap_hdq_init(void) {}
387 #endif
388
389 /*-------------------------------------------------------------------------*/
390
391 static int __init omap2_init_devices(void)
392 {
393         /* please keep these calls, and their implementations above,
394          * in alphabetical order so they're easier to sort through.
395          */
396         omap_init_camera();
397         omap_init_mbox();
398         omap_init_mcspi();
399         omap_hdq_init();
400         omap_init_sti();
401         omap_init_sha1_md5();
402
403         return 0;
404 }
405 arch_initcall(omap2_init_devices);