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>
22 #include <mach/control.h>
24 #include <mach/board.h>
26 #include <mach/gpio.h>
30 #if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
31 #define OMAP2_MBOX_BASE IO_ADDRESS(OMAP24XX_MAILBOX_BASE)
33 static struct resource mbox_resources
[] = {
35 .start
= OMAP2_MBOX_BASE
,
36 .end
= OMAP2_MBOX_BASE
+ 0x11f,
37 .flags
= IORESOURCE_MEM
,
40 .start
= INT_24XX_MAIL_U0_MPU
,
41 .flags
= IORESOURCE_IRQ
,
44 .start
= INT_24XX_MAIL_U3_MPU
,
45 .flags
= IORESOURCE_IRQ
,
49 static struct platform_device mbox_device
= {
52 .num_resources
= ARRAY_SIZE(mbox_resources
),
53 .resource
= mbox_resources
,
56 static inline void omap_init_mbox(void)
58 platform_device_register(&mbox_device
);
61 static inline void omap_init_mbox(void) { }
64 #if defined(CONFIG_OMAP_STI)
66 #if defined(CONFIG_ARCH_OMAP2)
68 #define OMAP2_STI_BASE 0x48068000
69 #define OMAP2_STI_CHANNEL_BASE 0x54000000
70 #define OMAP2_STI_IRQ 4
72 static struct resource sti_resources
[] = {
74 .start
= OMAP2_STI_BASE
,
75 .end
= OMAP2_STI_BASE
+ 0x7ff,
76 .flags
= IORESOURCE_MEM
,
79 .start
= OMAP2_STI_CHANNEL_BASE
,
80 .end
= OMAP2_STI_CHANNEL_BASE
+ SZ_64K
- 1,
81 .flags
= IORESOURCE_MEM
,
84 .start
= OMAP2_STI_IRQ
,
85 .flags
= IORESOURCE_IRQ
,
88 #elif defined(CONFIG_ARCH_OMAP3)
90 #define OMAP3_SDTI_BASE 0x54500000
91 #define OMAP3_SDTI_CHANNEL_BASE 0x54600000
93 static struct resource sti_resources
[] = {
95 .start
= OMAP3_SDTI_BASE
,
96 .end
= OMAP3_SDTI_BASE
+ 0xFFF,
97 .flags
= IORESOURCE_MEM
,
100 .start
= OMAP3_SDTI_CHANNEL_BASE
,
101 .end
= OMAP3_SDTI_CHANNEL_BASE
+ SZ_1M
- 1,
102 .flags
= IORESOURCE_MEM
,
108 static struct platform_device sti_device
= {
111 .num_resources
= ARRAY_SIZE(sti_resources
),
112 .resource
= sti_resources
,
115 static inline void omap_init_sti(void)
117 platform_device_register(&sti_device
);
120 static inline void omap_init_sti(void) {}
123 #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
125 #include <mach/mcspi.h>
127 #define OMAP2_MCSPI1_BASE 0x48098000
128 #define OMAP2_MCSPI2_BASE 0x4809a000
129 #define OMAP2_MCSPI3_BASE 0x480b8000
130 #define OMAP2_MCSPI4_BASE 0x480ba000
132 static struct omap2_mcspi_platform_config omap2_mcspi1_config
= {
136 static struct resource omap2_mcspi1_resources
[] = {
138 .start
= OMAP2_MCSPI1_BASE
,
139 .end
= OMAP2_MCSPI1_BASE
+ 0xff,
140 .flags
= IORESOURCE_MEM
,
144 static struct platform_device omap2_mcspi1
= {
145 .name
= "omap2_mcspi",
147 .num_resources
= ARRAY_SIZE(omap2_mcspi1_resources
),
148 .resource
= omap2_mcspi1_resources
,
150 .platform_data
= &omap2_mcspi1_config
,
154 static struct omap2_mcspi_platform_config omap2_mcspi2_config
= {
158 static struct resource omap2_mcspi2_resources
[] = {
160 .start
= OMAP2_MCSPI2_BASE
,
161 .end
= OMAP2_MCSPI2_BASE
+ 0xff,
162 .flags
= IORESOURCE_MEM
,
166 static struct platform_device omap2_mcspi2
= {
167 .name
= "omap2_mcspi",
169 .num_resources
= ARRAY_SIZE(omap2_mcspi2_resources
),
170 .resource
= omap2_mcspi2_resources
,
172 .platform_data
= &omap2_mcspi2_config
,
176 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3)
177 static struct omap2_mcspi_platform_config omap2_mcspi3_config
= {
181 static struct resource omap2_mcspi3_resources
[] = {
183 .start
= OMAP2_MCSPI3_BASE
,
184 .end
= OMAP2_MCSPI3_BASE
+ 0xff,
185 .flags
= IORESOURCE_MEM
,
189 static struct platform_device omap2_mcspi3
= {
190 .name
= "omap2_mcspi",
192 .num_resources
= ARRAY_SIZE(omap2_mcspi3_resources
),
193 .resource
= omap2_mcspi3_resources
,
195 .platform_data
= &omap2_mcspi3_config
,
200 #ifdef CONFIG_ARCH_OMAP3
201 static struct omap2_mcspi_platform_config omap2_mcspi4_config
= {
205 static struct resource omap2_mcspi4_resources
[] = {
207 .start
= OMAP2_MCSPI4_BASE
,
208 .end
= OMAP2_MCSPI4_BASE
+ 0xff,
209 .flags
= IORESOURCE_MEM
,
213 static struct platform_device omap2_mcspi4
= {
214 .name
= "omap2_mcspi",
216 .num_resources
= ARRAY_SIZE(omap2_mcspi4_resources
),
217 .resource
= omap2_mcspi4_resources
,
219 .platform_data
= &omap2_mcspi4_config
,
224 static void omap_init_mcspi(void)
226 platform_device_register(&omap2_mcspi1
);
227 platform_device_register(&omap2_mcspi2
);
228 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3)
229 platform_device_register(&omap2_mcspi3
);
231 #ifdef CONFIG_ARCH_OMAP3
232 platform_device_register(&omap2_mcspi4
);
237 static inline void omap_init_mcspi(void) {}
240 #ifdef CONFIG_SND_OMAP24XX_EAC
242 #define OMAP2_EAC_BASE 0x48090000
244 static struct resource omap2_eac_resources
[] = {
246 .start
= OMAP2_EAC_BASE
,
247 .end
= OMAP2_EAC_BASE
+ 0x109,
248 .flags
= IORESOURCE_MEM
,
252 static struct platform_device omap2_eac_device
= {
253 .name
= "omap24xx-eac",
255 .num_resources
= ARRAY_SIZE(omap2_eac_resources
),
256 .resource
= omap2_eac_resources
,
258 .platform_data
= NULL
,
262 void omap_init_eac(struct eac_platform_data
*pdata
)
264 omap2_eac_device
.dev
.platform_data
= pdata
;
265 platform_device_register(&omap2_eac_device
);
269 void omap_init_eac(struct eac_platform_data
*pdata
) {}
272 #ifdef CONFIG_OMAP_SHA1_MD5
273 static struct resource sha1_md5_resources
[] = {
275 .start
= OMAP24XX_SEC_SHA1MD5_BASE
,
276 .end
= OMAP24XX_SEC_SHA1MD5_BASE
+ 0x64,
277 .flags
= IORESOURCE_MEM
,
280 .start
= INT_24XX_SHA1MD5
,
281 .flags
= IORESOURCE_IRQ
,
285 static struct platform_device sha1_md5_device
= {
286 .name
= "OMAP SHA1/MD5",
288 .num_resources
= ARRAY_SIZE(sha1_md5_resources
),
289 .resource
= sha1_md5_resources
,
292 static void omap_init_sha1_md5(void)
294 platform_device_register(&sha1_md5_device
);
297 static inline void omap_init_sha1_md5(void) { }
300 /*-------------------------------------------------------------------------*/
302 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
303 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
305 static inline void omap2_mmc_mux(struct omap_mmc_platform_data
*mmc_controller
,
308 if (cpu_is_omap2420() && controller_nr
== 0) {
309 omap_cfg_reg(H18_24XX_MMC_CMD
);
310 omap_cfg_reg(H15_24XX_MMC_CLKI
);
311 omap_cfg_reg(G19_24XX_MMC_CLKO
);
312 omap_cfg_reg(F20_24XX_MMC_DAT0
);
313 omap_cfg_reg(F19_24XX_MMC_DAT_DIR0
);
314 omap_cfg_reg(G18_24XX_MMC_CMD_DIR
);
315 if (mmc_controller
->slots
[0].wires
== 4) {
316 omap_cfg_reg(H14_24XX_MMC_DAT1
);
317 omap_cfg_reg(E19_24XX_MMC_DAT2
);
318 omap_cfg_reg(D19_24XX_MMC_DAT3
);
319 omap_cfg_reg(E20_24XX_MMC_DAT_DIR1
);
320 omap_cfg_reg(F18_24XX_MMC_DAT_DIR2
);
321 omap_cfg_reg(E18_24XX_MMC_DAT_DIR3
);
325 * Use internal loop-back in MMC/SDIO Module Input Clock
328 if (mmc_controller
->slots
[0].internal_clock
) {
329 u32 v
= omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0
);
331 omap_ctrl_writel(v
, OMAP2_CONTROL_DEVCONF0
);
336 void __init
omap2_init_mmc(struct omap_mmc_platform_data
**mmc_data
,
341 for (i
= 0; i
< nr_controllers
; i
++) {
342 unsigned long base
, size
;
343 unsigned int irq
= 0;
348 omap2_mmc_mux(mmc_data
[i
], i
);
352 base
= OMAP2_MMC1_BASE
;
353 irq
= INT_24XX_MMC_IRQ
;
356 base
= OMAP2_MMC2_BASE
;
357 irq
= INT_24XX_MMC2_IRQ
;
360 if (!cpu_is_omap34xx())
362 base
= OMAP3_MMC3_BASE
;
363 irq
= INT_34XX_MMC3_IRQ
;
369 if (cpu_is_omap2420())
370 size
= OMAP2420_MMC_SIZE
;
374 omap_mmc_add(i
, base
, size
, irq
, mmc_data
[i
]);
380 /*-------------------------------------------------------------------------*/
382 #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
383 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
384 #define OMAP_HDQ_BASE 0x480B2000
386 static struct resource omap_hdq_resources
[] = {
388 .start
= OMAP_HDQ_BASE
,
389 .end
= OMAP_HDQ_BASE
+ 0x1C,
390 .flags
= IORESOURCE_MEM
,
393 .start
= INT_24XX_HDQ_IRQ
,
394 .flags
= IORESOURCE_IRQ
,
397 static struct platform_device omap_hdq_dev
= {
401 .platform_data
= NULL
,
403 .num_resources
= ARRAY_SIZE(omap_hdq_resources
),
404 .resource
= omap_hdq_resources
,
406 static inline void omap_hdq_init(void)
408 (void) platform_device_register(&omap_hdq_dev
);
411 static inline void omap_hdq_init(void) {}
414 /*-------------------------------------------------------------------------*/
416 static int __init
omap2_init_devices(void)
418 /* please keep these calls, and their implementations above,
419 * in alphabetical order so they're easier to sort through.
425 omap_init_sha1_md5();
429 arch_initcall(omap2_init_devices
);