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>
21 #include <mach/hardware.h>
22 #include <mach/irqs.h>
23 #include <asm/mach-types.h>
24 #include <asm/mach/map.h>
28 #include <plat/board.h>
29 #include <plat/mcbsp.h>
30 #include <mach/gpio.h>
34 #include <plat/omap_hwmod.h>
35 #include <plat/omap_device.h>
36 #include <plat/omap4-keypad.h>
37 #include <plat/mcpdm.h>
39 #include <sound/omap-abe-dsp.h>
46 #define L3_MODULES_MAX_LEN 12
49 static int __init
omap3_l3_init(void)
52 struct omap_hwmod
*oh
;
53 struct omap_device
*od
;
54 char oh_name
[L3_MODULES_MAX_LEN
];
57 * To avoid code running on other OMAPs in
60 if (!(cpu_is_omap34xx()))
63 l
= snprintf(oh_name
, L3_MODULES_MAX_LEN
, "l3_main");
65 oh
= omap_hwmod_lookup(oh_name
);
68 pr_err("could not look up %s\n", oh_name
);
70 od
= omap_device_build("omap_l3_smx", 0, oh
, NULL
, 0,
73 WARN(IS_ERR(od
), "could not build omap_device for %s\n", oh_name
);
75 return IS_ERR(od
) ? PTR_ERR(od
) : 0;
77 postcore_initcall(omap3_l3_init
);
79 static int __init
omap4_l3_init(void)
82 struct omap_hwmod
*oh
[3];
83 struct omap_device
*od
;
84 char oh_name
[L3_MODULES_MAX_LEN
];
87 * To avoid code running on other OMAPs in
90 if (!(cpu_is_omap44xx()))
93 for (i
= 0; i
< L3_MODULES
; i
++) {
94 l
= snprintf(oh_name
, L3_MODULES_MAX_LEN
, "l3_main_%d", i
+1);
96 oh
[i
] = omap_hwmod_lookup(oh_name
);
98 pr_err("could not look up %s\n", oh_name
);
101 od
= omap_device_build_ss("omap_l3_noc", 0, oh
, 3, NULL
,
104 WARN(IS_ERR(od
), "could not build omap_device for %s\n", oh_name
);
106 return IS_ERR(od
) ? PTR_ERR(od
) : 0;
108 postcore_initcall(omap4_l3_init
);
110 #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
112 static struct resource omap2cam_resources
[] = {
114 .start
= OMAP24XX_CAMERA_BASE
,
115 .end
= OMAP24XX_CAMERA_BASE
+ 0xfff,
116 .flags
= IORESOURCE_MEM
,
119 .start
= INT_24XX_CAM_IRQ
,
120 .flags
= IORESOURCE_IRQ
,
124 static struct platform_device omap2cam_device
= {
125 .name
= "omap24xxcam",
127 .num_resources
= ARRAY_SIZE(omap2cam_resources
),
128 .resource
= omap2cam_resources
,
132 static struct resource omap3isp_resources
[] = {
134 .start
= OMAP3430_ISP_BASE
,
135 .end
= OMAP3430_ISP_END
,
136 .flags
= IORESOURCE_MEM
,
139 .start
= OMAP3430_ISP_CCP2_BASE
,
140 .end
= OMAP3430_ISP_CCP2_END
,
141 .flags
= IORESOURCE_MEM
,
144 .start
= OMAP3430_ISP_CCDC_BASE
,
145 .end
= OMAP3430_ISP_CCDC_END
,
146 .flags
= IORESOURCE_MEM
,
149 .start
= OMAP3430_ISP_HIST_BASE
,
150 .end
= OMAP3430_ISP_HIST_END
,
151 .flags
= IORESOURCE_MEM
,
154 .start
= OMAP3430_ISP_H3A_BASE
,
155 .end
= OMAP3430_ISP_H3A_END
,
156 .flags
= IORESOURCE_MEM
,
159 .start
= OMAP3430_ISP_PREV_BASE
,
160 .end
= OMAP3430_ISP_PREV_END
,
161 .flags
= IORESOURCE_MEM
,
164 .start
= OMAP3430_ISP_RESZ_BASE
,
165 .end
= OMAP3430_ISP_RESZ_END
,
166 .flags
= IORESOURCE_MEM
,
169 .start
= OMAP3430_ISP_SBL_BASE
,
170 .end
= OMAP3430_ISP_SBL_END
,
171 .flags
= IORESOURCE_MEM
,
174 .start
= OMAP3430_ISP_CSI2A_REGS1_BASE
,
175 .end
= OMAP3430_ISP_CSI2A_REGS1_END
,
176 .flags
= IORESOURCE_MEM
,
179 .start
= OMAP3430_ISP_CSIPHY2_BASE
,
180 .end
= OMAP3430_ISP_CSIPHY2_END
,
181 .flags
= IORESOURCE_MEM
,
184 .start
= OMAP3630_ISP_CSI2A_REGS2_BASE
,
185 .end
= OMAP3630_ISP_CSI2A_REGS2_END
,
186 .flags
= IORESOURCE_MEM
,
189 .start
= OMAP3630_ISP_CSI2C_REGS1_BASE
,
190 .end
= OMAP3630_ISP_CSI2C_REGS1_END
,
191 .flags
= IORESOURCE_MEM
,
194 .start
= OMAP3630_ISP_CSIPHY1_BASE
,
195 .end
= OMAP3630_ISP_CSIPHY1_END
,
196 .flags
= IORESOURCE_MEM
,
199 .start
= OMAP3630_ISP_CSI2C_REGS2_BASE
,
200 .end
= OMAP3630_ISP_CSI2C_REGS2_END
,
201 .flags
= IORESOURCE_MEM
,
204 .start
= INT_34XX_CAM_IRQ
,
205 .flags
= IORESOURCE_IRQ
,
209 static struct platform_device omap3isp_device
= {
212 .num_resources
= ARRAY_SIZE(omap3isp_resources
),
213 .resource
= omap3isp_resources
,
216 int omap3_init_camera(struct isp_platform_data
*pdata
)
218 omap3isp_device
.dev
.platform_data
= pdata
;
219 return platform_device_register(&omap3isp_device
);
222 static inline void omap_init_camera(void)
224 #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
225 if (cpu_is_omap24xx())
226 platform_device_register(&omap2cam_device
);
230 struct omap_device_pm_latency omap_keyboard_latency
[] = {
232 .deactivate_func
= omap_device_idle_hwmods
,
233 .activate_func
= omap_device_enable_hwmods
,
234 .flags
= OMAP_DEVICE_LATENCY_AUTO_ADJUST
,
238 int __init
omap4_keyboard_init(struct omap4_keypad_platform_data
239 *sdp4430_keypad_data
)
241 struct omap_device
*od
;
242 struct omap_hwmod
*oh
;
243 struct omap4_keypad_platform_data
*keypad_data
;
244 unsigned int id
= -1;
245 char *oh_name
= "kbd";
246 char *name
= "omap4-keypad";
248 oh
= omap_hwmod_lookup(oh_name
);
250 pr_err("Could not look up %s\n", oh_name
);
254 keypad_data
= sdp4430_keypad_data
;
256 od
= omap_device_build(name
, id
, oh
, keypad_data
,
257 sizeof(struct omap4_keypad_platform_data
),
258 omap_keyboard_latency
,
259 ARRAY_SIZE(omap_keyboard_latency
), 0);
262 WARN(1, "Can't build omap_device for %s:%s.\n",
270 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
271 static struct omap_device_pm_latency mbox_latencies
[] = {
273 .activate_func
= omap_device_enable_hwmods
,
274 .deactivate_func
= omap_device_idle_hwmods
,
275 .flags
= OMAP_DEVICE_LATENCY_AUTO_ADJUST
,
279 static inline void omap_init_mbox(void)
281 struct omap_hwmod
*oh
;
282 struct omap_device
*od
;
284 oh
= omap_hwmod_lookup("mailbox");
286 pr_err("%s: unable to find hwmod\n", __func__
);
290 od
= omap_device_build("omap-mailbox", -1, oh
, NULL
, 0,
291 mbox_latencies
, ARRAY_SIZE(mbox_latencies
), 0);
292 WARN(IS_ERR(od
), "%s: could not build device, err %ld\n",
293 __func__
, PTR_ERR(od
));
296 static inline void omap_init_mbox(void) { }
297 #endif /* CONFIG_OMAP_MBOX_FWK */
299 static inline void omap_init_sti(void) {}
301 #if defined(CONFIG_SND_OMAP_SOC_MCPDM) || \
302 defined(CONFIG_SND_OMAP_SOC_MCPDM_MODULE)
304 static struct omap_device_pm_latency omap_mcpdm_latency
[] = {
306 .deactivate_func
= omap_device_idle_hwmods
,
307 .activate_func
= omap_device_enable_hwmods
,
308 .flags
= OMAP_DEVICE_LATENCY_AUTO_ADJUST
,
312 static void omap_init_mcpdm(void)
314 struct omap_hwmod
*oh
;
315 struct omap_device
*od
;
316 struct omap_mcpdm_platform_data
*pdata
;
317 char *oh_name
= "mcpdm";
318 char *dev_name
= "omap-mcpdm";
321 * Init McPDM pins for OMAP4 to prevent the occurrence of
322 * noise at the output of the Audio IC
324 if (cpu_is_omap44xx()) {
325 omap_mux_init_signal("abe_pdm_ul_data.abe_pdm_ul_data",
326 OMAP_PIN_INPUT_PULLDOWN
);
328 omap_mux_init_signal("abe_pdm_dl_data.abe_pdm_dl_data",
329 OMAP_PIN_INPUT_PULLDOWN
);
331 omap_mux_init_signal("abe_pdm_frame.abe_pdm_frame",
332 OMAP_PIN_INPUT_PULLUP
);
334 omap_mux_init_signal("abe_pdm_lb_clk.abe_pdm_lb_clk",
335 OMAP_PIN_INPUT_PULLDOWN
);
337 omap_mux_init_signal("abe_clks.abe_clks",
338 OMAP_PIN_INPUT_PULLDOWN
);
341 oh
= omap_hwmod_lookup(oh_name
);
343 pr_err("%s: could not look up %s\n", __func__
, oh_name
);
347 pdata
= kzalloc(sizeof(struct omap_mcpdm_platform_data
), GFP_KERNEL
);
349 pr_err("%s: could not allocate platform data\n", __func__
);
353 pdata
->was_context_lost
= omap_pm_was_context_lost
;
355 od
= omap_device_build(dev_name
, -1, oh
, pdata
,
356 sizeof(struct omap_mcpdm_platform_data
),
358 ARRAY_SIZE(omap_mcpdm_latency
), 0);
359 WARN(IS_ERR(od
), "could not build omap_device for %s:%s\n",
363 static inline void omap_init_mcpdm(void) {}
366 #if defined(CONFIG_SND_OMAP_SOC_ABE_DSP) || \
367 defined(CONFIG_SND_OMAP_SOC_ABE_DSP_MODULE)
369 static struct omap_device_pm_latency omap_aess_latency
[] = {
371 .deactivate_func
= omap_device_idle_hwmods
,
372 .activate_func
= omap_device_enable_hwmods
,
373 .flags
= OMAP_DEVICE_LATENCY_AUTO_ADJUST
,
377 static void omap_init_aess(void)
379 struct omap_hwmod
*oh
;
380 struct omap_device
*od
;
381 struct omap4_abe_dsp_pdata
*pdata
;
382 char *oh_name
= "aess";
383 char *dev_name
= "aess";
385 oh
= omap_hwmod_lookup(oh_name
);
387 pr_err("%s: could not look up %s\n", __func__
, oh_name
);
391 pdata
= kzalloc(sizeof(struct omap4_abe_dsp_pdata
), GFP_KERNEL
);
393 pr_err("%s: could not allocate platform data\n", __func__
);
397 pdata
->device_scale
= omap_device_scale
;
398 pdata
->was_context_lost
= omap_pm_was_context_lost
;
400 od
= omap_device_build(dev_name
, -1, oh
, pdata
,
401 sizeof(struct omap4_abe_dsp_pdata
),
403 ARRAY_SIZE(omap_aess_latency
), 0);
404 WARN(IS_ERR(od
), "could not build omap_device for %s:%s\n",
410 static inline void omap_init_aess(void) {}
413 #if defined CONFIG_ARCH_OMAP4
415 static struct platform_device omap_abe_dai
= {
416 .name
= "omap-abe-dai",
420 static inline void omap_init_abe(void)
422 platform_device_register(&omap_abe_dai
);
425 static inline void omap_init_abe(void) {}
428 #if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
430 static struct platform_device omap_pcm
= {
431 .name
= "omap-pcm-audio",
436 * Device for the ASoC OMAP4 HDMI machine driver
438 static struct platform_device omap4_hdmi_audio
= {
439 .name
= "omap4-hdmi-audio",
444 * OMAP2420 has 2 McBSP ports
445 * OMAP2430 has 5 McBSP ports
446 * OMAP3 has 5 McBSP ports
447 * OMAP4 has 4 McBSP ports
449 OMAP_MCBSP_PLATFORM_DEVICE(1);
450 OMAP_MCBSP_PLATFORM_DEVICE(2);
451 OMAP_MCBSP_PLATFORM_DEVICE(3);
452 OMAP_MCBSP_PLATFORM_DEVICE(4);
453 OMAP_MCBSP_PLATFORM_DEVICE(5);
455 static void omap_init_audio(void)
457 struct omap_hwmod
*oh_hdmi
;
458 struct omap_device
*od_hdmi
, *od_hdmi_codec
;
459 char *oh_hdmi_name
= "dss_hdmi";
460 char *dev_hdmi_name
= "hdmi-audio-dai";
461 char *dev_hdmi_codec_name
= "omap-hdmi-codec";
463 if (cpu_is_omap44xx()) {
464 oh_hdmi
= omap_hwmod_lookup(oh_hdmi_name
);
465 WARN(!oh_hdmi
, "%s: could not find omap_hwmod for %s\n",
466 __func__
, oh_hdmi_name
);
468 od_hdmi
= omap_device_build(dev_hdmi_name
, -1, oh_hdmi
, NULL
, 0,
470 WARN(IS_ERR(od_hdmi
), "%s: could not build omap_device for %s\n",
471 __func__
, dev_hdmi_name
);
473 od_hdmi_codec
= omap_device_build(dev_hdmi_codec_name
,
474 -1, oh_hdmi
, NULL
, 0, NULL
, 0, false);
476 WARN(IS_ERR(od_hdmi_codec
), "%s: could not build omap_device for %s\n",
477 __func__
, dev_hdmi_codec_name
);
479 platform_device_register(&omap4_hdmi_audio
);
482 platform_device_register(&omap_mcbsp1
);
483 platform_device_register(&omap_mcbsp2
);
484 if (cpu_is_omap243x() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
485 platform_device_register(&omap_mcbsp3
);
486 platform_device_register(&omap_mcbsp4
);
488 if (cpu_is_omap243x() || cpu_is_omap34xx())
489 platform_device_register(&omap_mcbsp5
);
491 platform_device_register(&omap_pcm
);
495 static inline void omap_init_audio(void) {}
498 #if defined(CONFIG_SND_OMAP_SOC_MCASP) || \
499 defined(CONFIG_SND_OMAP_SOC_MCASP_MODULE)
500 static struct omap_device_pm_latency omap_mcasp_latency
[] = {
502 .deactivate_func
= omap_device_idle_hwmods
,
503 .activate_func
= omap_device_enable_hwmods
,
504 .flags
= OMAP_DEVICE_LATENCY_AUTO_ADJUST
,
508 static void omap_init_mcasp(void)
510 struct omap_hwmod
*oh
;
511 struct omap_device
*od
;
512 char *oh_name
= "omap-mcasp-dai";
513 char *dev_name
= "omap-mcasp-dai";
515 oh
= omap_hwmod_lookup(oh_name
);
517 pr_err("%s: could not look up %s\n", __func__
, oh_name
);
521 od
= omap_device_build(dev_name
, -1, oh
, NULL
, 0,
523 ARRAY_SIZE(omap_mcasp_latency
), 0);
524 WARN(IS_ERR(od
), "could not build omap_device for %s:%s\n",
528 static inline void omap_init_mcasp(void) {}
531 #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
533 #include <plat/mcspi.h>
535 struct omap_device_pm_latency omap_mcspi_latency
[] = {
537 .deactivate_func
= omap_device_idle_hwmods
,
538 .activate_func
= omap_device_enable_hwmods
,
539 .flags
= OMAP_DEVICE_LATENCY_AUTO_ADJUST
,
543 static int omap_mcspi_init(struct omap_hwmod
*oh
, void *unused
)
545 struct omap_device
*od
;
546 char *name
= "omap2_mcspi";
547 struct omap2_mcspi_platform_config
*pdata
;
549 struct omap2_mcspi_dev_attr
*mcspi_attrib
= oh
->dev_attr
;
551 pdata
= kzalloc(sizeof(*pdata
), GFP_KERNEL
);
553 pr_err("Memory allocation for McSPI device failed\n");
557 pdata
->num_cs
= mcspi_attrib
->num_chipselect
;
558 switch (oh
->class->rev
) {
559 case OMAP2_MCSPI_REV
:
560 case OMAP3_MCSPI_REV
:
561 pdata
->regs_offset
= 0;
563 case OMAP4_MCSPI_REV
:
564 pdata
->regs_offset
= OMAP4_MCSPI_REG_OFFSET
;
567 pr_err("Invalid McSPI Revision value\n");
572 od
= omap_device_build(name
, spi_num
, oh
, pdata
,
573 sizeof(*pdata
), omap_mcspi_latency
,
574 ARRAY_SIZE(omap_mcspi_latency
), 0);
575 WARN(IS_ERR(od
), "Can't build omap_device for %s:%s\n",
581 static void omap_init_mcspi(void)
583 omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init
, NULL
);
587 static inline void omap_init_mcspi(void) {}
590 static struct resource omap2_pmu_resource
= {
593 .flags
= IORESOURCE_IRQ
,
596 static struct resource omap3_pmu_resource
= {
597 .start
= INT_34XX_BENCH_MPU_EMUL
,
598 .end
= INT_34XX_BENCH_MPU_EMUL
,
599 .flags
= IORESOURCE_IRQ
,
602 static struct platform_device omap_pmu_device
= {
604 .id
= ARM_PMU_DEVICE_CPU
,
608 static void omap_init_pmu(void)
610 if (cpu_is_omap24xx())
611 omap_pmu_device
.resource
= &omap2_pmu_resource
;
612 else if (cpu_is_omap34xx())
613 omap_pmu_device
.resource
= &omap3_pmu_resource
;
617 platform_device_register(&omap_pmu_device
);
621 #if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE)
623 #ifdef CONFIG_ARCH_OMAP2
624 static struct resource omap2_sham_resources
[] = {
626 .start
= OMAP24XX_SEC_SHA1MD5_BASE
,
627 .end
= OMAP24XX_SEC_SHA1MD5_BASE
+ 0x64,
628 .flags
= IORESOURCE_MEM
,
631 .start
= INT_24XX_SHA1MD5
,
632 .flags
= IORESOURCE_IRQ
,
635 static int omap2_sham_resources_sz
= ARRAY_SIZE(omap2_sham_resources
);
637 #define omap2_sham_resources NULL
638 #define omap2_sham_resources_sz 0
641 #ifdef CONFIG_ARCH_OMAP3
642 static struct resource omap3_sham_resources
[] = {
644 .start
= OMAP34XX_SEC_SHA1MD5_BASE
,
645 .end
= OMAP34XX_SEC_SHA1MD5_BASE
+ 0x64,
646 .flags
= IORESOURCE_MEM
,
649 .start
= INT_34XX_SHA1MD52_IRQ
,
650 .flags
= IORESOURCE_IRQ
,
653 .start
= OMAP34XX_DMA_SHA1MD5_RX
,
654 .flags
= IORESOURCE_DMA
,
657 static int omap3_sham_resources_sz
= ARRAY_SIZE(omap3_sham_resources
);
659 #define omap3_sham_resources NULL
660 #define omap3_sham_resources_sz 0
663 static struct platform_device sham_device
= {
668 static void omap_init_sham(void)
670 if (cpu_is_omap24xx()) {
671 sham_device
.resource
= omap2_sham_resources
;
672 sham_device
.num_resources
= omap2_sham_resources_sz
;
673 } else if (cpu_is_omap34xx()) {
674 sham_device
.resource
= omap3_sham_resources
;
675 sham_device
.num_resources
= omap3_sham_resources_sz
;
677 pr_err("%s: platform not supported\n", __func__
);
680 platform_device_register(&sham_device
);
683 static inline void omap_init_sham(void) { }
686 #if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE)
688 #ifdef CONFIG_ARCH_OMAP2
689 static struct resource omap2_aes_resources
[] = {
691 .start
= OMAP24XX_SEC_AES_BASE
,
692 .end
= OMAP24XX_SEC_AES_BASE
+ 0x4C,
693 .flags
= IORESOURCE_MEM
,
696 .start
= OMAP24XX_DMA_AES_TX
,
697 .flags
= IORESOURCE_DMA
,
700 .start
= OMAP24XX_DMA_AES_RX
,
701 .flags
= IORESOURCE_DMA
,
704 static int omap2_aes_resources_sz
= ARRAY_SIZE(omap2_aes_resources
);
706 #define omap2_aes_resources NULL
707 #define omap2_aes_resources_sz 0
710 #ifdef CONFIG_ARCH_OMAP3
711 static struct resource omap3_aes_resources
[] = {
713 .start
= OMAP34XX_SEC_AES_BASE
,
714 .end
= OMAP34XX_SEC_AES_BASE
+ 0x4C,
715 .flags
= IORESOURCE_MEM
,
718 .start
= OMAP34XX_DMA_AES2_TX
,
719 .flags
= IORESOURCE_DMA
,
722 .start
= OMAP34XX_DMA_AES2_RX
,
723 .flags
= IORESOURCE_DMA
,
726 static int omap3_aes_resources_sz
= ARRAY_SIZE(omap3_aes_resources
);
728 #define omap3_aes_resources NULL
729 #define omap3_aes_resources_sz 0
732 static struct platform_device aes_device
= {
737 static void omap_init_aes(void)
739 if (cpu_is_omap24xx()) {
740 aes_device
.resource
= omap2_aes_resources
;
741 aes_device
.num_resources
= omap2_aes_resources_sz
;
742 } else if (cpu_is_omap34xx()) {
743 aes_device
.resource
= omap3_aes_resources
;
744 aes_device
.num_resources
= omap3_aes_resources_sz
;
746 pr_err("%s: platform not supported\n", __func__
);
749 platform_device_register(&aes_device
);
753 static inline void omap_init_aes(void) { }
756 /*-------------------------------------------------------------------------*/
758 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
760 static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
763 if ((mmc_controller
->slots
[0].switch_pin
> 0) && \
764 (mmc_controller
->slots
[0].switch_pin
< OMAP_MAX_GPIO_LINES
))
765 omap_mux_init_gpio(mmc_controller
->slots
[0].switch_pin
,
766 OMAP_PIN_INPUT_PULLUP
);
767 if ((mmc_controller
->slots
[0].gpio_wp
> 0) && \
768 (mmc_controller
->slots
[0].gpio_wp
< OMAP_MAX_GPIO_LINES
))
769 omap_mux_init_gpio(mmc_controller
->slots
[0].gpio_wp
,
770 OMAP_PIN_INPUT_PULLUP
);
772 omap_mux_init_signal("sdmmc_cmd", 0);
773 omap_mux_init_signal("sdmmc_clki", 0);
774 omap_mux_init_signal("sdmmc_clko", 0);
775 omap_mux_init_signal("sdmmc_dat0", 0);
776 omap_mux_init_signal("sdmmc_dat_dir0", 0);
777 omap_mux_init_signal("sdmmc_cmd_dir", 0);
778 if (mmc_controller
->slots
[0].caps
& MMC_CAP_4_BIT_DATA
) {
779 omap_mux_init_signal("sdmmc_dat1", 0);
780 omap_mux_init_signal("sdmmc_dat2", 0);
781 omap_mux_init_signal("sdmmc_dat3", 0);
782 omap_mux_init_signal("sdmmc_dat_dir1", 0);
783 omap_mux_init_signal("sdmmc_dat_dir2", 0);
784 omap_mux_init_signal("sdmmc_dat_dir3", 0);
788 * Use internal loop-back in MMC/SDIO Module Input Clock
791 if (mmc_controller
->slots
[0].internal_clock
) {
792 u32 v
= omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0
);
794 omap_ctrl_writel(v
, OMAP2_CONTROL_DEVCONF0
);
798 void __init
omap242x_init_mmc(struct omap_mmc_platform_data
**mmc_data
)
800 char *name
= "mmci-omap";
803 pr_err("%s fails: Incomplete platform data\n", __func__
);
807 omap242x_mmc_mux(mmc_data
[0]);
808 omap_mmc_add(name
, 0, OMAP2_MMC1_BASE
, OMAP2420_MMC_SIZE
,
809 INT_24XX_MMC_IRQ
, mmc_data
[0]);
814 /*-------------------------------------------------------------------------*/
816 #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
817 #if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430)
818 #define OMAP_HDQ_BASE 0x480B2000
820 static struct resource omap_hdq_resources
[] = {
822 .start
= OMAP_HDQ_BASE
,
823 .end
= OMAP_HDQ_BASE
+ 0x1C,
824 .flags
= IORESOURCE_MEM
,
827 .start
= INT_24XX_HDQ_IRQ
,
828 .flags
= IORESOURCE_IRQ
,
831 static struct platform_device omap_hdq_dev
= {
835 .platform_data
= NULL
,
837 .num_resources
= ARRAY_SIZE(omap_hdq_resources
),
838 .resource
= omap_hdq_resources
,
840 static inline void omap_hdq_init(void)
842 (void) platform_device_register(&omap_hdq_dev
);
845 static inline void omap_hdq_init(void) {}
848 /*---------------------------------------------------------------------------*/
850 #if defined(CONFIG_VIDEO_OMAP2_VOUT) || \
851 defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE)
852 #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
853 static struct resource omap_vout_resource
[3 - CONFIG_FB_OMAP2_NUM_FBS
] = {
856 static struct resource omap_vout_resource
[2] = {
860 static struct platform_device omap_vout_device
= {
862 .num_resources
= ARRAY_SIZE(omap_vout_resource
),
863 .resource
= &omap_vout_resource
[0],
866 static void omap_init_vout(void)
868 if (platform_device_register(&omap_vout_device
) < 0)
869 printk(KERN_ERR
"Unable to register OMAP-VOUT device\n");
872 static inline void omap_init_vout(void) {}
875 static struct omap_device_pm_latency omap_gpu_latency
[] = {
877 .deactivate_func
= omap_device_idle_hwmods
,
878 .activate_func
= omap_device_enable_hwmods
,
879 .flags
= OMAP_DEVICE_LATENCY_AUTO_ADJUST
,
883 static struct platform_device omap_omaplfb_device
= {
889 static void omap_init_gpu(void)
891 struct omap_hwmod
*oh
;
892 struct omap_device
*od
;
893 int max_omap_gpu_hwmod_name_len
= 16;
894 char oh_name
[max_omap_gpu_hwmod_name_len
];
896 struct gpu_platform_data
*pdata
;
897 char *name
= "pvrsrvkm";
899 l
= snprintf(oh_name
, max_omap_gpu_hwmod_name_len
,
901 WARN(l
>= max_omap_gpu_hwmod_name_len
,
902 "String buffer overflow in GPU device setup\n");
904 oh
= omap_hwmod_lookup(oh_name
);
907 pr_err("omap_init_gpu: Could not look up %s\n", oh_name
);
911 pdata
= kzalloc(sizeof(struct gpu_platform_data
),
914 pr_err("omap_init_gpu: Platform data memory allocation failed\n");
918 pdata
->device_scale
= omap_device_scale
;
919 pdata
->device_enable
= omap_device_enable
;
920 pdata
->device_idle
= omap_device_idle
;
921 pdata
->device_shutdown
= omap_device_shutdown
;
922 pdata
->opp_get_opp_count
= opp_get_opp_count
;
923 pdata
->opp_find_freq_ceil
= opp_find_freq_ceil
;
924 pdata
->access_process_vm
= access_process_vm
;
927 if (cpu_is_omap446x())
930 od
= omap_device_build(name
, 0, oh
, pdata
,
931 sizeof(struct gpu_platform_data
),
932 omap_gpu_latency
, ARRAY_SIZE(omap_gpu_latency
), 0);
933 WARN(IS_ERR(od
), "Could not build omap_device for %s %s\n",
937 platform_device_register(&omap_omaplfb_device
);
940 /*-------------------------------------------------------------------------*/
942 static int __init
omap2_init_devices(void)
945 * please keep these calls, and their implementations above,
946 * in alphabetical order so they're easier to sort through.
966 arch_initcall(omap2_init_devices
);
968 #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
969 static struct omap_device_pm_latency omap_wdt_latency
[] = {
971 .deactivate_func
= omap_device_idle_hwmods
,
972 .activate_func
= omap_device_enable_hwmods
,
973 .flags
= OMAP_DEVICE_LATENCY_AUTO_ADJUST
,
977 static int __init
omap_init_wdt(void)
980 struct omap_device
*od
;
981 struct omap_hwmod
*oh
;
982 char *oh_name
= "wd_timer2";
983 char *dev_name
= "omap_wdt";
985 if (!cpu_class_is_omap2())
988 oh
= omap_hwmod_lookup(oh_name
);
990 pr_err("Could not look up wd_timer%d hwmod\n", id
);
994 od
= omap_device_build(dev_name
, id
, oh
, NULL
, 0,
996 ARRAY_SIZE(omap_wdt_latency
), 0);
997 WARN(IS_ERR(od
), "Can't build omap_device for %s:%s.\n",
1001 subsys_initcall(omap_init_wdt
);