blob: 2cb720b5b12ede09dc16b7bf39e36ff127c87e68 [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
Tony Lindgren828c7072009-03-23 18:23:49 -070039#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
Tony Lindgrenc40fae92006-12-07 13:58:10 -080040
Tony Lindgren828c7072009-03-23 18:23:49 -070041static struct resource cam_resources[] = {
Tony Lindgrenc40fae92006-12-07 13:58:10 -080042 {
Tony Lindgren828c7072009-03-23 18:23:49 -070043 .start = OMAP24XX_CAMERA_BASE,
44 .end = OMAP24XX_CAMERA_BASE + 0xfff,
45 .flags = IORESOURCE_MEM,
46 },
47 {
48 .start = INT_24XX_CAM_IRQ,
49 .flags = IORESOURCE_IRQ,
50 }
51};
52
53static struct platform_device omap_cam_device = {
54 .name = "omap24xxcam",
55 .id = -1,
56 .num_resources = ARRAY_SIZE(cam_resources),
57 .resource = cam_resources,
58};
59
60static inline void omap_init_camera(void)
61{
62 platform_device_register(&omap_cam_device);
63}
64
65#elif defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
66
67static struct resource omap3isp_resources[] = {
68 {
69 .start = OMAP3430_ISP_BASE,
70 .end = OMAP3430_ISP_END,
71 .flags = IORESOURCE_MEM,
72 },
73 {
74 .start = OMAP3430_ISP_CBUFF_BASE,
75 .end = OMAP3430_ISP_CBUFF_END,
76 .flags = IORESOURCE_MEM,
77 },
78 {
79 .start = OMAP3430_ISP_CCP2_BASE,
80 .end = OMAP3430_ISP_CCP2_END,
81 .flags = IORESOURCE_MEM,
82 },
83 {
84 .start = OMAP3430_ISP_CCDC_BASE,
85 .end = OMAP3430_ISP_CCDC_END,
86 .flags = IORESOURCE_MEM,
87 },
88 {
89 .start = OMAP3430_ISP_HIST_BASE,
90 .end = OMAP3430_ISP_HIST_END,
91 .flags = IORESOURCE_MEM,
92 },
93 {
94 .start = OMAP3430_ISP_H3A_BASE,
95 .end = OMAP3430_ISP_H3A_END,
96 .flags = IORESOURCE_MEM,
97 },
98 {
99 .start = OMAP3430_ISP_PREV_BASE,
100 .end = OMAP3430_ISP_PREV_END,
101 .flags = IORESOURCE_MEM,
102 },
103 {
104 .start = OMAP3430_ISP_RESZ_BASE,
105 .end = OMAP3430_ISP_RESZ_END,
106 .flags = IORESOURCE_MEM,
107 },
108 {
109 .start = OMAP3430_ISP_SBL_BASE,
110 .end = OMAP3430_ISP_SBL_END,
111 .flags = IORESOURCE_MEM,
112 },
113 {
114 .start = OMAP3430_ISP_CSI2A_BASE,
115 .end = OMAP3430_ISP_CSI2A_END,
116 .flags = IORESOURCE_MEM,
117 },
118 {
119 .start = OMAP3430_ISP_CSI2PHY_BASE,
120 .end = OMAP3430_ISP_CSI2PHY_END,
121 .flags = IORESOURCE_MEM,
122 },
123 {
124 .start = INT_34XX_CAM_IRQ,
125 .flags = IORESOURCE_IRQ,
126 }
127};
128
129static struct platform_device omap3isp_device = {
130 .name = "omap3isp",
131 .id = -1,
132 .num_resources = ARRAY_SIZE(omap3isp_resources),
133 .resource = omap3isp_resources,
134};
135
136static inline void omap_init_camera(void)
137{
138 platform_device_register(&omap3isp_device);
139}
140#else
141static inline void omap_init_camera(void)
142{
143}
144#endif
145
Syed Rafiuddin59556762010-12-27 05:51:45 +0000146struct omap_device_pm_latency omap_keyboard_latency[] = {
147 {
148 .deactivate_func = omap_device_idle_hwmods,
149 .activate_func = omap_device_enable_hwmods,
150 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
151 },
152};
153
154int __init omap4_keyboard_init(struct omap4_keypad_platform_data
155 *sdp4430_keypad_data)
156{
157 struct omap_device *od;
158 struct omap_hwmod *oh;
159 struct omap4_keypad_platform_data *keypad_data;
160 unsigned int id = -1;
161 char *oh_name = "kbd";
162 char *name = "omap4-keypad";
163
164 oh = omap_hwmod_lookup(oh_name);
165 if (!oh) {
166 pr_err("Could not look up %s\n", oh_name);
167 return -ENODEV;
168 }
169
170 keypad_data = sdp4430_keypad_data;
171
172 od = omap_device_build(name, id, oh, keypad_data,
173 sizeof(struct omap4_keypad_platform_data),
174 omap_keyboard_latency,
175 ARRAY_SIZE(omap_keyboard_latency), 0);
176
177 if (IS_ERR(od)) {
178 WARN(1, "Cant build omap_device for %s:%s.\n",
179 name, oh->name);
180 return PTR_ERR(od);
181 }
182
183 return 0;
184}
185
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700186#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
Felipe Contreras69dbf852011-02-24 12:51:33 -0800187static struct omap_device_pm_latency mbox_latencies[] = {
188 [0] = {
189 .activate_func = omap_device_enable_hwmods,
190 .deactivate_func = omap_device_idle_hwmods,
191 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
Tony Lindgrenc40fae92006-12-07 13:58:10 -0800192 },
Tony Lindgrenc40fae92006-12-07 13:58:10 -0800193};
194
195static inline void omap_init_mbox(void)
196{
Felipe Contreras69dbf852011-02-24 12:51:33 -0800197 struct omap_hwmod *oh;
198 struct omap_device *od;
199
200 oh = omap_hwmod_lookup("mailbox");
201 if (!oh) {
202 pr_err("%s: unable to find hwmod\n", __func__);
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700203 return;
204 }
Felipe Contreras69dbf852011-02-24 12:51:33 -0800205
206 od = omap_device_build("omap-mailbox", -1, oh, NULL, 0,
207 mbox_latencies, ARRAY_SIZE(mbox_latencies), 0);
208 WARN(IS_ERR(od), "%s: could not build device, err %ld\n",
209 __func__, PTR_ERR(od));
Tony Lindgrenc40fae92006-12-07 13:58:10 -0800210}
211#else
212static inline void omap_init_mbox(void) { }
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700213#endif /* CONFIG_OMAP_MBOX_FWK */
Tony Lindgrenc40fae92006-12-07 13:58:10 -0800214
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100215static inline void omap_init_sti(void) {}
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100216
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000217#if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
218
219static struct platform_device omap_pcm = {
220 .name = "omap-pcm-audio",
221 .id = -1,
222};
223
224/*
225 * OMAP2420 has 2 McBSP ports
226 * OMAP2430 has 5 McBSP ports
227 * OMAP3 has 5 McBSP ports
228 * OMAP4 has 4 McBSP ports
229 */
230OMAP_MCBSP_PLATFORM_DEVICE(1);
231OMAP_MCBSP_PLATFORM_DEVICE(2);
232OMAP_MCBSP_PLATFORM_DEVICE(3);
233OMAP_MCBSP_PLATFORM_DEVICE(4);
234OMAP_MCBSP_PLATFORM_DEVICE(5);
235
236static void omap_init_audio(void)
237{
238 platform_device_register(&omap_mcbsp1);
239 platform_device_register(&omap_mcbsp2);
240 if (cpu_is_omap243x() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
241 platform_device_register(&omap_mcbsp3);
242 platform_device_register(&omap_mcbsp4);
243 }
244 if (cpu_is_omap243x() || cpu_is_omap34xx())
245 platform_device_register(&omap_mcbsp5);
246
247 platform_device_register(&omap_pcm);
248}
249
250#else
251static inline void omap_init_audio(void) {}
252#endif
253
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300254#if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700255
Tony Lindgrence491cf2009-10-20 09:40:47 -0700256#include <plat/mcspi.h>
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700257
Charulatha V1a5d8192011-02-02 17:52:14 +0530258struct omap_device_pm_latency omap_mcspi_latency[] = {
259 [0] = {
260 .deactivate_func = omap_device_idle_hwmods,
261 .activate_func = omap_device_enable_hwmods,
262 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
Tony Lindgrenc40fae92006-12-07 13:58:10 -0800263 },
264};
265
Charulatha V1a5d8192011-02-02 17:52:14 +0530266static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700267{
Charulatha V1a5d8192011-02-02 17:52:14 +0530268 struct omap_device *od;
269 char *name = "omap2_mcspi";
270 struct omap2_mcspi_platform_config *pdata;
271 static int spi_num;
272 struct omap2_mcspi_dev_attr *mcspi_attrib = oh->dev_attr;
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700273
Charulatha V1a5d8192011-02-02 17:52:14 +0530274 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
275 if (!pdata) {
276 pr_err("Memory allocation for McSPI device failed\n");
277 return -ENOMEM;
278 }
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700279
Charulatha V1a5d8192011-02-02 17:52:14 +0530280 pdata->num_cs = mcspi_attrib->num_chipselect;
281 switch (oh->class->rev) {
282 case OMAP2_MCSPI_REV:
283 case OMAP3_MCSPI_REV:
284 pdata->regs_offset = 0;
285 break;
286 case OMAP4_MCSPI_REV:
287 pdata->regs_offset = OMAP4_MCSPI_REG_OFFSET;
288 break;
289 default:
290 pr_err("Invalid McSPI Revision value\n");
291 return -EINVAL;
292 }
293
294 spi_num++;
295 od = omap_device_build(name, spi_num, oh, pdata,
296 sizeof(*pdata), omap_mcspi_latency,
297 ARRAY_SIZE(omap_mcspi_latency), 0);
298 WARN(IS_ERR(od), "Cant build omap_device for %s:%s\n",
299 name, oh->name);
300 kfree(pdata);
301 return 0;
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700302}
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700303
304static void omap_init_mcspi(void)
305{
Charulatha V1a5d8192011-02-02 17:52:14 +0530306 omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init, NULL);
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700307}
308
309#else
310static inline void omap_init_mcspi(void) {}
311#endif
312
Will Deacon88341332010-04-09 13:54:43 +0100313static struct resource omap2_pmu_resource = {
314 .start = 3,
315 .end = 3,
316 .flags = IORESOURCE_IRQ,
317};
318
319static struct resource omap3_pmu_resource = {
320 .start = INT_34XX_BENCH_MPU_EMUL,
321 .end = INT_34XX_BENCH_MPU_EMUL,
322 .flags = IORESOURCE_IRQ,
323};
324
325static struct platform_device omap_pmu_device = {
326 .name = "arm-pmu",
327 .id = ARM_PMU_DEVICE_CPU,
328 .num_resources = 1,
329};
330
331static void omap_init_pmu(void)
332{
333 if (cpu_is_omap24xx())
334 omap_pmu_device.resource = &omap2_pmu_resource;
335 else if (cpu_is_omap34xx())
336 omap_pmu_device.resource = &omap3_pmu_resource;
337 else
338 return;
339
340 platform_device_register(&omap_pmu_device);
341}
342
343
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800344#if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE)
345
Dmitry Kasatkinedc774e2010-05-14 14:45:08 +1000346#ifdef CONFIG_ARCH_OMAP2
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800347static struct resource omap2_sham_resources[] = {
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300348 {
349 .start = OMAP24XX_SEC_SHA1MD5_BASE,
350 .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64,
351 .flags = IORESOURCE_MEM,
352 },
353 {
354 .start = INT_24XX_SHA1MD5,
355 .flags = IORESOURCE_IRQ,
356 }
357};
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800358static int omap2_sham_resources_sz = ARRAY_SIZE(omap2_sham_resources);
359#else
360#define omap2_sham_resources NULL
361#define omap2_sham_resources_sz 0
362#endif
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300363
Dmitry Kasatkinedc774e2010-05-14 14:45:08 +1000364#ifdef CONFIG_ARCH_OMAP3
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800365static struct resource omap3_sham_resources[] = {
366 {
367 .start = OMAP34XX_SEC_SHA1MD5_BASE,
368 .end = OMAP34XX_SEC_SHA1MD5_BASE + 0x64,
369 .flags = IORESOURCE_MEM,
370 },
371 {
372 .start = INT_34XX_SHA1MD52_IRQ,
373 .flags = IORESOURCE_IRQ,
374 },
375 {
376 .start = OMAP34XX_DMA_SHA1MD5_RX,
377 .flags = IORESOURCE_DMA,
378 }
379};
380static int omap3_sham_resources_sz = ARRAY_SIZE(omap3_sham_resources);
381#else
382#define omap3_sham_resources NULL
383#define omap3_sham_resources_sz 0
384#endif
385
386static struct platform_device sham_device = {
387 .name = "omap-sham",
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300388 .id = -1,
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300389};
390
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800391static void omap_init_sham(void)
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300392{
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800393 if (cpu_is_omap24xx()) {
394 sham_device.resource = omap2_sham_resources;
395 sham_device.num_resources = omap2_sham_resources_sz;
396 } else if (cpu_is_omap34xx()) {
397 sham_device.resource = omap3_sham_resources;
398 sham_device.num_resources = omap3_sham_resources_sz;
399 } else {
400 pr_err("%s: platform not supported\n", __func__);
401 return;
402 }
403 platform_device_register(&sham_device);
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300404}
405#else
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800406static inline void omap_init_sham(void) { }
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300407#endif
408
Dmitry Kasatkinb744c672010-09-03 19:13:55 +0800409#if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE)
410
Dmitry Kasatkin82a0c142010-08-20 13:44:46 +0000411#ifdef CONFIG_ARCH_OMAP2
Dmitry Kasatkinb744c672010-09-03 19:13:55 +0800412static struct resource omap2_aes_resources[] = {
413 {
414 .start = OMAP24XX_SEC_AES_BASE,
415 .end = OMAP24XX_SEC_AES_BASE + 0x4C,
416 .flags = IORESOURCE_MEM,
417 },
418 {
419 .start = OMAP24XX_DMA_AES_TX,
420 .flags = IORESOURCE_DMA,
421 },
422 {
423 .start = OMAP24XX_DMA_AES_RX,
424 .flags = IORESOURCE_DMA,
425 }
426};
427static int omap2_aes_resources_sz = ARRAY_SIZE(omap2_aes_resources);
428#else
429#define omap2_aes_resources NULL
430#define omap2_aes_resources_sz 0
431#endif
432
Dmitry Kasatkin82a0c142010-08-20 13:44:46 +0000433#ifdef CONFIG_ARCH_OMAP3
Dmitry Kasatkinb744c672010-09-03 19:13:55 +0800434static struct resource omap3_aes_resources[] = {
435 {
436 .start = OMAP34XX_SEC_AES_BASE,
437 .end = OMAP34XX_SEC_AES_BASE + 0x4C,
438 .flags = IORESOURCE_MEM,
439 },
440 {
441 .start = OMAP34XX_DMA_AES2_TX,
442 .flags = IORESOURCE_DMA,
443 },
444 {
445 .start = OMAP34XX_DMA_AES2_RX,
446 .flags = IORESOURCE_DMA,
447 }
448};
449static int omap3_aes_resources_sz = ARRAY_SIZE(omap3_aes_resources);
450#else
451#define omap3_aes_resources NULL
452#define omap3_aes_resources_sz 0
453#endif
454
455static struct platform_device aes_device = {
456 .name = "omap-aes",
457 .id = -1,
458};
459
460static void omap_init_aes(void)
461{
462 if (cpu_is_omap24xx()) {
463 aes_device.resource = omap2_aes_resources;
464 aes_device.num_resources = omap2_aes_resources_sz;
465 } else if (cpu_is_omap34xx()) {
466 aes_device.resource = omap3_aes_resources;
467 aes_device.num_resources = omap3_aes_resources_sz;
468 } else {
469 pr_err("%s: platform not supported\n", __func__);
470 return;
471 }
472 platform_device_register(&aes_device);
473}
474
475#else
476static inline void omap_init_aes(void) { }
477#endif
478
Tony Lindgrend8874662008-12-10 17:37:16 -0800479/*-------------------------------------------------------------------------*/
480
Anand Gadiyare08016d2011-03-01 13:12:55 -0800481#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
Kevin Hilman917fa282008-12-10 17:37:17 -0800482
Anand Gadiyare08016d2011-03-01 13:12:55 -0800483static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
484 *mmc_controller)
Tony Lindgrend8874662008-12-10 17:37:16 -0800485{
stanley.miaoed8303fc2010-05-13 12:39:30 +0000486 if ((mmc_controller->slots[0].switch_pin > 0) && \
487 (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
488 omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
489 OMAP_PIN_INPUT_PULLUP);
490 if ((mmc_controller->slots[0].gpio_wp > 0) && \
491 (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
492 omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
493 OMAP_PIN_INPUT_PULLUP);
494
Anand Gadiyare08016d2011-03-01 13:12:55 -0800495 omap_mux_init_signal("sdmmc_cmd", 0);
496 omap_mux_init_signal("sdmmc_clki", 0);
497 omap_mux_init_signal("sdmmc_clko", 0);
498 omap_mux_init_signal("sdmmc_dat0", 0);
499 omap_mux_init_signal("sdmmc_dat_dir0", 0);
500 omap_mux_init_signal("sdmmc_cmd_dir", 0);
501 if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) {
502 omap_mux_init_signal("sdmmc_dat1", 0);
503 omap_mux_init_signal("sdmmc_dat2", 0);
504 omap_mux_init_signal("sdmmc_dat3", 0);
505 omap_mux_init_signal("sdmmc_dat_dir1", 0);
506 omap_mux_init_signal("sdmmc_dat_dir2", 0);
507 omap_mux_init_signal("sdmmc_dat_dir3", 0);
Tony Lindgrend8874662008-12-10 17:37:16 -0800508 }
Vikram Pandita57b9daa2009-08-28 11:24:11 -0700509
Anand Gadiyare08016d2011-03-01 13:12:55 -0800510 /*
511 * Use internal loop-back in MMC/SDIO Module Input Clock
512 * selection
513 */
514 if (mmc_controller->slots[0].internal_clock) {
515 u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
516 v |= (1 << 24);
517 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
Vikram Pandita57b9daa2009-08-28 11:24:11 -0700518 }
Tony Lindgrend8874662008-12-10 17:37:16 -0800519}
520
Anand Gadiyare08016d2011-03-01 13:12:55 -0800521void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
Tony Lindgrend8874662008-12-10 17:37:16 -0800522{
Anand Gadiyare08016d2011-03-01 13:12:55 -0800523 char *name = "mmci-omap";
Tony Lindgrend8874662008-12-10 17:37:16 -0800524
Anand Gadiyare08016d2011-03-01 13:12:55 -0800525 if (!mmc_data[0]) {
526 pr_err("%s fails: Incomplete platform data\n", __func__);
527 return;
528 }
Tony Lindgrend8874662008-12-10 17:37:16 -0800529
Anand Gadiyare08016d2011-03-01 13:12:55 -0800530 omap242x_mmc_mux(mmc_data[0]);
531 omap_mmc_add(name, 0, OMAP2_MMC1_BASE, OMAP2420_MMC_SIZE,
532 INT_24XX_MMC_IRQ, mmc_data[0]);
Tony Lindgrend8874662008-12-10 17:37:16 -0800533}
534
535#endif
536
537/*-------------------------------------------------------------------------*/
538
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300539#if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
Tony Lindgren59b479e2011-01-27 16:39:40 -0800540#if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430)
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300541#define OMAP_HDQ_BASE 0x480B2000
542#endif
543static struct resource omap_hdq_resources[] = {
544 {
545 .start = OMAP_HDQ_BASE,
546 .end = OMAP_HDQ_BASE + 0x1C,
547 .flags = IORESOURCE_MEM,
548 },
549 {
550 .start = INT_24XX_HDQ_IRQ,
551 .flags = IORESOURCE_IRQ,
552 },
553};
554static struct platform_device omap_hdq_dev = {
555 .name = "omap_hdq",
556 .id = 0,
557 .dev = {
558 .platform_data = NULL,
559 },
560 .num_resources = ARRAY_SIZE(omap_hdq_resources),
561 .resource = omap_hdq_resources,
562};
563static inline void omap_hdq_init(void)
564{
565 (void) platform_device_register(&omap_hdq_dev);
566}
567#else
568static inline void omap_hdq_init(void) {}
569#endif
570
Vaibhav Hiremathb2273582010-05-10 14:29:14 -0700571/*---------------------------------------------------------------------------*/
572
573#if defined(CONFIG_VIDEO_OMAP2_VOUT) || \
574 defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE)
575#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
576static struct resource omap_vout_resource[3 - CONFIG_FB_OMAP2_NUM_FBS] = {
577};
578#else
579static struct resource omap_vout_resource[2] = {
580};
581#endif
582
583static struct platform_device omap_vout_device = {
584 .name = "omap_vout",
585 .num_resources = ARRAY_SIZE(omap_vout_resource),
586 .resource = &omap_vout_resource[0],
587 .id = -1,
588};
589static void omap_init_vout(void)
590{
591 if (platform_device_register(&omap_vout_device) < 0)
592 printk(KERN_ERR "Unable to register OMAP-VOUT device\n");
593}
594#else
595static inline void omap_init_vout(void) {}
596#endif
597
Tony Lindgren1dbae812005-11-10 14:26:51 +0000598/*-------------------------------------------------------------------------*/
599
600static int __init omap2_init_devices(void)
601{
Paul Walmsley81fbc5ef2010-12-21 19:56:17 -0700602 /*
603 * please keep these calls, and their implementations above,
Tony Lindgren1dbae812005-11-10 14:26:51 +0000604 * in alphabetical order so they're easier to sort through.
605 */
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000606 omap_init_audio();
Tony Lindgren828c7072009-03-23 18:23:49 -0700607 omap_init_camera();
Tony Lindgrenc40fae92006-12-07 13:58:10 -0800608 omap_init_mbox();
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700609 omap_init_mcspi();
Will Deacon88341332010-04-09 13:54:43 +0100610 omap_init_pmu();
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300611 omap_hdq_init();
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100612 omap_init_sti();
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800613 omap_init_sham();
Dmitry Kasatkinb744c672010-09-03 19:13:55 +0800614 omap_init_aes();
Vaibhav Hiremathb2273582010-05-10 14:29:14 -0700615 omap_init_vout();
Tony Lindgren1dbae812005-11-10 14:26:51 +0000616
617 return 0;
618}
619arch_initcall(omap2_init_devices);
Varadarajan, Charulathaf2ce6232010-09-23 20:02:42 +0530620
621#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
Nishanth Menona9b365b2011-01-06 19:49:29 -0800622static struct omap_device_pm_latency omap_wdt_latency[] = {
Varadarajan, Charulathaf2ce6232010-09-23 20:02:42 +0530623 [0] = {
624 .deactivate_func = omap_device_idle_hwmods,
625 .activate_func = omap_device_enable_hwmods,
626 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
627 },
628};
629
630static int __init omap_init_wdt(void)
631{
632 int id = -1;
633 struct omap_device *od;
634 struct omap_hwmod *oh;
635 char *oh_name = "wd_timer2";
636 char *dev_name = "omap_wdt";
637
638 if (!cpu_class_is_omap2())
639 return 0;
640
641 oh = omap_hwmod_lookup(oh_name);
642 if (!oh) {
643 pr_err("Could not look up wd_timer%d hwmod\n", id);
644 return -EINVAL;
645 }
646
647 od = omap_device_build(dev_name, id, oh, NULL, 0,
648 omap_wdt_latency,
649 ARRAY_SIZE(omap_wdt_latency), 0);
650 WARN(IS_ERR(od), "Cant build omap_device for %s:%s.\n",
651 dev_name, oh->name);
652 return 0;
653}
654subsys_initcall(omap_init_wdt);
655#endif