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 static inline void omap_init_camera(void)
59 #if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
60 #define OMAP2_MBOX_BASE IO_ADDRESS(OMAP24XX_MAILBOX_BASE)
62 static struct resource mbox_resources[] = {
64 .start = OMAP2_MBOX_BASE,
65 .end = OMAP2_MBOX_BASE + 0x11f,
66 .flags = IORESOURCE_MEM,
69 .start = INT_24XX_MAIL_U0_MPU,
70 .flags = IORESOURCE_IRQ,
73 .start = INT_24XX_MAIL_U3_MPU,
74 .flags = IORESOURCE_IRQ,
78 static struct platform_device mbox_device = {
81 .num_resources = ARRAY_SIZE(mbox_resources),
82 .resource = mbox_resources,
85 static inline void omap_init_mbox(void)
87 platform_device_register(&mbox_device);
90 static inline void omap_init_mbox(void) { }
93 #if defined(CONFIG_OMAP_STI)
95 #if defined(CONFIG_ARCH_OMAP2)
97 #define OMAP2_STI_BASE 0x48068000
98 #define OMAP2_STI_CHANNEL_BASE 0x54000000
99 #define OMAP2_STI_IRQ 4
101 static struct resource sti_resources[] = {
103 .start = OMAP2_STI_BASE,
104 .end = OMAP2_STI_BASE + 0x7ff,
105 .flags = IORESOURCE_MEM,
108 .start = OMAP2_STI_CHANNEL_BASE,
109 .end = OMAP2_STI_CHANNEL_BASE + SZ_64K - 1,
110 .flags = IORESOURCE_MEM,
113 .start = OMAP2_STI_IRQ,
114 .flags = IORESOURCE_IRQ,
117 #elif defined(CONFIG_ARCH_OMAP3)
119 #define OMAP3_SDTI_BASE 0x54500000
120 #define OMAP3_SDTI_CHANNEL_BASE 0x54600000
122 static struct resource sti_resources[] = {
124 .start = OMAP3_SDTI_BASE,
125 .end = OMAP3_SDTI_BASE + 0xFFF,
126 .flags = IORESOURCE_MEM,
129 .start = OMAP3_SDTI_CHANNEL_BASE,
130 .end = OMAP3_SDTI_CHANNEL_BASE + SZ_1M - 1,
131 .flags = IORESOURCE_MEM,
137 static struct platform_device sti_device = {
140 .num_resources = ARRAY_SIZE(sti_resources),
141 .resource = sti_resources,
144 static inline void omap_init_sti(void)
146 platform_device_register(&sti_device);
149 static inline void omap_init_sti(void) {}
152 #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
154 #include <mach/mcspi.h>
156 #define OMAP2_MCSPI1_BASE 0x48098000
157 #define OMAP2_MCSPI2_BASE 0x4809a000
158 #define OMAP2_MCSPI3_BASE 0x480b8000
159 #define OMAP2_MCSPI4_BASE 0x480ba000
161 static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
165 static struct resource omap2_mcspi1_resources[] = {
167 .start = OMAP2_MCSPI1_BASE,
168 .end = OMAP2_MCSPI1_BASE + 0xff,
169 .flags = IORESOURCE_MEM,
173 static struct platform_device omap2_mcspi1 = {
174 .name = "omap2_mcspi",
176 .num_resources = ARRAY_SIZE(omap2_mcspi1_resources),
177 .resource = omap2_mcspi1_resources,
179 .platform_data = &omap2_mcspi1_config,
183 static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
187 static struct resource omap2_mcspi2_resources[] = {
189 .start = OMAP2_MCSPI2_BASE,
190 .end = OMAP2_MCSPI2_BASE + 0xff,
191 .flags = IORESOURCE_MEM,
195 static struct platform_device omap2_mcspi2 = {
196 .name = "omap2_mcspi",
198 .num_resources = ARRAY_SIZE(omap2_mcspi2_resources),
199 .resource = omap2_mcspi2_resources,
201 .platform_data = &omap2_mcspi2_config,
205 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3)
206 static struct omap2_mcspi_platform_config omap2_mcspi3_config = {
210 static struct resource omap2_mcspi3_resources[] = {
212 .start = OMAP2_MCSPI3_BASE,
213 .end = OMAP2_MCSPI3_BASE + 0xff,
214 .flags = IORESOURCE_MEM,
218 static struct platform_device omap2_mcspi3 = {
219 .name = "omap2_mcspi",
221 .num_resources = ARRAY_SIZE(omap2_mcspi3_resources),
222 .resource = omap2_mcspi3_resources,
224 .platform_data = &omap2_mcspi3_config,
229 #ifdef CONFIG_ARCH_OMAP3
230 static struct omap2_mcspi_platform_config omap2_mcspi4_config = {
234 static struct resource omap2_mcspi4_resources[] = {
236 .start = OMAP2_MCSPI4_BASE,
237 .end = OMAP2_MCSPI4_BASE + 0xff,
238 .flags = IORESOURCE_MEM,
242 static struct platform_device omap2_mcspi4 = {
243 .name = "omap2_mcspi",
245 .num_resources = ARRAY_SIZE(omap2_mcspi4_resources),
246 .resource = omap2_mcspi4_resources,
248 .platform_data = &omap2_mcspi4_config,
253 static void omap_init_mcspi(void)
255 platform_device_register(&omap2_mcspi1);
256 platform_device_register(&omap2_mcspi2);
257 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3)
258 if (cpu_is_omap2430() || cpu_is_omap343x())
259 platform_device_register(&omap2_mcspi3);
261 #ifdef CONFIG_ARCH_OMAP3
262 if (cpu_is_omap343x())
263 platform_device_register(&omap2_mcspi4);
268 static inline void omap_init_mcspi(void) {}
271 #ifdef CONFIG_SND_OMAP24XX_EAC
273 #define OMAP2_EAC_BASE (L4_24XX_BASE + 0x90000)
275 static struct resource omap2_eac_resources[] = {
277 .start = OMAP2_EAC_BASE,
278 .end = OMAP2_EAC_BASE + 0xfff,
279 .flags = IORESOURCE_MEM,
283 static struct platform_device omap2_eac_device = {
284 .name = "omap24xx-eac",
286 .num_resources = ARRAY_SIZE(omap2_eac_resources),
287 .resource = omap2_eac_resources,
289 .platform_data = NULL,
293 void omap_init_eac(struct eac_platform_data *pdata)
295 omap2_eac_device.dev.platform_data = pdata;
296 platform_device_register(&omap2_eac_device);
300 void omap_init_eac(struct eac_platform_data *pdata) {}
303 #ifdef CONFIG_OMAP_SHA1_MD5
304 static struct resource sha1_md5_resources[] = {
306 .start = OMAP24XX_SEC_SHA1MD5_BASE,
307 .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64,
308 .flags = IORESOURCE_MEM,
311 .start = INT_24XX_SHA1MD5,
312 .flags = IORESOURCE_IRQ,
316 static struct platform_device sha1_md5_device = {
317 .name = "OMAP SHA1/MD5",
319 .num_resources = ARRAY_SIZE(sha1_md5_resources),
320 .resource = sha1_md5_resources,
323 static void omap_init_sha1_md5(void)
325 platform_device_register(&sha1_md5_device);
328 static inline void omap_init_sha1_md5(void) { }
331 #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
332 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
333 #define OMAP_HDQ_BASE 0x480B2000
335 static struct resource omap_hdq_resources[] = {
337 .start = OMAP_HDQ_BASE,
338 .end = OMAP_HDQ_BASE + 0x1C,
339 .flags = IORESOURCE_MEM,
342 .start = INT_24XX_HDQ_IRQ,
343 .flags = IORESOURCE_IRQ,
346 static struct platform_device omap_hdq_dev = {
350 .platform_data = NULL,
352 .num_resources = ARRAY_SIZE(omap_hdq_resources),
353 .resource = omap_hdq_resources,
355 static inline void omap_hdq_init(void)
357 (void) platform_device_register(&omap_hdq_dev);
360 static inline void omap_hdq_init(void) {}
363 /*-------------------------------------------------------------------------*/
365 static int __init omap2_init_devices(void)
367 /* please keep these calls, and their implementations above,
368 * in alphabetical order so they're easier to sort through.
375 omap_init_sha1_md5();
379 arch_initcall(omap2_init_devices);