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 <asm/hardware.h>
19 #include <asm/mach-types.h>
20 #include <asm/mach/map.h>
22 #include <asm/arch/tc.h>
23 #include <asm/arch/board.h>
24 #include <asm/arch/mux.h>
25 #include <asm/arch/gpio.h>
26 #include <asm/arch/eac.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 #define OMAP2_STI_BASE IO_ADDRESS(0x48068000)
96 #define OMAP2_STI_CHANNEL_BASE 0x54000000
97 #define OMAP2_STI_IRQ 4
99 static struct resource sti_resources[] = {
101 .start = OMAP2_STI_BASE,
102 .end = OMAP2_STI_BASE + 0x7ff,
103 .flags = IORESOURCE_MEM,
106 .start = OMAP2_STI_CHANNEL_BASE,
107 .end = OMAP2_STI_CHANNEL_BASE + SZ_64K - 1,
108 .flags = IORESOURCE_MEM,
111 .start = OMAP2_STI_IRQ,
112 .flags = IORESOURCE_IRQ,
116 static struct platform_device sti_device = {
119 .num_resources = ARRAY_SIZE(sti_resources),
120 .resource = sti_resources,
123 static inline void omap_init_sti(void)
125 platform_device_register(&sti_device);
128 static inline void omap_init_sti(void) {}
131 #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
133 #include <asm/arch/mcspi.h>
135 #define OMAP2_MCSPI1_BASE 0x48098000
136 #define OMAP2_MCSPI2_BASE 0x4809a000
137 #define OMAP2_MCSPI3_BASE 0x480b8000
138 #define OMAP2_MCSPI4_BASE 0x480ba000
140 static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
144 static struct resource omap2_mcspi1_resources[] = {
146 .start = OMAP2_MCSPI1_BASE,
147 .end = OMAP2_MCSPI1_BASE + 0xff,
148 .flags = IORESOURCE_MEM,
152 static struct platform_device omap2_mcspi1 = {
153 .name = "omap2_mcspi",
155 .num_resources = ARRAY_SIZE(omap2_mcspi1_resources),
156 .resource = omap2_mcspi1_resources,
158 .platform_data = &omap2_mcspi1_config,
162 static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
166 static struct resource omap2_mcspi2_resources[] = {
168 .start = OMAP2_MCSPI2_BASE,
169 .end = OMAP2_MCSPI2_BASE + 0xff,
170 .flags = IORESOURCE_MEM,
174 static struct platform_device omap2_mcspi2 = {
175 .name = "omap2_mcspi",
177 .num_resources = ARRAY_SIZE(omap2_mcspi2_resources),
178 .resource = omap2_mcspi2_resources,
180 .platform_data = &omap2_mcspi2_config,
184 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3)
185 static struct omap2_mcspi_platform_config omap2_mcspi3_config = {
189 static struct resource omap2_mcspi3_resources[] = {
191 .start = OMAP2_MCSPI3_BASE,
192 .end = OMAP2_MCSPI3_BASE + 0xff,
193 .flags = IORESOURCE_MEM,
197 static struct platform_device omap2_mcspi3 = {
198 .name = "omap2_mcspi",
200 .num_resources = ARRAY_SIZE(omap2_mcspi3_resources),
201 .resource = omap2_mcspi3_resources,
203 .platform_data = &omap2_mcspi3_config,
208 #ifdef CONFIG_ARCH_OMAP3
209 static struct omap2_mcspi_platform_config omap2_mcspi4_config = {
213 static struct resource omap2_mcspi4_resources[] = {
215 .start = OMAP2_MCSPI4_BASE,
216 .end = OMAP2_MCSPI4_BASE + 0xff,
217 .flags = IORESOURCE_MEM,
221 static struct platform_device omap2_mcspi4 = {
222 .name = "omap2_mcspi",
224 .num_resources = ARRAY_SIZE(omap2_mcspi4_resources),
225 .resource = omap2_mcspi4_resources,
227 .platform_data = &omap2_mcspi4_config,
232 static void omap_init_mcspi(void)
234 platform_device_register(&omap2_mcspi1);
235 platform_device_register(&omap2_mcspi2);
236 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3)
237 platform_device_register(&omap2_mcspi3);
239 #ifdef CONFIG_ARCH_OMAP3
240 platform_device_register(&omap2_mcspi4);
245 static inline void omap_init_mcspi(void) {}
248 #ifdef CONFIG_SND_OMAP24XX_EAC
250 #define OMAP2_EAC_BASE 0x48090000
252 static struct resource omap2_eac_resources[] = {
254 .start = OMAP2_EAC_BASE,
255 .end = OMAP2_EAC_BASE + 0x109,
256 .flags = IORESOURCE_MEM,
260 static struct platform_device omap2_eac_device = {
261 .name = "omap24xx-eac",
263 .num_resources = ARRAY_SIZE(omap2_eac_resources),
264 .resource = omap2_eac_resources,
266 .platform_data = NULL,
270 void omap_init_eac(struct eac_platform_data *pdata)
272 omap2_eac_device.dev.platform_data = pdata;
273 platform_device_register(&omap2_eac_device);
277 void omap_init_eac(struct eac_platform_data *pdata) {}
280 #ifdef CONFIG_OMAP_SHA1_MD5
281 static struct resource sha1_md5_resources[] = {
283 .start = OMAP24XX_SEC_SHA1MD5_BASE,
284 .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64,
285 .flags = IORESOURCE_MEM,
288 .start = INT_24XX_SHA1MD5,
289 .flags = IORESOURCE_IRQ,
293 static struct platform_device sha1_md5_device = {
294 .name = "OMAP SHA1/MD5",
296 .num_resources = ARRAY_SIZE(sha1_md5_resources),
297 .resource = sha1_md5_resources,
300 static void omap_init_sha1_md5(void)
302 platform_device_register(&sha1_md5_device);
305 static inline void omap_init_sha1_md5(void) { }
308 #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
309 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
310 #define OMAP_HDQ_BASE 0x480B2000
312 static struct resource omap_hdq_resources[] = {
314 .start = OMAP_HDQ_BASE,
315 .end = OMAP_HDQ_BASE + 0x1C,
316 .flags = IORESOURCE_MEM,
319 .start = INT_24XX_HDQ_IRQ,
320 .flags = IORESOURCE_IRQ,
323 static struct platform_device omap_hdq_dev = {
327 .platform_data = NULL,
329 .num_resources = ARRAY_SIZE(omap_hdq_resources),
330 .resource = omap_hdq_resources,
332 static inline void omap_hdq_init(void)
334 (void) platform_device_register(&omap_hdq_dev);
337 static inline void omap_hdq_init(void) {}
340 /*-------------------------------------------------------------------------*/
342 static int __init omap2_init_devices(void)
344 /* please keep these calls, and their implementations above,
345 * in alphabetical order so they're easier to sort through.
352 omap_init_sha1_md5();
356 arch_initcall(omap2_init_devices);