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>
19 #include <mach/hardware.h>
20 #include <mach/irqs.h>
21 #include <asm/mach-types.h>
22 #include <asm/mach/map.h>
26 #include <plat/board.h>
27 #include <plat/mcbsp.h>
28 #include <mach/gpio.h>
31 #include <plat/omap_hwmod.h>
32 #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 #define OMAP2_MCSPI1_BASE 0x48098000
284 #define OMAP2_MCSPI2_BASE 0x4809a000
285 #define OMAP2_MCSPI3_BASE 0x480b8000
286 #define OMAP2_MCSPI4_BASE 0x480ba000
288 #define OMAP4_MCSPI1_BASE 0x48098100
289 #define OMAP4_MCSPI2_BASE 0x4809a100
290 #define OMAP4_MCSPI3_BASE 0x480b8100
291 #define OMAP4_MCSPI4_BASE 0x480ba100
293 static struct omap2_mcspi_platform_config omap2_mcspi1_config
= {
297 static struct resource omap2_mcspi1_resources
[] = {
299 .start
= OMAP2_MCSPI1_BASE
,
300 .end
= OMAP2_MCSPI1_BASE
+ 0xff,
301 .flags
= IORESOURCE_MEM
,
305 static struct platform_device omap2_mcspi1
= {
306 .name
= "omap2_mcspi",
308 .num_resources
= ARRAY_SIZE(omap2_mcspi1_resources
),
309 .resource
= omap2_mcspi1_resources
,
311 .platform_data
= &omap2_mcspi1_config
,
315 static struct omap2_mcspi_platform_config omap2_mcspi2_config
= {
319 static struct resource omap2_mcspi2_resources
[] = {
321 .start
= OMAP2_MCSPI2_BASE
,
322 .end
= OMAP2_MCSPI2_BASE
+ 0xff,
323 .flags
= IORESOURCE_MEM
,
327 static struct platform_device omap2_mcspi2
= {
328 .name
= "omap2_mcspi",
330 .num_resources
= ARRAY_SIZE(omap2_mcspi2_resources
),
331 .resource
= omap2_mcspi2_resources
,
333 .platform_data
= &omap2_mcspi2_config
,
337 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
338 defined(CONFIG_ARCH_OMAP4)
339 static struct omap2_mcspi_platform_config omap2_mcspi3_config
= {
343 static struct resource omap2_mcspi3_resources
[] = {
345 .start
= OMAP2_MCSPI3_BASE
,
346 .end
= OMAP2_MCSPI3_BASE
+ 0xff,
347 .flags
= IORESOURCE_MEM
,
351 static struct platform_device omap2_mcspi3
= {
352 .name
= "omap2_mcspi",
354 .num_resources
= ARRAY_SIZE(omap2_mcspi3_resources
),
355 .resource
= omap2_mcspi3_resources
,
357 .platform_data
= &omap2_mcspi3_config
,
362 #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
363 static struct omap2_mcspi_platform_config omap2_mcspi4_config
= {
367 static struct resource omap2_mcspi4_resources
[] = {
369 .start
= OMAP2_MCSPI4_BASE
,
370 .end
= OMAP2_MCSPI4_BASE
+ 0xff,
371 .flags
= IORESOURCE_MEM
,
375 static struct platform_device omap2_mcspi4
= {
376 .name
= "omap2_mcspi",
378 .num_resources
= ARRAY_SIZE(omap2_mcspi4_resources
),
379 .resource
= omap2_mcspi4_resources
,
381 .platform_data
= &omap2_mcspi4_config
,
386 #ifdef CONFIG_ARCH_OMAP4
387 static inline void omap4_mcspi_fixup(void)
389 omap2_mcspi1_resources
[0].start
= OMAP4_MCSPI1_BASE
;
390 omap2_mcspi1_resources
[0].end
= OMAP4_MCSPI1_BASE
+ 0xff;
391 omap2_mcspi2_resources
[0].start
= OMAP4_MCSPI2_BASE
;
392 omap2_mcspi2_resources
[0].end
= OMAP4_MCSPI2_BASE
+ 0xff;
393 omap2_mcspi3_resources
[0].start
= OMAP4_MCSPI3_BASE
;
394 omap2_mcspi3_resources
[0].end
= OMAP4_MCSPI3_BASE
+ 0xff;
395 omap2_mcspi4_resources
[0].start
= OMAP4_MCSPI4_BASE
;
396 omap2_mcspi4_resources
[0].end
= OMAP4_MCSPI4_BASE
+ 0xff;
399 static inline void omap4_mcspi_fixup(void)
404 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
405 defined(CONFIG_ARCH_OMAP4)
406 static inline void omap2_mcspi3_init(void)
408 platform_device_register(&omap2_mcspi3
);
411 static inline void omap2_mcspi3_init(void)
416 #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
417 static inline void omap2_mcspi4_init(void)
419 platform_device_register(&omap2_mcspi4
);
422 static inline void omap2_mcspi4_init(void)
427 static void omap_init_mcspi(void)
429 if (cpu_is_omap44xx())
432 platform_device_register(&omap2_mcspi1
);
433 platform_device_register(&omap2_mcspi2
);
435 if (cpu_is_omap2430() || cpu_is_omap343x() || cpu_is_omap44xx())
438 if (cpu_is_omap343x() || cpu_is_omap44xx())
443 static inline void omap_init_mcspi(void) {}
446 static struct resource omap2_pmu_resource
= {
449 .flags
= IORESOURCE_IRQ
,
452 static struct resource omap3_pmu_resource
= {
453 .start
= INT_34XX_BENCH_MPU_EMUL
,
454 .end
= INT_34XX_BENCH_MPU_EMUL
,
455 .flags
= IORESOURCE_IRQ
,
458 static struct platform_device omap_pmu_device
= {
460 .id
= ARM_PMU_DEVICE_CPU
,
464 static void omap_init_pmu(void)
466 if (cpu_is_omap24xx())
467 omap_pmu_device
.resource
= &omap2_pmu_resource
;
468 else if (cpu_is_omap34xx())
469 omap_pmu_device
.resource
= &omap3_pmu_resource
;
473 platform_device_register(&omap_pmu_device
);
477 #if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE)
479 #ifdef CONFIG_ARCH_OMAP2
480 static struct resource omap2_sham_resources
[] = {
482 .start
= OMAP24XX_SEC_SHA1MD5_BASE
,
483 .end
= OMAP24XX_SEC_SHA1MD5_BASE
+ 0x64,
484 .flags
= IORESOURCE_MEM
,
487 .start
= INT_24XX_SHA1MD5
,
488 .flags
= IORESOURCE_IRQ
,
491 static int omap2_sham_resources_sz
= ARRAY_SIZE(omap2_sham_resources
);
493 #define omap2_sham_resources NULL
494 #define omap2_sham_resources_sz 0
497 #ifdef CONFIG_ARCH_OMAP3
498 static struct resource omap3_sham_resources
[] = {
500 .start
= OMAP34XX_SEC_SHA1MD5_BASE
,
501 .end
= OMAP34XX_SEC_SHA1MD5_BASE
+ 0x64,
502 .flags
= IORESOURCE_MEM
,
505 .start
= INT_34XX_SHA1MD52_IRQ
,
506 .flags
= IORESOURCE_IRQ
,
509 .start
= OMAP34XX_DMA_SHA1MD5_RX
,
510 .flags
= IORESOURCE_DMA
,
513 static int omap3_sham_resources_sz
= ARRAY_SIZE(omap3_sham_resources
);
515 #define omap3_sham_resources NULL
516 #define omap3_sham_resources_sz 0
519 static struct platform_device sham_device
= {
524 static void omap_init_sham(void)
526 if (cpu_is_omap24xx()) {
527 sham_device
.resource
= omap2_sham_resources
;
528 sham_device
.num_resources
= omap2_sham_resources_sz
;
529 } else if (cpu_is_omap34xx()) {
530 sham_device
.resource
= omap3_sham_resources
;
531 sham_device
.num_resources
= omap3_sham_resources_sz
;
533 pr_err("%s: platform not supported\n", __func__
);
536 platform_device_register(&sham_device
);
539 static inline void omap_init_sham(void) { }
542 #if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE)
544 #ifdef CONFIG_ARCH_OMAP2
545 static struct resource omap2_aes_resources
[] = {
547 .start
= OMAP24XX_SEC_AES_BASE
,
548 .end
= OMAP24XX_SEC_AES_BASE
+ 0x4C,
549 .flags
= IORESOURCE_MEM
,
552 .start
= OMAP24XX_DMA_AES_TX
,
553 .flags
= IORESOURCE_DMA
,
556 .start
= OMAP24XX_DMA_AES_RX
,
557 .flags
= IORESOURCE_DMA
,
560 static int omap2_aes_resources_sz
= ARRAY_SIZE(omap2_aes_resources
);
562 #define omap2_aes_resources NULL
563 #define omap2_aes_resources_sz 0
566 #ifdef CONFIG_ARCH_OMAP3
567 static struct resource omap3_aes_resources
[] = {
569 .start
= OMAP34XX_SEC_AES_BASE
,
570 .end
= OMAP34XX_SEC_AES_BASE
+ 0x4C,
571 .flags
= IORESOURCE_MEM
,
574 .start
= OMAP34XX_DMA_AES2_TX
,
575 .flags
= IORESOURCE_DMA
,
578 .start
= OMAP34XX_DMA_AES2_RX
,
579 .flags
= IORESOURCE_DMA
,
582 static int omap3_aes_resources_sz
= ARRAY_SIZE(omap3_aes_resources
);
584 #define omap3_aes_resources NULL
585 #define omap3_aes_resources_sz 0
588 static struct platform_device aes_device
= {
593 static void omap_init_aes(void)
595 if (cpu_is_omap24xx()) {
596 aes_device
.resource
= omap2_aes_resources
;
597 aes_device
.num_resources
= omap2_aes_resources_sz
;
598 } else if (cpu_is_omap34xx()) {
599 aes_device
.resource
= omap3_aes_resources
;
600 aes_device
.num_resources
= omap3_aes_resources_sz
;
602 pr_err("%s: platform not supported\n", __func__
);
605 platform_device_register(&aes_device
);
609 static inline void omap_init_aes(void) { }
612 /*-------------------------------------------------------------------------*/
614 #if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
616 #define MMCHS_SYSCONFIG 0x0010
617 #define MMCHS_SYSCONFIG_SWRESET (1 << 1)
618 #define MMCHS_SYSSTATUS 0x0014
619 #define MMCHS_SYSSTATUS_RESETDONE (1 << 0)
621 static struct platform_device dummy_pdev
= {
623 .bus
= &platform_bus_type
,
628 * omap_hsmmc_reset() - Full reset of each HS-MMC controller
630 * Ensure that each MMC controller is fully reset. Controllers
631 * left in an unknown state (by bootloader) may prevent retention
632 * or OFF-mode. This is especially important in cases where the
633 * MMC driver is not enabled, _or_ built as a module.
635 * In order for reset to work, interface, functional and debounce
636 * clocks must be enabled. The debounce clock comes from func_32k_clk
637 * and is not under SW control, so we only enable i- and f-clocks.
639 static void __init
omap_hsmmc_reset(void)
641 u32 i
, nr_controllers
;
642 struct clk
*iclk
, *fclk
;
644 if (cpu_is_omap242x())
647 nr_controllers
= cpu_is_omap44xx() ? OMAP44XX_NR_MMC
:
648 (cpu_is_omap34xx() ? OMAP34XX_NR_MMC
: OMAP24XX_NR_MMC
);
650 for (i
= 0; i
< nr_controllers
; i
++) {
652 struct device
*dev
= &dummy_pdev
.dev
;
656 base
= OMAP2_MMC1_BASE
;
659 base
= OMAP2_MMC2_BASE
;
662 base
= OMAP3_MMC3_BASE
;
665 if (!cpu_is_omap44xx())
667 base
= OMAP4_MMC4_BASE
;
670 if (!cpu_is_omap44xx())
672 base
= OMAP4_MMC5_BASE
;
676 if (cpu_is_omap44xx())
677 base
+= OMAP4_MMC_REG_OFFSET
;
680 dev_set_name(&dummy_pdev
.dev
, "mmci-omap-hs.%d", i
);
681 iclk
= clk_get(dev
, "ick");
684 if (clk_enable(iclk
))
687 fclk
= clk_get(dev
, "fck");
690 if (clk_enable(fclk
))
693 omap_writel(MMCHS_SYSCONFIG_SWRESET
, base
+ MMCHS_SYSCONFIG
);
694 v
= omap_readl(base
+ MMCHS_SYSSTATUS
);
695 while (!(omap_readl(base
+ MMCHS_SYSSTATUS
) &
696 MMCHS_SYSSTATUS_RESETDONE
))
713 printk(KERN_WARNING
"%s: Unable to enable clocks for MMC%d, "
714 "cannot reset.\n", __func__
, i
);
717 static inline void omap_hsmmc_reset(void) {}
720 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
721 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
723 static inline void omap2_mmc_mux(struct omap_mmc_platform_data
*mmc_controller
,
726 if ((mmc_controller
->slots
[0].switch_pin
> 0) && \
727 (mmc_controller
->slots
[0].switch_pin
< OMAP_MAX_GPIO_LINES
))
728 omap_mux_init_gpio(mmc_controller
->slots
[0].switch_pin
,
729 OMAP_PIN_INPUT_PULLUP
);
730 if ((mmc_controller
->slots
[0].gpio_wp
> 0) && \
731 (mmc_controller
->slots
[0].gpio_wp
< OMAP_MAX_GPIO_LINES
))
732 omap_mux_init_gpio(mmc_controller
->slots
[0].gpio_wp
,
733 OMAP_PIN_INPUT_PULLUP
);
735 if (cpu_is_omap2420() && controller_nr
== 0) {
736 omap_mux_init_signal("sdmmc_cmd", 0);
737 omap_mux_init_signal("sdmmc_clki", 0);
738 omap_mux_init_signal("sdmmc_clko", 0);
739 omap_mux_init_signal("sdmmc_dat0", 0);
740 omap_mux_init_signal("sdmmc_dat_dir0", 0);
741 omap_mux_init_signal("sdmmc_cmd_dir", 0);
742 if (mmc_controller
->slots
[0].caps
& MMC_CAP_4_BIT_DATA
) {
743 omap_mux_init_signal("sdmmc_dat1", 0);
744 omap_mux_init_signal("sdmmc_dat2", 0);
745 omap_mux_init_signal("sdmmc_dat3", 0);
746 omap_mux_init_signal("sdmmc_dat_dir1", 0);
747 omap_mux_init_signal("sdmmc_dat_dir2", 0);
748 omap_mux_init_signal("sdmmc_dat_dir3", 0);
752 * Use internal loop-back in MMC/SDIO Module Input Clock
755 if (mmc_controller
->slots
[0].internal_clock
) {
756 u32 v
= omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0
);
758 omap_ctrl_writel(v
, OMAP2_CONTROL_DEVCONF0
);
762 if (cpu_is_omap34xx()) {
763 if (controller_nr
== 0) {
764 omap_mux_init_signal("sdmmc1_clk",
765 OMAP_PIN_INPUT_PULLUP
);
766 omap_mux_init_signal("sdmmc1_cmd",
767 OMAP_PIN_INPUT_PULLUP
);
768 omap_mux_init_signal("sdmmc1_dat0",
769 OMAP_PIN_INPUT_PULLUP
);
770 if (mmc_controller
->slots
[0].caps
&
771 (MMC_CAP_4_BIT_DATA
| MMC_CAP_8_BIT_DATA
)) {
772 omap_mux_init_signal("sdmmc1_dat1",
773 OMAP_PIN_INPUT_PULLUP
);
774 omap_mux_init_signal("sdmmc1_dat2",
775 OMAP_PIN_INPUT_PULLUP
);
776 omap_mux_init_signal("sdmmc1_dat3",
777 OMAP_PIN_INPUT_PULLUP
);
779 if (mmc_controller
->slots
[0].caps
&
780 MMC_CAP_8_BIT_DATA
) {
781 omap_mux_init_signal("sdmmc1_dat4",
782 OMAP_PIN_INPUT_PULLUP
);
783 omap_mux_init_signal("sdmmc1_dat5",
784 OMAP_PIN_INPUT_PULLUP
);
785 omap_mux_init_signal("sdmmc1_dat6",
786 OMAP_PIN_INPUT_PULLUP
);
787 omap_mux_init_signal("sdmmc1_dat7",
788 OMAP_PIN_INPUT_PULLUP
);
791 if (controller_nr
== 1) {
793 omap_mux_init_signal("sdmmc2_clk",
794 OMAP_PIN_INPUT_PULLUP
);
795 omap_mux_init_signal("sdmmc2_cmd",
796 OMAP_PIN_INPUT_PULLUP
);
797 omap_mux_init_signal("sdmmc2_dat0",
798 OMAP_PIN_INPUT_PULLUP
);
801 * For 8 wire configurations, Lines DAT4, 5, 6 and 7 need to be muxed
802 * in the board-*.c files
804 if (mmc_controller
->slots
[0].caps
&
805 (MMC_CAP_4_BIT_DATA
| MMC_CAP_8_BIT_DATA
)) {
806 omap_mux_init_signal("sdmmc2_dat1",
807 OMAP_PIN_INPUT_PULLUP
);
808 omap_mux_init_signal("sdmmc2_dat2",
809 OMAP_PIN_INPUT_PULLUP
);
810 omap_mux_init_signal("sdmmc2_dat3",
811 OMAP_PIN_INPUT_PULLUP
);
813 if (mmc_controller
->slots
[0].caps
&
814 MMC_CAP_8_BIT_DATA
) {
815 omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
816 OMAP_PIN_INPUT_PULLUP
);
817 omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5",
818 OMAP_PIN_INPUT_PULLUP
);
819 omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
820 OMAP_PIN_INPUT_PULLUP
);
821 omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7",
822 OMAP_PIN_INPUT_PULLUP
);
827 * For MMC3 the pins need to be muxed in the board-*.c files
832 void __init
omap2_init_mmc(struct omap_mmc_platform_data
**mmc_data
,
838 for (i
= 0; i
< nr_controllers
; i
++) {
839 unsigned long base
, size
;
840 unsigned int irq
= 0;
845 omap2_mmc_mux(mmc_data
[i
], i
);
849 base
= OMAP2_MMC1_BASE
;
850 irq
= INT_24XX_MMC_IRQ
;
853 base
= OMAP2_MMC2_BASE
;
854 irq
= INT_24XX_MMC2_IRQ
;
857 if (!cpu_is_omap44xx() && !cpu_is_omap34xx())
859 base
= OMAP3_MMC3_BASE
;
860 irq
= INT_34XX_MMC3_IRQ
;
863 if (!cpu_is_omap44xx())
865 base
= OMAP4_MMC4_BASE
;
866 irq
= OMAP44XX_IRQ_MMC4
;
869 if (!cpu_is_omap44xx())
871 base
= OMAP4_MMC5_BASE
;
872 irq
= OMAP44XX_IRQ_MMC5
;
878 if (cpu_is_omap2420()) {
879 size
= OMAP2420_MMC_SIZE
;
881 } else if (cpu_is_omap44xx()) {
883 irq
+= OMAP44XX_IRQ_GIC_START
;
884 size
= OMAP4_HSMMC_SIZE
;
885 name
= "mmci-omap-hs";
887 size
= OMAP3_HSMMC_SIZE
;
888 name
= "mmci-omap-hs";
890 omap_mmc_add(name
, i
, base
, size
, irq
, mmc_data
[i
]);
896 /*-------------------------------------------------------------------------*/
898 #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
899 #if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
900 #define OMAP_HDQ_BASE 0x480B2000
902 static struct resource omap_hdq_resources
[] = {
904 .start
= OMAP_HDQ_BASE
,
905 .end
= OMAP_HDQ_BASE
+ 0x1C,
906 .flags
= IORESOURCE_MEM
,
909 .start
= INT_24XX_HDQ_IRQ
,
910 .flags
= IORESOURCE_IRQ
,
913 static struct platform_device omap_hdq_dev
= {
917 .platform_data
= NULL
,
919 .num_resources
= ARRAY_SIZE(omap_hdq_resources
),
920 .resource
= omap_hdq_resources
,
922 static inline void omap_hdq_init(void)
924 (void) platform_device_register(&omap_hdq_dev
);
927 static inline void omap_hdq_init(void) {}
930 /*---------------------------------------------------------------------------*/
932 #if defined(CONFIG_VIDEO_OMAP2_VOUT) || \
933 defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE)
934 #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
935 static struct resource omap_vout_resource
[3 - CONFIG_FB_OMAP2_NUM_FBS
] = {
938 static struct resource omap_vout_resource
[2] = {
942 static struct platform_device omap_vout_device
= {
944 .num_resources
= ARRAY_SIZE(omap_vout_resource
),
945 .resource
= &omap_vout_resource
[0],
948 static void omap_init_vout(void)
950 if (platform_device_register(&omap_vout_device
) < 0)
951 printk(KERN_ERR
"Unable to register OMAP-VOUT device\n");
954 static inline void omap_init_vout(void) {}
957 /*-------------------------------------------------------------------------*/
959 static int omap2_disable_wdt(struct omap_hwmod
*oh
, void *unused
)
961 return omap2_wd_timer_disable(oh
);
964 static void __init
omap_disable_wdt(void)
966 if (cpu_class_is_omap2())
967 omap_hwmod_for_each_by_class("wd_timer",
968 omap2_disable_wdt
, NULL
);
972 static int __init
omap2_init_devices(void)
975 * please keep these calls, and their implementations above,
976 * in alphabetical order so they're easier to sort through.
993 arch_initcall(omap2_init_devices
);
995 #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
996 struct omap_device_pm_latency omap_wdt_latency
[] = {
998 .deactivate_func
= omap_device_idle_hwmods
,
999 .activate_func
= omap_device_enable_hwmods
,
1000 .flags
= OMAP_DEVICE_LATENCY_AUTO_ADJUST
,
1004 static int __init
omap_init_wdt(void)
1007 struct omap_device
*od
;
1008 struct omap_hwmod
*oh
;
1009 char *oh_name
= "wd_timer2";
1010 char *dev_name
= "omap_wdt";
1012 if (!cpu_class_is_omap2())
1015 oh
= omap_hwmod_lookup(oh_name
);
1017 pr_err("Could not look up wd_timer%d hwmod\n", id
);
1021 od
= omap_device_build(dev_name
, id
, oh
, NULL
, 0,
1023 ARRAY_SIZE(omap_wdt_latency
), 0);
1024 WARN(IS_ERR(od
), "Cant build omap_device for %s:%s.\n",
1025 dev_name
, oh
->name
);
1028 subsys_initcall(omap_init_wdt
);