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>
29 #if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
30 #define OMAP2_MBOX_BASE IO_ADDRESS(OMAP24XX_MAILBOX_BASE)
32 static struct resource mbox_resources[] = {
34 .start = OMAP2_MBOX_BASE,
35 .end = OMAP2_MBOX_BASE + 0x11f,
36 .flags = IORESOURCE_MEM,
39 .start = INT_24XX_MAIL_U0_MPU,
40 .flags = IORESOURCE_IRQ,
43 .start = INT_24XX_MAIL_U3_MPU,
44 .flags = IORESOURCE_IRQ,
48 static struct platform_device mbox_device = {
51 .num_resources = ARRAY_SIZE(mbox_resources),
52 .resource = mbox_resources,
55 static inline void omap_init_mbox(void)
57 platform_device_register(&mbox_device);
60 static inline void omap_init_mbox(void) { }
63 #if defined(CONFIG_OMAP_STI)
65 #if defined(CONFIG_ARCH_OMAP2)
67 #define OMAP2_STI_BASE 0x48068000
68 #define OMAP2_STI_CHANNEL_BASE 0x54000000
69 #define OMAP2_STI_IRQ 4
71 static struct resource sti_resources[] = {
73 .start = OMAP2_STI_BASE,
74 .end = OMAP2_STI_BASE + 0x7ff,
75 .flags = IORESOURCE_MEM,
78 .start = OMAP2_STI_CHANNEL_BASE,
79 .end = OMAP2_STI_CHANNEL_BASE + SZ_64K - 1,
80 .flags = IORESOURCE_MEM,
83 .start = OMAP2_STI_IRQ,
84 .flags = IORESOURCE_IRQ,
87 #elif defined(CONFIG_ARCH_OMAP3)
89 #define OMAP3_SDTI_BASE 0x54500000
90 #define OMAP3_SDTI_CHANNEL_BASE 0x54600000
92 static struct resource sti_resources[] = {
94 .start = OMAP3_SDTI_BASE,
95 .end = OMAP3_SDTI_BASE + 0xFFF,
96 .flags = IORESOURCE_MEM,
99 .start = OMAP3_SDTI_CHANNEL_BASE,
100 .end = OMAP3_SDTI_CHANNEL_BASE + SZ_1M - 1,
101 .flags = IORESOURCE_MEM,
107 static struct platform_device sti_device = {
110 .num_resources = ARRAY_SIZE(sti_resources),
111 .resource = sti_resources,
114 static inline void omap_init_sti(void)
116 platform_device_register(&sti_device);
119 static inline void omap_init_sti(void) {}
122 #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
124 #include <mach/mcspi.h>
126 #define OMAP2_MCSPI1_BASE 0x48098000
127 #define OMAP2_MCSPI2_BASE 0x4809a000
128 #define OMAP2_MCSPI3_BASE 0x480b8000
129 #define OMAP2_MCSPI4_BASE 0x480ba000
131 static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
135 static struct resource omap2_mcspi1_resources[] = {
137 .start = OMAP2_MCSPI1_BASE,
138 .end = OMAP2_MCSPI1_BASE + 0xff,
139 .flags = IORESOURCE_MEM,
143 static struct platform_device omap2_mcspi1 = {
144 .name = "omap2_mcspi",
146 .num_resources = ARRAY_SIZE(omap2_mcspi1_resources),
147 .resource = omap2_mcspi1_resources,
149 .platform_data = &omap2_mcspi1_config,
153 static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
157 static struct resource omap2_mcspi2_resources[] = {
159 .start = OMAP2_MCSPI2_BASE,
160 .end = OMAP2_MCSPI2_BASE + 0xff,
161 .flags = IORESOURCE_MEM,
165 static struct platform_device omap2_mcspi2 = {
166 .name = "omap2_mcspi",
168 .num_resources = ARRAY_SIZE(omap2_mcspi2_resources),
169 .resource = omap2_mcspi2_resources,
171 .platform_data = &omap2_mcspi2_config,
175 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3)
176 static struct omap2_mcspi_platform_config omap2_mcspi3_config = {
180 static struct resource omap2_mcspi3_resources[] = {
182 .start = OMAP2_MCSPI3_BASE,
183 .end = OMAP2_MCSPI3_BASE + 0xff,
184 .flags = IORESOURCE_MEM,
188 static struct platform_device omap2_mcspi3 = {
189 .name = "omap2_mcspi",
191 .num_resources = ARRAY_SIZE(omap2_mcspi3_resources),
192 .resource = omap2_mcspi3_resources,
194 .platform_data = &omap2_mcspi3_config,
199 #ifdef CONFIG_ARCH_OMAP3
200 static struct omap2_mcspi_platform_config omap2_mcspi4_config = {
204 static struct resource omap2_mcspi4_resources[] = {
206 .start = OMAP2_MCSPI4_BASE,
207 .end = OMAP2_MCSPI4_BASE + 0xff,
208 .flags = IORESOURCE_MEM,
212 static struct platform_device omap2_mcspi4 = {
213 .name = "omap2_mcspi",
215 .num_resources = ARRAY_SIZE(omap2_mcspi4_resources),
216 .resource = omap2_mcspi4_resources,
218 .platform_data = &omap2_mcspi4_config,
223 static void omap_init_mcspi(void)
225 platform_device_register(&omap2_mcspi1);
226 platform_device_register(&omap2_mcspi2);
227 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3)
228 platform_device_register(&omap2_mcspi3);
230 #ifdef CONFIG_ARCH_OMAP3
231 platform_device_register(&omap2_mcspi4);
236 static inline void omap_init_mcspi(void) {}
239 #ifdef CONFIG_SND_OMAP24XX_EAC
241 #define OMAP2_EAC_BASE 0x48090000
243 static struct resource omap2_eac_resources[] = {
245 .start = OMAP2_EAC_BASE,
246 .end = OMAP2_EAC_BASE + 0x109,
247 .flags = IORESOURCE_MEM,
251 static struct platform_device omap2_eac_device = {
252 .name = "omap24xx-eac",
254 .num_resources = ARRAY_SIZE(omap2_eac_resources),
255 .resource = omap2_eac_resources,
257 .platform_data = NULL,
261 void omap_init_eac(struct eac_platform_data *pdata)
263 omap2_eac_device.dev.platform_data = pdata;
264 platform_device_register(&omap2_eac_device);
268 void omap_init_eac(struct eac_platform_data *pdata) {}
271 #ifdef CONFIG_OMAP_SHA1_MD5
272 static struct resource sha1_md5_resources[] = {
274 .start = OMAP24XX_SEC_SHA1MD5_BASE,
275 .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64,
276 .flags = IORESOURCE_MEM,
279 .start = INT_24XX_SHA1MD5,
280 .flags = IORESOURCE_IRQ,
284 static struct platform_device sha1_md5_device = {
285 .name = "OMAP SHA1/MD5",
287 .num_resources = ARRAY_SIZE(sha1_md5_resources),
288 .resource = sha1_md5_resources,
291 static void omap_init_sha1_md5(void)
293 platform_device_register(&sha1_md5_device);
296 static inline void omap_init_sha1_md5(void) { }
299 /*-------------------------------------------------------------------------*/
301 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
302 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
304 static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
307 if (cpu_is_omap2420() && controller_nr == 0) {
308 omap_cfg_reg(H18_24XX_MMC_CMD);
309 omap_cfg_reg(H15_24XX_MMC_CLKI);
310 omap_cfg_reg(G19_24XX_MMC_CLKO);
311 omap_cfg_reg(F20_24XX_MMC_DAT0);
312 omap_cfg_reg(F19_24XX_MMC_DAT_DIR0);
313 omap_cfg_reg(G18_24XX_MMC_CMD_DIR);
314 if (mmc_controller->slots[0].wire4) {
315 omap_cfg_reg(H14_24XX_MMC_DAT1);
316 omap_cfg_reg(E19_24XX_MMC_DAT2);
317 omap_cfg_reg(D19_24XX_MMC_DAT3);
318 omap_cfg_reg(E20_24XX_MMC_DAT_DIR1);
319 omap_cfg_reg(F18_24XX_MMC_DAT_DIR2);
320 omap_cfg_reg(E18_24XX_MMC_DAT_DIR3);
324 * Use internal loop-back in MMC/SDIO Module Input Clock
327 if (mmc_controller->slots[0].internal_clock) {
328 u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
330 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
335 void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
340 for (i = 0; i < nr_controllers; i++) {
341 unsigned long base, size;
342 unsigned int irq = 0;
347 omap2_mmc_mux(mmc_data[i], i);
351 base = OMAP2_MMC1_BASE;
352 irq = INT_24XX_MMC_IRQ;
355 base = OMAP2_MMC2_BASE;
356 irq = INT_24XX_MMC2_IRQ;
359 if (!cpu_is_omap34xx())
361 base = OMAP3_MMC3_BASE;
362 irq = INT_34XX_MMC3_IRQ;
368 if (cpu_is_omap2420())
369 size = OMAP2420_MMC_SIZE;
373 omap_mmc_add(i, base, size, irq, mmc_data[i]);
379 /*-------------------------------------------------------------------------*/
381 #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
382 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
383 #define OMAP_HDQ_BASE 0x480B2000
385 static struct resource omap_hdq_resources[] = {
387 .start = OMAP_HDQ_BASE,
388 .end = OMAP_HDQ_BASE + 0x1C,
389 .flags = IORESOURCE_MEM,
392 .start = INT_24XX_HDQ_IRQ,
393 .flags = IORESOURCE_IRQ,
396 static struct platform_device omap_hdq_dev = {
400 .platform_data = NULL,
402 .num_resources = ARRAY_SIZE(omap_hdq_resources),
403 .resource = omap_hdq_resources,
405 static inline void omap_hdq_init(void)
407 (void) platform_device_register(&omap_hdq_dev);
410 static inline void omap_hdq_init(void) {}
413 /*-------------------------------------------------------------------------*/
415 static int __init omap2_init_devices(void)
417 /* please keep these calls, and their implementations above,
418 * in alphabetical order so they're easier to sort through.
424 omap_init_sha1_md5();
428 arch_initcall(omap2_init_devices);