blob: 6a320b61631e7b367d1a87cbe634fc86c4c5d660 [file] [log] [blame]
Tony Lindgren1dbae812005-11-10 14:26:51 +00001/*
2 * linux/arch/arm/mach-omap2/devices.c
3 *
4 * OMAP2 platform device setup/initialization
5 *
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.
10 */
11
Tony Lindgren1dbae812005-11-10 14:26:51 +000012#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/platform_device.h>
Russell Kingfced80c2008-09-06 12:10:45 +010015#include <linux/io.h>
Kevin Hilman917fa282008-12-10 17:37:17 -080016#include <linux/clk.h>
Varadarajan, Charulathaf2ce6232010-09-23 20:02:42 +053017#include <linux/err.h>
Charulatha V1a5d8192011-02-02 17:52:14 +053018#include <linux/slab.h>
Tony Lindgren1dbae812005-11-10 14:26:51 +000019
Russell Kinga09e64f2008-08-05 16:14:15 +010020#include <mach/hardware.h>
Will Deacon88341332010-04-09 13:54:43 +010021#include <mach/irqs.h>
Tony Lindgren1dbae812005-11-10 14:26:51 +000022#include <asm/mach-types.h>
23#include <asm/mach/map.h>
Will Deacon88341332010-04-09 13:54:43 +010024#include <asm/pmu.h>
Tony Lindgren1dbae812005-11-10 14:26:51 +000025
Tony Lindgrence491cf2009-10-20 09:40:47 -070026#include <plat/tc.h>
27#include <plat/board.h>
Jarkko Nikulaa09f73f2010-10-04 15:04:53 +030028#include <plat/mcbsp.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010029#include <mach/gpio.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070030#include <plat/mmc.h>
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +080031#include <plat/dma.h>
Varadarajan, Charulathaf2ce6232010-09-23 20:02:42 +053032#include <plat/omap_hwmod.h>
33#include <plat/omap_device.h>
Syed Rafiuddin59556762010-12-27 05:51:45 +000034#include <plat/omap4-keypad.h>
Tony Lindgren1dbae812005-11-10 14:26:51 +000035
Tony Lindgren4896e392009-12-11 16:16:32 -080036#include "mux.h"
Paul Walmsley4814ced2010-10-08 11:40:20 -060037#include "control.h"
Tony Lindgren4896e392009-12-11 16:16:32 -080038
sricharan0abcf612011-02-08 14:10:45 +053039#define L3_MODULES_MAX_LEN 12
40
41static int __init omap3_l3_init(void)
42{
43 int l;
44 struct omap_hwmod *oh;
45 struct omap_device *od;
46 char oh_name[L3_MODULES_MAX_LEN];
47
48 /*
49 * To avoid code running on other OMAPs in
50 * multi-omap builds
51 */
52 if (!(cpu_is_omap34xx()))
53 return -ENODEV;
54
55 l = snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main");
56
57 oh = omap_hwmod_lookup(oh_name);
58
59 if (!oh)
60 pr_err("could not look up %s\n", oh_name);
61
62 od = omap_device_build("omap_l3_smx", 0, oh, NULL, 0,
63 NULL, 0, 0);
64
65 WARN(IS_ERR(od), "could not build omap_device for %s\n", oh_name);
66
67 return PTR_ERR(od);
68}
69postcore_initcall(omap3_l3_init);
70
Tony Lindgren828c7072009-03-23 18:23:49 -070071#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
Tony Lindgrenc40fae952006-12-07 13:58:10 -080072
Tony Lindgren828c7072009-03-23 18:23:49 -070073static struct resource cam_resources[] = {
Tony Lindgrenc40fae952006-12-07 13:58:10 -080074 {
Tony Lindgren828c7072009-03-23 18:23:49 -070075 .start = OMAP24XX_CAMERA_BASE,
76 .end = OMAP24XX_CAMERA_BASE + 0xfff,
77 .flags = IORESOURCE_MEM,
78 },
79 {
80 .start = INT_24XX_CAM_IRQ,
81 .flags = IORESOURCE_IRQ,
82 }
83};
84
85static struct platform_device omap_cam_device = {
86 .name = "omap24xxcam",
87 .id = -1,
88 .num_resources = ARRAY_SIZE(cam_resources),
89 .resource = cam_resources,
90};
91
92static inline void omap_init_camera(void)
93{
94 platform_device_register(&omap_cam_device);
95}
96
97#elif defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
98
99static struct resource omap3isp_resources[] = {
100 {
101 .start = OMAP3430_ISP_BASE,
102 .end = OMAP3430_ISP_END,
103 .flags = IORESOURCE_MEM,
104 },
105 {
106 .start = OMAP3430_ISP_CBUFF_BASE,
107 .end = OMAP3430_ISP_CBUFF_END,
108 .flags = IORESOURCE_MEM,
109 },
110 {
111 .start = OMAP3430_ISP_CCP2_BASE,
112 .end = OMAP3430_ISP_CCP2_END,
113 .flags = IORESOURCE_MEM,
114 },
115 {
116 .start = OMAP3430_ISP_CCDC_BASE,
117 .end = OMAP3430_ISP_CCDC_END,
118 .flags = IORESOURCE_MEM,
119 },
120 {
121 .start = OMAP3430_ISP_HIST_BASE,
122 .end = OMAP3430_ISP_HIST_END,
123 .flags = IORESOURCE_MEM,
124 },
125 {
126 .start = OMAP3430_ISP_H3A_BASE,
127 .end = OMAP3430_ISP_H3A_END,
128 .flags = IORESOURCE_MEM,
129 },
130 {
131 .start = OMAP3430_ISP_PREV_BASE,
132 .end = OMAP3430_ISP_PREV_END,
133 .flags = IORESOURCE_MEM,
134 },
135 {
136 .start = OMAP3430_ISP_RESZ_BASE,
137 .end = OMAP3430_ISP_RESZ_END,
138 .flags = IORESOURCE_MEM,
139 },
140 {
141 .start = OMAP3430_ISP_SBL_BASE,
142 .end = OMAP3430_ISP_SBL_END,
143 .flags = IORESOURCE_MEM,
144 },
145 {
146 .start = OMAP3430_ISP_CSI2A_BASE,
147 .end = OMAP3430_ISP_CSI2A_END,
148 .flags = IORESOURCE_MEM,
149 },
150 {
151 .start = OMAP3430_ISP_CSI2PHY_BASE,
152 .end = OMAP3430_ISP_CSI2PHY_END,
153 .flags = IORESOURCE_MEM,
154 },
155 {
156 .start = INT_34XX_CAM_IRQ,
157 .flags = IORESOURCE_IRQ,
158 }
159};
160
161static struct platform_device omap3isp_device = {
162 .name = "omap3isp",
163 .id = -1,
164 .num_resources = ARRAY_SIZE(omap3isp_resources),
165 .resource = omap3isp_resources,
166};
167
168static inline void omap_init_camera(void)
169{
170 platform_device_register(&omap3isp_device);
171}
172#else
173static inline void omap_init_camera(void)
174{
175}
176#endif
177
Syed Rafiuddin59556762010-12-27 05:51:45 +0000178struct omap_device_pm_latency omap_keyboard_latency[] = {
179 {
180 .deactivate_func = omap_device_idle_hwmods,
181 .activate_func = omap_device_enable_hwmods,
182 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
183 },
184};
185
186int __init omap4_keyboard_init(struct omap4_keypad_platform_data
187 *sdp4430_keypad_data)
188{
189 struct omap_device *od;
190 struct omap_hwmod *oh;
191 struct omap4_keypad_platform_data *keypad_data;
192 unsigned int id = -1;
193 char *oh_name = "kbd";
194 char *name = "omap4-keypad";
195
196 oh = omap_hwmod_lookup(oh_name);
197 if (!oh) {
198 pr_err("Could not look up %s\n", oh_name);
199 return -ENODEV;
200 }
201
202 keypad_data = sdp4430_keypad_data;
203
204 od = omap_device_build(name, id, oh, keypad_data,
205 sizeof(struct omap4_keypad_platform_data),
206 omap_keyboard_latency,
207 ARRAY_SIZE(omap_keyboard_latency), 0);
208
209 if (IS_ERR(od)) {
210 WARN(1, "Cant build omap_device for %s:%s.\n",
211 name, oh->name);
212 return PTR_ERR(od);
213 }
214
215 return 0;
216}
217
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700218#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
Felipe Contreras69dbf852011-02-24 12:51:33 -0800219static struct omap_device_pm_latency mbox_latencies[] = {
220 [0] = {
221 .activate_func = omap_device_enable_hwmods,
222 .deactivate_func = omap_device_idle_hwmods,
223 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800224 },
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800225};
226
227static inline void omap_init_mbox(void)
228{
Felipe Contreras69dbf852011-02-24 12:51:33 -0800229 struct omap_hwmod *oh;
230 struct omap_device *od;
231
232 oh = omap_hwmod_lookup("mailbox");
233 if (!oh) {
234 pr_err("%s: unable to find hwmod\n", __func__);
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700235 return;
236 }
Felipe Contreras69dbf852011-02-24 12:51:33 -0800237
238 od = omap_device_build("omap-mailbox", -1, oh, NULL, 0,
239 mbox_latencies, ARRAY_SIZE(mbox_latencies), 0);
240 WARN(IS_ERR(od), "%s: could not build device, err %ld\n",
241 __func__, PTR_ERR(od));
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800242}
243#else
244static inline void omap_init_mbox(void) { }
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700245#endif /* CONFIG_OMAP_MBOX_FWK */
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800246
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100247static inline void omap_init_sti(void) {}
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100248
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000249#if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
250
251static struct platform_device omap_pcm = {
252 .name = "omap-pcm-audio",
253 .id = -1,
254};
255
256/*
257 * OMAP2420 has 2 McBSP ports
258 * OMAP2430 has 5 McBSP ports
259 * OMAP3 has 5 McBSP ports
260 * OMAP4 has 4 McBSP ports
261 */
262OMAP_MCBSP_PLATFORM_DEVICE(1);
263OMAP_MCBSP_PLATFORM_DEVICE(2);
264OMAP_MCBSP_PLATFORM_DEVICE(3);
265OMAP_MCBSP_PLATFORM_DEVICE(4);
266OMAP_MCBSP_PLATFORM_DEVICE(5);
267
268static void omap_init_audio(void)
269{
270 platform_device_register(&omap_mcbsp1);
271 platform_device_register(&omap_mcbsp2);
272 if (cpu_is_omap243x() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
273 platform_device_register(&omap_mcbsp3);
274 platform_device_register(&omap_mcbsp4);
275 }
276 if (cpu_is_omap243x() || cpu_is_omap34xx())
277 platform_device_register(&omap_mcbsp5);
278
279 platform_device_register(&omap_pcm);
280}
281
282#else
283static inline void omap_init_audio(void) {}
284#endif
285
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300286#if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700287
Tony Lindgrence491cf2009-10-20 09:40:47 -0700288#include <plat/mcspi.h>
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700289
Charulatha V1a5d8192011-02-02 17:52:14 +0530290struct omap_device_pm_latency omap_mcspi_latency[] = {
291 [0] = {
292 .deactivate_func = omap_device_idle_hwmods,
293 .activate_func = omap_device_enable_hwmods,
294 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800295 },
296};
297
Charulatha V1a5d8192011-02-02 17:52:14 +0530298static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700299{
Charulatha V1a5d8192011-02-02 17:52:14 +0530300 struct omap_device *od;
301 char *name = "omap2_mcspi";
302 struct omap2_mcspi_platform_config *pdata;
303 static int spi_num;
304 struct omap2_mcspi_dev_attr *mcspi_attrib = oh->dev_attr;
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700305
Charulatha V1a5d8192011-02-02 17:52:14 +0530306 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
307 if (!pdata) {
308 pr_err("Memory allocation for McSPI device failed\n");
309 return -ENOMEM;
310 }
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700311
Charulatha V1a5d8192011-02-02 17:52:14 +0530312 pdata->num_cs = mcspi_attrib->num_chipselect;
313 switch (oh->class->rev) {
314 case OMAP2_MCSPI_REV:
315 case OMAP3_MCSPI_REV:
316 pdata->regs_offset = 0;
317 break;
318 case OMAP4_MCSPI_REV:
319 pdata->regs_offset = OMAP4_MCSPI_REG_OFFSET;
320 break;
321 default:
322 pr_err("Invalid McSPI Revision value\n");
323 return -EINVAL;
324 }
325
326 spi_num++;
327 od = omap_device_build(name, spi_num, oh, pdata,
328 sizeof(*pdata), omap_mcspi_latency,
329 ARRAY_SIZE(omap_mcspi_latency), 0);
330 WARN(IS_ERR(od), "Cant build omap_device for %s:%s\n",
331 name, oh->name);
332 kfree(pdata);
333 return 0;
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700334}
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700335
336static void omap_init_mcspi(void)
337{
Charulatha V1a5d8192011-02-02 17:52:14 +0530338 omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init, NULL);
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700339}
340
341#else
342static inline void omap_init_mcspi(void) {}
343#endif
344
Will Deacon88341332010-04-09 13:54:43 +0100345static struct resource omap2_pmu_resource = {
346 .start = 3,
347 .end = 3,
348 .flags = IORESOURCE_IRQ,
349};
350
351static struct resource omap3_pmu_resource = {
352 .start = INT_34XX_BENCH_MPU_EMUL,
353 .end = INT_34XX_BENCH_MPU_EMUL,
354 .flags = IORESOURCE_IRQ,
355};
356
357static struct platform_device omap_pmu_device = {
358 .name = "arm-pmu",
359 .id = ARM_PMU_DEVICE_CPU,
360 .num_resources = 1,
361};
362
363static void omap_init_pmu(void)
364{
365 if (cpu_is_omap24xx())
366 omap_pmu_device.resource = &omap2_pmu_resource;
367 else if (cpu_is_omap34xx())
368 omap_pmu_device.resource = &omap3_pmu_resource;
369 else
370 return;
371
372 platform_device_register(&omap_pmu_device);
373}
374
375
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800376#if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE)
377
Dmitry Kasatkinedc774e2010-05-14 14:45:08 +1000378#ifdef CONFIG_ARCH_OMAP2
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800379static struct resource omap2_sham_resources[] = {
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300380 {
381 .start = OMAP24XX_SEC_SHA1MD5_BASE,
382 .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64,
383 .flags = IORESOURCE_MEM,
384 },
385 {
386 .start = INT_24XX_SHA1MD5,
387 .flags = IORESOURCE_IRQ,
388 }
389};
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800390static int omap2_sham_resources_sz = ARRAY_SIZE(omap2_sham_resources);
391#else
392#define omap2_sham_resources NULL
393#define omap2_sham_resources_sz 0
394#endif
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300395
Dmitry Kasatkinedc774e2010-05-14 14:45:08 +1000396#ifdef CONFIG_ARCH_OMAP3
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800397static struct resource omap3_sham_resources[] = {
398 {
399 .start = OMAP34XX_SEC_SHA1MD5_BASE,
400 .end = OMAP34XX_SEC_SHA1MD5_BASE + 0x64,
401 .flags = IORESOURCE_MEM,
402 },
403 {
404 .start = INT_34XX_SHA1MD52_IRQ,
405 .flags = IORESOURCE_IRQ,
406 },
407 {
408 .start = OMAP34XX_DMA_SHA1MD5_RX,
409 .flags = IORESOURCE_DMA,
410 }
411};
412static int omap3_sham_resources_sz = ARRAY_SIZE(omap3_sham_resources);
413#else
414#define omap3_sham_resources NULL
415#define omap3_sham_resources_sz 0
416#endif
417
418static struct platform_device sham_device = {
419 .name = "omap-sham",
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300420 .id = -1,
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300421};
422
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800423static void omap_init_sham(void)
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300424{
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800425 if (cpu_is_omap24xx()) {
426 sham_device.resource = omap2_sham_resources;
427 sham_device.num_resources = omap2_sham_resources_sz;
428 } else if (cpu_is_omap34xx()) {
429 sham_device.resource = omap3_sham_resources;
430 sham_device.num_resources = omap3_sham_resources_sz;
431 } else {
432 pr_err("%s: platform not supported\n", __func__);
433 return;
434 }
435 platform_device_register(&sham_device);
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300436}
437#else
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800438static inline void omap_init_sham(void) { }
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300439#endif
440
Dmitry Kasatkinb744c672010-09-03 19:13:55 +0800441#if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE)
442
Dmitry Kasatkin82a0c142010-08-20 13:44:46 +0000443#ifdef CONFIG_ARCH_OMAP2
Dmitry Kasatkinb744c672010-09-03 19:13:55 +0800444static struct resource omap2_aes_resources[] = {
445 {
446 .start = OMAP24XX_SEC_AES_BASE,
447 .end = OMAP24XX_SEC_AES_BASE + 0x4C,
448 .flags = IORESOURCE_MEM,
449 },
450 {
451 .start = OMAP24XX_DMA_AES_TX,
452 .flags = IORESOURCE_DMA,
453 },
454 {
455 .start = OMAP24XX_DMA_AES_RX,
456 .flags = IORESOURCE_DMA,
457 }
458};
459static int omap2_aes_resources_sz = ARRAY_SIZE(omap2_aes_resources);
460#else
461#define omap2_aes_resources NULL
462#define omap2_aes_resources_sz 0
463#endif
464
Dmitry Kasatkin82a0c142010-08-20 13:44:46 +0000465#ifdef CONFIG_ARCH_OMAP3
Dmitry Kasatkinb744c672010-09-03 19:13:55 +0800466static struct resource omap3_aes_resources[] = {
467 {
468 .start = OMAP34XX_SEC_AES_BASE,
469 .end = OMAP34XX_SEC_AES_BASE + 0x4C,
470 .flags = IORESOURCE_MEM,
471 },
472 {
473 .start = OMAP34XX_DMA_AES2_TX,
474 .flags = IORESOURCE_DMA,
475 },
476 {
477 .start = OMAP34XX_DMA_AES2_RX,
478 .flags = IORESOURCE_DMA,
479 }
480};
481static int omap3_aes_resources_sz = ARRAY_SIZE(omap3_aes_resources);
482#else
483#define omap3_aes_resources NULL
484#define omap3_aes_resources_sz 0
485#endif
486
487static struct platform_device aes_device = {
488 .name = "omap-aes",
489 .id = -1,
490};
491
492static void omap_init_aes(void)
493{
494 if (cpu_is_omap24xx()) {
495 aes_device.resource = omap2_aes_resources;
496 aes_device.num_resources = omap2_aes_resources_sz;
497 } else if (cpu_is_omap34xx()) {
498 aes_device.resource = omap3_aes_resources;
499 aes_device.num_resources = omap3_aes_resources_sz;
500 } else {
501 pr_err("%s: platform not supported\n", __func__);
502 return;
503 }
504 platform_device_register(&aes_device);
505}
506
507#else
508static inline void omap_init_aes(void) { }
509#endif
510
Tony Lindgrend8874662008-12-10 17:37:16 -0800511/*-------------------------------------------------------------------------*/
512
Anand Gadiyare08016d2011-03-01 13:12:55 -0800513#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
Kevin Hilman917fa282008-12-10 17:37:17 -0800514
Anand Gadiyare08016d2011-03-01 13:12:55 -0800515static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
516 *mmc_controller)
Tony Lindgrend8874662008-12-10 17:37:16 -0800517{
stanley.miaoed8303fc2010-05-13 12:39:30 +0000518 if ((mmc_controller->slots[0].switch_pin > 0) && \
519 (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
520 omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
521 OMAP_PIN_INPUT_PULLUP);
522 if ((mmc_controller->slots[0].gpio_wp > 0) && \
523 (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
524 omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
525 OMAP_PIN_INPUT_PULLUP);
526
Anand Gadiyare08016d2011-03-01 13:12:55 -0800527 omap_mux_init_signal("sdmmc_cmd", 0);
528 omap_mux_init_signal("sdmmc_clki", 0);
529 omap_mux_init_signal("sdmmc_clko", 0);
530 omap_mux_init_signal("sdmmc_dat0", 0);
531 omap_mux_init_signal("sdmmc_dat_dir0", 0);
532 omap_mux_init_signal("sdmmc_cmd_dir", 0);
533 if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) {
534 omap_mux_init_signal("sdmmc_dat1", 0);
535 omap_mux_init_signal("sdmmc_dat2", 0);
536 omap_mux_init_signal("sdmmc_dat3", 0);
537 omap_mux_init_signal("sdmmc_dat_dir1", 0);
538 omap_mux_init_signal("sdmmc_dat_dir2", 0);
539 omap_mux_init_signal("sdmmc_dat_dir3", 0);
Tony Lindgrend8874662008-12-10 17:37:16 -0800540 }
Vikram Pandita57b9daa2009-08-28 11:24:11 -0700541
Anand Gadiyare08016d2011-03-01 13:12:55 -0800542 /*
543 * Use internal loop-back in MMC/SDIO Module Input Clock
544 * selection
545 */
546 if (mmc_controller->slots[0].internal_clock) {
547 u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
548 v |= (1 << 24);
549 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
Vikram Pandita57b9daa2009-08-28 11:24:11 -0700550 }
Tony Lindgrend8874662008-12-10 17:37:16 -0800551}
552
Anand Gadiyare08016d2011-03-01 13:12:55 -0800553void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
Tony Lindgrend8874662008-12-10 17:37:16 -0800554{
Anand Gadiyare08016d2011-03-01 13:12:55 -0800555 char *name = "mmci-omap";
Tony Lindgrend8874662008-12-10 17:37:16 -0800556
Anand Gadiyare08016d2011-03-01 13:12:55 -0800557 if (!mmc_data[0]) {
558 pr_err("%s fails: Incomplete platform data\n", __func__);
559 return;
560 }
Tony Lindgrend8874662008-12-10 17:37:16 -0800561
Anand Gadiyare08016d2011-03-01 13:12:55 -0800562 omap242x_mmc_mux(mmc_data[0]);
563 omap_mmc_add(name, 0, OMAP2_MMC1_BASE, OMAP2420_MMC_SIZE,
564 INT_24XX_MMC_IRQ, mmc_data[0]);
Tony Lindgrend8874662008-12-10 17:37:16 -0800565}
566
567#endif
568
569/*-------------------------------------------------------------------------*/
570
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300571#if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
Tony Lindgren59b479e2011-01-27 16:39:40 -0800572#if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430)
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300573#define OMAP_HDQ_BASE 0x480B2000
574#endif
575static struct resource omap_hdq_resources[] = {
576 {
577 .start = OMAP_HDQ_BASE,
578 .end = OMAP_HDQ_BASE + 0x1C,
579 .flags = IORESOURCE_MEM,
580 },
581 {
582 .start = INT_24XX_HDQ_IRQ,
583 .flags = IORESOURCE_IRQ,
584 },
585};
586static struct platform_device omap_hdq_dev = {
587 .name = "omap_hdq",
588 .id = 0,
589 .dev = {
590 .platform_data = NULL,
591 },
592 .num_resources = ARRAY_SIZE(omap_hdq_resources),
593 .resource = omap_hdq_resources,
594};
595static inline void omap_hdq_init(void)
596{
597 (void) platform_device_register(&omap_hdq_dev);
598}
599#else
600static inline void omap_hdq_init(void) {}
601#endif
602
Vaibhav Hiremathb2273582010-05-10 14:29:14 -0700603/*---------------------------------------------------------------------------*/
604
605#if defined(CONFIG_VIDEO_OMAP2_VOUT) || \
606 defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE)
607#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
608static struct resource omap_vout_resource[3 - CONFIG_FB_OMAP2_NUM_FBS] = {
609};
610#else
611static struct resource omap_vout_resource[2] = {
612};
613#endif
614
615static struct platform_device omap_vout_device = {
616 .name = "omap_vout",
617 .num_resources = ARRAY_SIZE(omap_vout_resource),
618 .resource = &omap_vout_resource[0],
619 .id = -1,
620};
621static void omap_init_vout(void)
622{
623 if (platform_device_register(&omap_vout_device) < 0)
624 printk(KERN_ERR "Unable to register OMAP-VOUT device\n");
625}
626#else
627static inline void omap_init_vout(void) {}
628#endif
629
Tony Lindgren1dbae812005-11-10 14:26:51 +0000630/*-------------------------------------------------------------------------*/
631
632static int __init omap2_init_devices(void)
633{
Paul Walmsley81fbc5ef2010-12-21 19:56:17 -0700634 /*
635 * please keep these calls, and their implementations above,
Tony Lindgren1dbae812005-11-10 14:26:51 +0000636 * in alphabetical order so they're easier to sort through.
637 */
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000638 omap_init_audio();
Tony Lindgren828c7072009-03-23 18:23:49 -0700639 omap_init_camera();
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800640 omap_init_mbox();
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700641 omap_init_mcspi();
Will Deacon88341332010-04-09 13:54:43 +0100642 omap_init_pmu();
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300643 omap_hdq_init();
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100644 omap_init_sti();
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800645 omap_init_sham();
Dmitry Kasatkinb744c672010-09-03 19:13:55 +0800646 omap_init_aes();
Vaibhav Hiremathb2273582010-05-10 14:29:14 -0700647 omap_init_vout();
Tony Lindgren1dbae812005-11-10 14:26:51 +0000648
649 return 0;
650}
651arch_initcall(omap2_init_devices);
Varadarajan, Charulathaf2ce6232010-09-23 20:02:42 +0530652
653#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
Nishanth Menona9b365b2011-01-06 19:49:29 -0800654static struct omap_device_pm_latency omap_wdt_latency[] = {
Varadarajan, Charulathaf2ce6232010-09-23 20:02:42 +0530655 [0] = {
656 .deactivate_func = omap_device_idle_hwmods,
657 .activate_func = omap_device_enable_hwmods,
658 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
659 },
660};
661
662static int __init omap_init_wdt(void)
663{
664 int id = -1;
665 struct omap_device *od;
666 struct omap_hwmod *oh;
667 char *oh_name = "wd_timer2";
668 char *dev_name = "omap_wdt";
669
670 if (!cpu_class_is_omap2())
671 return 0;
672
673 oh = omap_hwmod_lookup(oh_name);
674 if (!oh) {
675 pr_err("Could not look up wd_timer%d hwmod\n", id);
676 return -EINVAL;
677 }
678
679 od = omap_device_build(dev_name, id, oh, NULL, 0,
680 omap_wdt_latency,
681 ARRAY_SIZE(omap_wdt_latency), 0);
682 WARN(IS_ERR(od), "Cant build omap_device for %s:%s.\n",
683 dev_name, oh->name);
684 return 0;
685}
686subsys_initcall(omap_init_wdt);
687#endif