2 * linux/arch/arm/mach-omap2/devices.c
4 * OMAP2 platform device setup/initialization
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.
12 #include <linux/module.h>
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/platform_device.h>
18 #include <mach/hardware.h>
19 #include <asm/mach-types.h>
20 #include <asm/mach/map.h>
23 #include <mach/board.h>
25 #include <mach/gpio.h>
28 #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
30 static struct resource cam_resources[] = {
32 .start = OMAP24XX_CAMERA_BASE,
33 .end = OMAP24XX_CAMERA_BASE + 0xfff,
34 .flags = IORESOURCE_MEM,
37 .start = INT_24XX_CAM_IRQ,
38 .flags = IORESOURCE_IRQ,
42 static struct platform_device omap_cam_device = {
43 .name = "omap24xxcam",
45 .num_resources = ARRAY_SIZE(cam_resources),
46 .resource = cam_resources,
49 static inline void omap_init_camera(void)
51 platform_device_register(&omap_cam_device);
54 #elif defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
56 static struct resource cam_resources[] = {
58 .start = OMAP34XX_CAMERA_BASE,
59 .end = OMAP34XX_CAMERA_BASE + 0x1B70,
60 .flags = IORESOURCE_MEM,
63 .start = INT_34XX_CAM_IRQ,
64 .flags = IORESOURCE_IRQ,
68 static struct platform_device omap_cam_device = {
69 .name = "omap34xxcam",
71 .num_resources = ARRAY_SIZE(cam_resources),
72 .resource = cam_resources,
75 static inline void omap_init_camera(void)
77 platform_device_register(&omap_cam_device);
80 static inline void omap_init_camera(void)
85 #if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
86 #define OMAP2_MBOX_BASE IO_ADDRESS(OMAP24XX_MAILBOX_BASE)
88 static struct resource mbox_resources[] = {
90 .start = OMAP2_MBOX_BASE,
91 .end = OMAP2_MBOX_BASE + 0x11f,
92 .flags = IORESOURCE_MEM,
95 .start = INT_24XX_MAIL_U0_MPU,
96 .flags = IORESOURCE_IRQ,
99 .start = INT_24XX_MAIL_U3_MPU,
100 .flags = IORESOURCE_IRQ,
104 static struct platform_device mbox_device = {
107 .num_resources = ARRAY_SIZE(mbox_resources),
108 .resource = mbox_resources,
111 static inline void omap_init_mbox(void)
113 platform_device_register(&mbox_device);
116 static inline void omap_init_mbox(void) { }
119 #if defined(CONFIG_OMAP_STI)
121 #if defined(CONFIG_ARCH_OMAP2)
123 #define OMAP2_STI_BASE 0x48068000
124 #define OMAP2_STI_CHANNEL_BASE 0x54000000
125 #define OMAP2_STI_IRQ 4
127 static struct resource sti_resources[] = {
129 .start = OMAP2_STI_BASE,
130 .end = OMAP2_STI_BASE + 0x7ff,
131 .flags = IORESOURCE_MEM,
134 .start = OMAP2_STI_CHANNEL_BASE,
135 .end = OMAP2_STI_CHANNEL_BASE + SZ_64K - 1,
136 .flags = IORESOURCE_MEM,
139 .start = OMAP2_STI_IRQ,
140 .flags = IORESOURCE_IRQ,
143 #elif defined(CONFIG_ARCH_OMAP3)
145 #define OMAP3_SDTI_BASE 0x54500000
146 #define OMAP3_SDTI_CHANNEL_BASE 0x54600000
148 static struct resource sti_resources[] = {
150 .start = OMAP3_SDTI_BASE,
151 .end = OMAP3_SDTI_BASE + 0xFFF,
152 .flags = IORESOURCE_MEM,
155 .start = OMAP3_SDTI_CHANNEL_BASE,
156 .end = OMAP3_SDTI_CHANNEL_BASE + SZ_1M - 1,
157 .flags = IORESOURCE_MEM,
163 static struct platform_device sti_device = {
166 .num_resources = ARRAY_SIZE(sti_resources),
167 .resource = sti_resources,
170 static inline void omap_init_sti(void)
172 platform_device_register(&sti_device);
175 static inline void omap_init_sti(void) {}
178 #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
180 #include <mach/mcspi.h>
182 #define OMAP2_MCSPI1_BASE 0x48098000
183 #define OMAP2_MCSPI2_BASE 0x4809a000
184 #define OMAP2_MCSPI3_BASE 0x480b8000
185 #define OMAP2_MCSPI4_BASE 0x480ba000
187 static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
191 static struct resource omap2_mcspi1_resources[] = {
193 .start = OMAP2_MCSPI1_BASE,
194 .end = OMAP2_MCSPI1_BASE + 0xff,
195 .flags = IORESOURCE_MEM,
199 static struct platform_device omap2_mcspi1 = {
200 .name = "omap2_mcspi",
202 .num_resources = ARRAY_SIZE(omap2_mcspi1_resources),
203 .resource = omap2_mcspi1_resources,
205 .platform_data = &omap2_mcspi1_config,
209 static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
213 static struct resource omap2_mcspi2_resources[] = {
215 .start = OMAP2_MCSPI2_BASE,
216 .end = OMAP2_MCSPI2_BASE + 0xff,
217 .flags = IORESOURCE_MEM,
221 static struct platform_device omap2_mcspi2 = {
222 .name = "omap2_mcspi",
224 .num_resources = ARRAY_SIZE(omap2_mcspi2_resources),
225 .resource = omap2_mcspi2_resources,
227 .platform_data = &omap2_mcspi2_config,
231 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3)
232 static struct omap2_mcspi_platform_config omap2_mcspi3_config = {
236 static struct resource omap2_mcspi3_resources[] = {
238 .start = OMAP2_MCSPI3_BASE,
239 .end = OMAP2_MCSPI3_BASE + 0xff,
240 .flags = IORESOURCE_MEM,
244 static struct platform_device omap2_mcspi3 = {
245 .name = "omap2_mcspi",
247 .num_resources = ARRAY_SIZE(omap2_mcspi3_resources),
248 .resource = omap2_mcspi3_resources,
250 .platform_data = &omap2_mcspi3_config,
255 #ifdef CONFIG_ARCH_OMAP3
256 static struct omap2_mcspi_platform_config omap2_mcspi4_config = {
260 static struct resource omap2_mcspi4_resources[] = {
262 .start = OMAP2_MCSPI4_BASE,
263 .end = OMAP2_MCSPI4_BASE + 0xff,
264 .flags = IORESOURCE_MEM,
268 static struct platform_device omap2_mcspi4 = {
269 .name = "omap2_mcspi",
271 .num_resources = ARRAY_SIZE(omap2_mcspi4_resources),
272 .resource = omap2_mcspi4_resources,
274 .platform_data = &omap2_mcspi4_config,
279 static void omap_init_mcspi(void)
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);
287 #ifdef CONFIG_ARCH_OMAP3
288 if (cpu_is_omap343x())
289 platform_device_register(&omap2_mcspi4);
294 static inline void omap_init_mcspi(void) {}
297 #ifdef CONFIG_SND_OMAP24XX_EAC
299 #define OMAP2_EAC_BASE (L4_24XX_BASE + 0x90000)
301 static struct resource omap2_eac_resources[] = {
303 .start = OMAP2_EAC_BASE,
304 .end = OMAP2_EAC_BASE + 0xfff,
305 .flags = IORESOURCE_MEM,
309 static struct platform_device omap2_eac_device = {
310 .name = "omap24xx-eac",
312 .num_resources = ARRAY_SIZE(omap2_eac_resources),
313 .resource = omap2_eac_resources,
315 .platform_data = NULL,
319 void omap_init_eac(struct eac_platform_data *pdata)
321 omap2_eac_device.dev.platform_data = pdata;
322 platform_device_register(&omap2_eac_device);
326 void omap_init_eac(struct eac_platform_data *pdata) {}
329 #ifdef CONFIG_OMAP_SHA1_MD5
330 static struct resource sha1_md5_resources[] = {
332 .start = OMAP24XX_SEC_SHA1MD5_BASE,
333 .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64,
334 .flags = IORESOURCE_MEM,
337 .start = INT_24XX_SHA1MD5,
338 .flags = IORESOURCE_IRQ,
342 static struct platform_device sha1_md5_device = {
343 .name = "OMAP SHA1/MD5",
345 .num_resources = ARRAY_SIZE(sha1_md5_resources),
346 .resource = sha1_md5_resources,
349 static void omap_init_sha1_md5(void)
351 platform_device_register(&sha1_md5_device);
354 static inline void omap_init_sha1_md5(void) { }
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
361 static struct resource omap_hdq_resources[] = {
363 .start = OMAP_HDQ_BASE,
364 .end = OMAP_HDQ_BASE + 0x1C,
365 .flags = IORESOURCE_MEM,
368 .start = INT_24XX_HDQ_IRQ,
369 .flags = IORESOURCE_IRQ,
372 static struct platform_device omap_hdq_dev = {
376 .platform_data = NULL,
378 .num_resources = ARRAY_SIZE(omap_hdq_resources),
379 .resource = omap_hdq_resources,
381 static inline void omap_hdq_init(void)
383 (void) platform_device_register(&omap_hdq_dev);
386 static inline void omap_hdq_init(void) {}
389 /*-------------------------------------------------------------------------*/
391 static int __init omap2_init_devices(void)
393 /* please keep these calls, and their implementations above,
394 * in alphabetical order so they're easier to sort through.
401 omap_init_sha1_md5();
405 arch_initcall(omap2_init_devices);