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/kernel.h>
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
16 #include <linux/clk.h>
17 #include <linux/err.h>
18 #include <linux/slab.h>
20 #include <mach/hardware.h>
21 #include <mach/irqs.h>
22 #include <asm/mach-types.h>
23 #include <asm/mach/map.h>
27 #include <plat/board.h>
28 #include <plat/mcbsp.h>
29 #include <mach/gpio.h>
32 #include <plat/omap_hwmod.h>
33 #include <plat/omap_device.h>
38 #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
40 static struct resource cam_resources
[] = {
42 .start
= OMAP24XX_CAMERA_BASE
,
43 .end
= OMAP24XX_CAMERA_BASE
+ 0xfff,
44 .flags
= IORESOURCE_MEM
,
47 .start
= INT_24XX_CAM_IRQ
,
48 .flags
= IORESOURCE_IRQ
,
52 static struct platform_device omap_cam_device
= {
53 .name
= "omap24xxcam",
55 .num_resources
= ARRAY_SIZE(cam_resources
),
56 .resource
= cam_resources
,
59 static inline void omap_init_camera(void)
61 platform_device_register(&omap_cam_device
);
64 #elif defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
66 static struct resource omap3isp_resources
[] = {
68 .start
= OMAP3430_ISP_BASE
,
69 .end
= OMAP3430_ISP_END
,
70 .flags
= IORESOURCE_MEM
,
73 .start
= OMAP3430_ISP_CBUFF_BASE
,
74 .end
= OMAP3430_ISP_CBUFF_END
,
75 .flags
= IORESOURCE_MEM
,
78 .start
= OMAP3430_ISP_CCP2_BASE
,
79 .end
= OMAP3430_ISP_CCP2_END
,
80 .flags
= IORESOURCE_MEM
,
83 .start
= OMAP3430_ISP_CCDC_BASE
,
84 .end
= OMAP3430_ISP_CCDC_END
,
85 .flags
= IORESOURCE_MEM
,
88 .start
= OMAP3430_ISP_HIST_BASE
,
89 .end
= OMAP3430_ISP_HIST_END
,
90 .flags
= IORESOURCE_MEM
,
93 .start
= OMAP3430_ISP_H3A_BASE
,
94 .end
= OMAP3430_ISP_H3A_END
,
95 .flags
= IORESOURCE_MEM
,
98 .start
= OMAP3430_ISP_PREV_BASE
,
99 .end
= OMAP3430_ISP_PREV_END
,
100 .flags
= IORESOURCE_MEM
,
103 .start
= OMAP3430_ISP_RESZ_BASE
,
104 .end
= OMAP3430_ISP_RESZ_END
,
105 .flags
= IORESOURCE_MEM
,
108 .start
= OMAP3430_ISP_SBL_BASE
,
109 .end
= OMAP3430_ISP_SBL_END
,
110 .flags
= IORESOURCE_MEM
,
113 .start
= OMAP3430_ISP_CSI2A_BASE
,
114 .end
= OMAP3430_ISP_CSI2A_END
,
115 .flags
= IORESOURCE_MEM
,
118 .start
= OMAP3430_ISP_CSI2PHY_BASE
,
119 .end
= OMAP3430_ISP_CSI2PHY_END
,
120 .flags
= IORESOURCE_MEM
,
123 .start
= INT_34XX_CAM_IRQ
,
124 .flags
= IORESOURCE_IRQ
,
128 static struct platform_device omap3isp_device
= {
131 .num_resources
= ARRAY_SIZE(omap3isp_resources
),
132 .resource
= omap3isp_resources
,
135 static inline void omap_init_camera(void)
137 platform_device_register(&omap3isp_device
);
140 static inline void omap_init_camera(void)
145 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
147 #define MBOX_REG_SIZE 0x120
149 #ifdef CONFIG_ARCH_OMAP2
150 static struct resource omap2_mbox_resources
[] = {
152 .start
= OMAP24XX_MAILBOX_BASE
,
153 .end
= OMAP24XX_MAILBOX_BASE
+ MBOX_REG_SIZE
- 1,
154 .flags
= IORESOURCE_MEM
,
157 .start
= INT_24XX_MAIL_U0_MPU
,
158 .flags
= IORESOURCE_IRQ
,
162 .start
= INT_24XX_MAIL_U3_MPU
,
163 .flags
= IORESOURCE_IRQ
,
167 static int omap2_mbox_resources_sz
= ARRAY_SIZE(omap2_mbox_resources
);
169 #define omap2_mbox_resources NULL
170 #define omap2_mbox_resources_sz 0
173 #ifdef CONFIG_ARCH_OMAP3
174 static struct resource omap3_mbox_resources
[] = {
176 .start
= OMAP34XX_MAILBOX_BASE
,
177 .end
= OMAP34XX_MAILBOX_BASE
+ MBOX_REG_SIZE
- 1,
178 .flags
= IORESOURCE_MEM
,
181 .start
= INT_24XX_MAIL_U0_MPU
,
182 .flags
= IORESOURCE_IRQ
,
186 static int omap3_mbox_resources_sz
= ARRAY_SIZE(omap3_mbox_resources
);
188 #define omap3_mbox_resources NULL
189 #define omap3_mbox_resources_sz 0
192 #ifdef CONFIG_ARCH_OMAP4
194 #define OMAP4_MBOX_REG_SIZE 0x130
195 static struct resource omap4_mbox_resources
[] = {
197 .start
= OMAP44XX_MAILBOX_BASE
,
198 .end
= OMAP44XX_MAILBOX_BASE
+
199 OMAP4_MBOX_REG_SIZE
- 1,
200 .flags
= IORESOURCE_MEM
,
203 .start
= OMAP44XX_IRQ_MAIL_U0
,
204 .flags
= IORESOURCE_IRQ
,
208 static int omap4_mbox_resources_sz
= ARRAY_SIZE(omap4_mbox_resources
);
210 #define omap4_mbox_resources NULL
211 #define omap4_mbox_resources_sz 0
214 static struct platform_device mbox_device
= {
215 .name
= "omap-mailbox",
219 static inline void omap_init_mbox(void)
221 if (cpu_is_omap24xx()) {
222 mbox_device
.resource
= omap2_mbox_resources
;
223 mbox_device
.num_resources
= omap2_mbox_resources_sz
;
224 } else if (cpu_is_omap34xx()) {
225 mbox_device
.resource
= omap3_mbox_resources
;
226 mbox_device
.num_resources
= omap3_mbox_resources_sz
;
227 } else if (cpu_is_omap44xx()) {
228 mbox_device
.resource
= omap4_mbox_resources
;
229 mbox_device
.num_resources
= omap4_mbox_resources_sz
;
231 pr_err("%s: platform not supported\n", __func__
);
234 platform_device_register(&mbox_device
);
237 static inline void omap_init_mbox(void) { }
238 #endif /* CONFIG_OMAP_MBOX_FWK */
240 static inline void omap_init_sti(void) {}
242 #if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
244 static struct platform_device omap_pcm
= {
245 .name
= "omap-pcm-audio",
250 * OMAP2420 has 2 McBSP ports
251 * OMAP2430 has 5 McBSP ports
252 * OMAP3 has 5 McBSP ports
253 * OMAP4 has 4 McBSP ports
255 OMAP_MCBSP_PLATFORM_DEVICE(1);
256 OMAP_MCBSP_PLATFORM_DEVICE(2);
257 OMAP_MCBSP_PLATFORM_DEVICE(3);
258 OMAP_MCBSP_PLATFORM_DEVICE(4);
259 OMAP_MCBSP_PLATFORM_DEVICE(5);
261 static void omap_init_audio(void)
263 platform_device_register(&omap_mcbsp1
);
264 platform_device_register(&omap_mcbsp2
);
265 if (cpu_is_omap243x() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
266 platform_device_register(&omap_mcbsp3
);
267 platform_device_register(&omap_mcbsp4
);
269 if (cpu_is_omap243x() || cpu_is_omap34xx())
270 platform_device_register(&omap_mcbsp5
);
272 platform_device_register(&omap_pcm
);
276 static inline void omap_init_audio(void) {}
279 #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
281 #include <plat/mcspi.h>
283 struct omap_device_pm_latency omap_mcspi_latency
[] = {
285 .deactivate_func
= omap_device_idle_hwmods
,
286 .activate_func
= omap_device_enable_hwmods
,
287 .flags
= OMAP_DEVICE_LATENCY_AUTO_ADJUST
,
291 static int omap_mcspi_init(struct omap_hwmod
*oh
, void *unused
)
293 struct omap_device
*od
;
294 char *name
= "omap2_mcspi";
295 struct omap2_mcspi_platform_config
*pdata
;
297 struct omap2_mcspi_dev_attr
*mcspi_attrib
= oh
->dev_attr
;
299 pdata
= kzalloc(sizeof(*pdata
), GFP_KERNEL
);
301 pr_err("Memory allocation for McSPI device failed\n");
305 pdata
->num_cs
= mcspi_attrib
->num_chipselect
;
306 switch (oh
->class->rev
) {
307 case OMAP2_MCSPI_REV
:
308 case OMAP3_MCSPI_REV
:
309 pdata
->regs_offset
= 0;
311 case OMAP4_MCSPI_REV
:
312 pdata
->regs_offset
= OMAP4_MCSPI_REG_OFFSET
;
315 pr_err("Invalid McSPI Revision value\n");
320 od
= omap_device_build(name
, spi_num
, oh
, pdata
,
321 sizeof(*pdata
), omap_mcspi_latency
,
322 ARRAY_SIZE(omap_mcspi_latency
), 0);
323 WARN(IS_ERR(od
), "Cant build omap_device for %s:%s\n",
329 static void omap_init_mcspi(void)
331 omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init
, NULL
);
335 static inline void omap_init_mcspi(void) {}
338 static struct resource omap2_pmu_resource
= {
341 .flags
= IORESOURCE_IRQ
,
344 static struct resource omap3_pmu_resource
= {
345 .start
= INT_34XX_BENCH_MPU_EMUL
,
346 .end
= INT_34XX_BENCH_MPU_EMUL
,
347 .flags
= IORESOURCE_IRQ
,
350 static struct platform_device omap_pmu_device
= {
352 .id
= ARM_PMU_DEVICE_CPU
,
356 static void omap_init_pmu(void)
358 if (cpu_is_omap24xx())
359 omap_pmu_device
.resource
= &omap2_pmu_resource
;
360 else if (cpu_is_omap34xx())
361 omap_pmu_device
.resource
= &omap3_pmu_resource
;
365 platform_device_register(&omap_pmu_device
);
369 #if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE)
371 #ifdef CONFIG_ARCH_OMAP2
372 static struct resource omap2_sham_resources
[] = {
374 .start
= OMAP24XX_SEC_SHA1MD5_BASE
,
375 .end
= OMAP24XX_SEC_SHA1MD5_BASE
+ 0x64,
376 .flags
= IORESOURCE_MEM
,
379 .start
= INT_24XX_SHA1MD5
,
380 .flags
= IORESOURCE_IRQ
,
383 static int omap2_sham_resources_sz
= ARRAY_SIZE(omap2_sham_resources
);
385 #define omap2_sham_resources NULL
386 #define omap2_sham_resources_sz 0
389 #ifdef CONFIG_ARCH_OMAP3
390 static struct resource omap3_sham_resources
[] = {
392 .start
= OMAP34XX_SEC_SHA1MD5_BASE
,
393 .end
= OMAP34XX_SEC_SHA1MD5_BASE
+ 0x64,
394 .flags
= IORESOURCE_MEM
,
397 .start
= INT_34XX_SHA1MD52_IRQ
,
398 .flags
= IORESOURCE_IRQ
,
401 .start
= OMAP34XX_DMA_SHA1MD5_RX
,
402 .flags
= IORESOURCE_DMA
,
405 static int omap3_sham_resources_sz
= ARRAY_SIZE(omap3_sham_resources
);
407 #define omap3_sham_resources NULL
408 #define omap3_sham_resources_sz 0
411 static struct platform_device sham_device
= {
416 static void omap_init_sham(void)
418 if (cpu_is_omap24xx()) {
419 sham_device
.resource
= omap2_sham_resources
;
420 sham_device
.num_resources
= omap2_sham_resources_sz
;
421 } else if (cpu_is_omap34xx()) {
422 sham_device
.resource
= omap3_sham_resources
;
423 sham_device
.num_resources
= omap3_sham_resources_sz
;
425 pr_err("%s: platform not supported\n", __func__
);
428 platform_device_register(&sham_device
);
431 static inline void omap_init_sham(void) { }
434 #if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE)
436 #ifdef CONFIG_ARCH_OMAP2
437 static struct resource omap2_aes_resources
[] = {
439 .start
= OMAP24XX_SEC_AES_BASE
,
440 .end
= OMAP24XX_SEC_AES_BASE
+ 0x4C,
441 .flags
= IORESOURCE_MEM
,
444 .start
= OMAP24XX_DMA_AES_TX
,
445 .flags
= IORESOURCE_DMA
,
448 .start
= OMAP24XX_DMA_AES_RX
,
449 .flags
= IORESOURCE_DMA
,
452 static int omap2_aes_resources_sz
= ARRAY_SIZE(omap2_aes_resources
);
454 #define omap2_aes_resources NULL
455 #define omap2_aes_resources_sz 0
458 #ifdef CONFIG_ARCH_OMAP3
459 static struct resource omap3_aes_resources
[] = {
461 .start
= OMAP34XX_SEC_AES_BASE
,
462 .end
= OMAP34XX_SEC_AES_BASE
+ 0x4C,
463 .flags
= IORESOURCE_MEM
,
466 .start
= OMAP34XX_DMA_AES2_TX
,
467 .flags
= IORESOURCE_DMA
,
470 .start
= OMAP34XX_DMA_AES2_RX
,
471 .flags
= IORESOURCE_DMA
,
474 static int omap3_aes_resources_sz
= ARRAY_SIZE(omap3_aes_resources
);
476 #define omap3_aes_resources NULL
477 #define omap3_aes_resources_sz 0
480 static struct platform_device aes_device
= {
485 static void omap_init_aes(void)
487 if (cpu_is_omap24xx()) {
488 aes_device
.resource
= omap2_aes_resources
;
489 aes_device
.num_resources
= omap2_aes_resources_sz
;
490 } else if (cpu_is_omap34xx()) {
491 aes_device
.resource
= omap3_aes_resources
;
492 aes_device
.num_resources
= omap3_aes_resources_sz
;
494 pr_err("%s: platform not supported\n", __func__
);
497 platform_device_register(&aes_device
);
501 static inline void omap_init_aes(void) { }
504 /*-------------------------------------------------------------------------*/
506 #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
508 #define MMCHS_SYSCONFIG 0x0010
509 #define MMCHS_SYSCONFIG_SWRESET (1 << 1)
510 #define MMCHS_SYSSTATUS 0x0014
511 #define MMCHS_SYSSTATUS_RESETDONE (1 << 0)
513 static struct platform_device dummy_pdev
= {
515 .bus
= &platform_bus_type
,
520 * omap_hsmmc_reset() - Full reset of each HS-MMC controller
522 * Ensure that each MMC controller is fully reset. Controllers
523 * left in an unknown state (by bootloader) may prevent retention
524 * or OFF-mode. This is especially important in cases where the
525 * MMC driver is not enabled, _or_ built as a module.
527 * In order for reset to work, interface, functional and debounce
528 * clocks must be enabled. The debounce clock comes from func_32k_clk
529 * and is not under SW control, so we only enable i- and f-clocks.
531 static void __init
omap_hsmmc_reset(void)
533 u32 i
, nr_controllers
;
534 struct clk
*iclk
, *fclk
;
536 if (cpu_is_omap242x())
539 nr_controllers
= cpu_is_omap44xx() ? OMAP44XX_NR_MMC
:
540 (cpu_is_omap34xx() ? OMAP34XX_NR_MMC
: OMAP24XX_NR_MMC
);
542 for (i
= 0; i
< nr_controllers
; i
++) {
544 struct device
*dev
= &dummy_pdev
.dev
;
548 base
= OMAP2_MMC1_BASE
;
551 base
= OMAP2_MMC2_BASE
;
554 base
= OMAP3_MMC3_BASE
;
557 if (!cpu_is_omap44xx())
559 base
= OMAP4_MMC4_BASE
;
562 if (!cpu_is_omap44xx())
564 base
= OMAP4_MMC5_BASE
;
568 if (cpu_is_omap44xx())
569 base
+= OMAP4_MMC_REG_OFFSET
;
572 dev_set_name(&dummy_pdev
.dev
, "mmci-omap-hs.%d", i
);
573 iclk
= clk_get(dev
, "ick");
576 if (clk_enable(iclk
))
579 fclk
= clk_get(dev
, "fck");
582 if (clk_enable(fclk
))
585 omap_writel(MMCHS_SYSCONFIG_SWRESET
, base
+ MMCHS_SYSCONFIG
);
586 v
= omap_readl(base
+ MMCHS_SYSSTATUS
);
587 while (!(omap_readl(base
+ MMCHS_SYSSTATUS
) &
588 MMCHS_SYSSTATUS_RESETDONE
))
605 printk(KERN_WARNING
"%s: Unable to enable clocks for MMC%d, "
606 "cannot reset.\n", __func__
, i
);
609 static inline void omap_hsmmc_reset(void) {}
612 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
613 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
615 static inline void omap2_mmc_mux(struct omap_mmc_platform_data
*mmc_controller
,
618 if ((mmc_controller
->slots
[0].switch_pin
> 0) && \
619 (mmc_controller
->slots
[0].switch_pin
< OMAP_MAX_GPIO_LINES
))
620 omap_mux_init_gpio(mmc_controller
->slots
[0].switch_pin
,
621 OMAP_PIN_INPUT_PULLUP
);
622 if ((mmc_controller
->slots
[0].gpio_wp
> 0) && \
623 (mmc_controller
->slots
[0].gpio_wp
< OMAP_MAX_GPIO_LINES
))
624 omap_mux_init_gpio(mmc_controller
->slots
[0].gpio_wp
,
625 OMAP_PIN_INPUT_PULLUP
);
627 if (cpu_is_omap2420() && controller_nr
== 0) {
628 omap_mux_init_signal("sdmmc_cmd", 0);
629 omap_mux_init_signal("sdmmc_clki", 0);
630 omap_mux_init_signal("sdmmc_clko", 0);
631 omap_mux_init_signal("sdmmc_dat0", 0);
632 omap_mux_init_signal("sdmmc_dat_dir0", 0);
633 omap_mux_init_signal("sdmmc_cmd_dir", 0);
634 if (mmc_controller
->slots
[0].caps
& MMC_CAP_4_BIT_DATA
) {
635 omap_mux_init_signal("sdmmc_dat1", 0);
636 omap_mux_init_signal("sdmmc_dat2", 0);
637 omap_mux_init_signal("sdmmc_dat3", 0);
638 omap_mux_init_signal("sdmmc_dat_dir1", 0);
639 omap_mux_init_signal("sdmmc_dat_dir2", 0);
640 omap_mux_init_signal("sdmmc_dat_dir3", 0);
644 * Use internal loop-back in MMC/SDIO Module Input Clock
647 if (mmc_controller
->slots
[0].internal_clock
) {
648 u32 v
= omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0
);
650 omap_ctrl_writel(v
, OMAP2_CONTROL_DEVCONF0
);
654 if (cpu_is_omap34xx()) {
655 if (controller_nr
== 0) {
656 omap_mux_init_signal("sdmmc1_clk",
657 OMAP_PIN_INPUT_PULLUP
);
658 omap_mux_init_signal("sdmmc1_cmd",
659 OMAP_PIN_INPUT_PULLUP
);
660 omap_mux_init_signal("sdmmc1_dat0",
661 OMAP_PIN_INPUT_PULLUP
);
662 if (mmc_controller
->slots
[0].caps
&
663 (MMC_CAP_4_BIT_DATA
| MMC_CAP_8_BIT_DATA
)) {
664 omap_mux_init_signal("sdmmc1_dat1",
665 OMAP_PIN_INPUT_PULLUP
);
666 omap_mux_init_signal("sdmmc1_dat2",
667 OMAP_PIN_INPUT_PULLUP
);
668 omap_mux_init_signal("sdmmc1_dat3",
669 OMAP_PIN_INPUT_PULLUP
);
671 if (mmc_controller
->slots
[0].caps
&
672 MMC_CAP_8_BIT_DATA
) {
673 omap_mux_init_signal("sdmmc1_dat4",
674 OMAP_PIN_INPUT_PULLUP
);
675 omap_mux_init_signal("sdmmc1_dat5",
676 OMAP_PIN_INPUT_PULLUP
);
677 omap_mux_init_signal("sdmmc1_dat6",
678 OMAP_PIN_INPUT_PULLUP
);
679 omap_mux_init_signal("sdmmc1_dat7",
680 OMAP_PIN_INPUT_PULLUP
);
683 if (controller_nr
== 1) {
685 omap_mux_init_signal("sdmmc2_clk",
686 OMAP_PIN_INPUT_PULLUP
);
687 omap_mux_init_signal("sdmmc2_cmd",
688 OMAP_PIN_INPUT_PULLUP
);
689 omap_mux_init_signal("sdmmc2_dat0",
690 OMAP_PIN_INPUT_PULLUP
);
693 * For 8 wire configurations, Lines DAT4, 5, 6 and 7 need to be muxed
694 * in the board-*.c files
696 if (mmc_controller
->slots
[0].caps
&
697 (MMC_CAP_4_BIT_DATA
| MMC_CAP_8_BIT_DATA
)) {
698 omap_mux_init_signal("sdmmc2_dat1",
699 OMAP_PIN_INPUT_PULLUP
);
700 omap_mux_init_signal("sdmmc2_dat2",
701 OMAP_PIN_INPUT_PULLUP
);
702 omap_mux_init_signal("sdmmc2_dat3",
703 OMAP_PIN_INPUT_PULLUP
);
705 if (mmc_controller
->slots
[0].caps
&
706 MMC_CAP_8_BIT_DATA
) {
707 omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
708 OMAP_PIN_INPUT_PULLUP
);
709 omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5",
710 OMAP_PIN_INPUT_PULLUP
);
711 omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
712 OMAP_PIN_INPUT_PULLUP
);
713 omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7",
714 OMAP_PIN_INPUT_PULLUP
);
719 * For MMC3 the pins need to be muxed in the board-*.c files
724 void __init
omap2_init_mmc(struct omap_mmc_platform_data
**mmc_data
,
730 for (i
= 0; i
< nr_controllers
; i
++) {
731 unsigned long base
, size
;
732 unsigned int irq
= 0;
737 omap2_mmc_mux(mmc_data
[i
], i
);
741 base
= OMAP2_MMC1_BASE
;
742 irq
= INT_24XX_MMC_IRQ
;
745 base
= OMAP2_MMC2_BASE
;
746 irq
= INT_24XX_MMC2_IRQ
;
749 if (!cpu_is_omap44xx() && !cpu_is_omap34xx())
751 base
= OMAP3_MMC3_BASE
;
752 irq
= INT_34XX_MMC3_IRQ
;
755 if (!cpu_is_omap44xx())
757 base
= OMAP4_MMC4_BASE
;
758 irq
= OMAP44XX_IRQ_MMC4
;
761 if (!cpu_is_omap44xx())
763 base
= OMAP4_MMC5_BASE
;
764 irq
= OMAP44XX_IRQ_MMC5
;
770 if (cpu_is_omap2420()) {
771 size
= OMAP2420_MMC_SIZE
;
773 } else if (cpu_is_omap44xx()) {
775 irq
+= OMAP44XX_IRQ_GIC_START
;
776 size
= OMAP4_HSMMC_SIZE
;
777 name
= "mmci-omap-hs";
779 size
= OMAP3_HSMMC_SIZE
;
780 name
= "mmci-omap-hs";
782 omap_mmc_add(name
, i
, base
, size
, irq
, mmc_data
[i
]);
788 /*-------------------------------------------------------------------------*/
790 #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
791 #if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430)
792 #define OMAP_HDQ_BASE 0x480B2000
794 static struct resource omap_hdq_resources
[] = {
796 .start
= OMAP_HDQ_BASE
,
797 .end
= OMAP_HDQ_BASE
+ 0x1C,
798 .flags
= IORESOURCE_MEM
,
801 .start
= INT_24XX_HDQ_IRQ
,
802 .flags
= IORESOURCE_IRQ
,
805 static struct platform_device omap_hdq_dev
= {
809 .platform_data
= NULL
,
811 .num_resources
= ARRAY_SIZE(omap_hdq_resources
),
812 .resource
= omap_hdq_resources
,
814 static inline void omap_hdq_init(void)
816 (void) platform_device_register(&omap_hdq_dev
);
819 static inline void omap_hdq_init(void) {}
822 /*---------------------------------------------------------------------------*/
824 #if defined(CONFIG_VIDEO_OMAP2_VOUT) || \
825 defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE)
826 #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
827 static struct resource omap_vout_resource
[3 - CONFIG_FB_OMAP2_NUM_FBS
] = {
830 static struct resource omap_vout_resource
[2] = {
834 static struct platform_device omap_vout_device
= {
836 .num_resources
= ARRAY_SIZE(omap_vout_resource
),
837 .resource
= &omap_vout_resource
[0],
840 static void omap_init_vout(void)
842 if (platform_device_register(&omap_vout_device
) < 0)
843 printk(KERN_ERR
"Unable to register OMAP-VOUT device\n");
846 static inline void omap_init_vout(void) {}
849 /*-------------------------------------------------------------------------*/
851 static int __init
omap2_init_devices(void)
854 * please keep these calls, and their implementations above,
855 * in alphabetical order so they're easier to sort through.
871 arch_initcall(omap2_init_devices
);
873 #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
874 static struct omap_device_pm_latency omap_wdt_latency
[] = {
876 .deactivate_func
= omap_device_idle_hwmods
,
877 .activate_func
= omap_device_enable_hwmods
,
878 .flags
= OMAP_DEVICE_LATENCY_AUTO_ADJUST
,
882 static int __init
omap_init_wdt(void)
885 struct omap_device
*od
;
886 struct omap_hwmod
*oh
;
887 char *oh_name
= "wd_timer2";
888 char *dev_name
= "omap_wdt";
890 if (!cpu_class_is_omap2())
893 oh
= omap_hwmod_lookup(oh_name
);
895 pr_err("Could not look up wd_timer%d hwmod\n", id
);
899 od
= omap_device_build(dev_name
, id
, oh
, NULL
, 0,
901 ARRAY_SIZE(omap_wdt_latency
), 0);
902 WARN(IS_ERR(od
), "Cant build omap_device for %s:%s.\n",
906 subsys_initcall(omap_init_wdt
);