OMAP: adapt hsmmc to hwmod framework
[linux-2.6.git] / arch / arm / mach-omap2 / devices.c
1 /*
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
12 #include <linux/kernel.h>
13 #include <linux/init.h>
14 #include <linux/platform_device.h>
15 #include <linux/io.h>
16 #include <linux/clk.h>
17 #include <linux/err.h>
18 #include <linux/slab.h>
19
20 #include <mach/hardware.h>
21 #include <mach/irqs.h>
22 #include <asm/mach-types.h>
23 #include <asm/mach/map.h>
24 #include <asm/pmu.h>
25
26 #include <plat/tc.h>
27 #include <plat/board.h>
28 #include <plat/mcbsp.h>
29 #include <mach/gpio.h>
30 #include <plat/mmc.h>
31 #include <plat/dma.h>
32 #include <plat/omap_hwmod.h>
33 #include <plat/omap_device.h>
34 #include <plat/omap4-keypad.h>
35
36 #include "mux.h"
37 #include "control.h"
38
39 #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
40
41 static struct resource cam_resources[] = {
42         {
43                 .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
53 static 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
60 static 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
67 static 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
129 static struct platform_device omap3isp_device = {
130         .name           = "omap3isp",
131         .id             = -1,
132         .num_resources  = ARRAY_SIZE(omap3isp_resources),
133         .resource       = omap3isp_resources,
134 };
135
136 static inline void omap_init_camera(void)
137 {
138         platform_device_register(&omap3isp_device);
139 }
140 #else
141 static inline void omap_init_camera(void)
142 {
143 }
144 #endif
145
146 struct 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
154 int __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
186 #if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
187
188 #define MBOX_REG_SIZE   0x120
189
190 #ifdef CONFIG_ARCH_OMAP2
191 static struct resource omap2_mbox_resources[] = {
192         {
193                 .start          = OMAP24XX_MAILBOX_BASE,
194                 .end            = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
195                 .flags          = IORESOURCE_MEM,
196         },
197         {
198                 .start          = INT_24XX_MAIL_U0_MPU,
199                 .flags          = IORESOURCE_IRQ,
200                 .name           = "dsp",
201         },
202         {
203                 .start          = INT_24XX_MAIL_U3_MPU,
204                 .flags          = IORESOURCE_IRQ,
205                 .name           = "iva",
206         },
207 };
208 static int omap2_mbox_resources_sz = ARRAY_SIZE(omap2_mbox_resources);
209 #else
210 #define omap2_mbox_resources            NULL
211 #define omap2_mbox_resources_sz         0
212 #endif
213
214 #ifdef CONFIG_ARCH_OMAP3
215 static struct resource omap3_mbox_resources[] = {
216         {
217                 .start          = OMAP34XX_MAILBOX_BASE,
218                 .end            = OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
219                 .flags          = IORESOURCE_MEM,
220         },
221         {
222                 .start          = INT_24XX_MAIL_U0_MPU,
223                 .flags          = IORESOURCE_IRQ,
224                 .name           = "dsp",
225         },
226 };
227 static int omap3_mbox_resources_sz = ARRAY_SIZE(omap3_mbox_resources);
228 #else
229 #define omap3_mbox_resources            NULL
230 #define omap3_mbox_resources_sz         0
231 #endif
232
233 #ifdef CONFIG_ARCH_OMAP4
234
235 #define OMAP4_MBOX_REG_SIZE     0x130
236 static struct resource omap4_mbox_resources[] = {
237         {
238                 .start          = OMAP44XX_MAILBOX_BASE,
239                 .end            = OMAP44XX_MAILBOX_BASE +
240                                         OMAP4_MBOX_REG_SIZE - 1,
241                 .flags          = IORESOURCE_MEM,
242         },
243         {
244                 .start          = OMAP44XX_IRQ_MAIL_U0,
245                 .flags          = IORESOURCE_IRQ,
246                 .name           = "mbox",
247         },
248 };
249 static int omap4_mbox_resources_sz = ARRAY_SIZE(omap4_mbox_resources);
250 #else
251 #define omap4_mbox_resources            NULL
252 #define omap4_mbox_resources_sz         0
253 #endif
254
255 static struct platform_device mbox_device = {
256         .name           = "omap-mailbox",
257         .id             = -1,
258 };
259
260 static inline void omap_init_mbox(void)
261 {
262         if (cpu_is_omap24xx()) {
263                 mbox_device.resource = omap2_mbox_resources;
264                 mbox_device.num_resources = omap2_mbox_resources_sz;
265         } else if (cpu_is_omap34xx()) {
266                 mbox_device.resource = omap3_mbox_resources;
267                 mbox_device.num_resources = omap3_mbox_resources_sz;
268         } else if (cpu_is_omap44xx()) {
269                 mbox_device.resource = omap4_mbox_resources;
270                 mbox_device.num_resources = omap4_mbox_resources_sz;
271         } else {
272                 pr_err("%s: platform not supported\n", __func__);
273                 return;
274         }
275         platform_device_register(&mbox_device);
276 }
277 #else
278 static inline void omap_init_mbox(void) { }
279 #endif /* CONFIG_OMAP_MBOX_FWK */
280
281 static inline void omap_init_sti(void) {}
282
283 #if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
284
285 static struct platform_device omap_pcm = {
286         .name   = "omap-pcm-audio",
287         .id     = -1,
288 };
289
290 /*
291  * OMAP2420 has 2 McBSP ports
292  * OMAP2430 has 5 McBSP ports
293  * OMAP3 has 5 McBSP ports
294  * OMAP4 has 4 McBSP ports
295  */
296 OMAP_MCBSP_PLATFORM_DEVICE(1);
297 OMAP_MCBSP_PLATFORM_DEVICE(2);
298 OMAP_MCBSP_PLATFORM_DEVICE(3);
299 OMAP_MCBSP_PLATFORM_DEVICE(4);
300 OMAP_MCBSP_PLATFORM_DEVICE(5);
301
302 static void omap_init_audio(void)
303 {
304         platform_device_register(&omap_mcbsp1);
305         platform_device_register(&omap_mcbsp2);
306         if (cpu_is_omap243x() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
307                 platform_device_register(&omap_mcbsp3);
308                 platform_device_register(&omap_mcbsp4);
309         }
310         if (cpu_is_omap243x() || cpu_is_omap34xx())
311                 platform_device_register(&omap_mcbsp5);
312
313         platform_device_register(&omap_pcm);
314 }
315
316 #else
317 static inline void omap_init_audio(void) {}
318 #endif
319
320 #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
321
322 #include <plat/mcspi.h>
323
324 struct omap_device_pm_latency omap_mcspi_latency[] = {
325         [0] = {
326                 .deactivate_func = omap_device_idle_hwmods,
327                 .activate_func   = omap_device_enable_hwmods,
328                 .flags           = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
329         },
330 };
331
332 static int omap_mcspi_init(struct omap_hwmod *oh, void *unused)
333 {
334         struct omap_device *od;
335         char *name = "omap2_mcspi";
336         struct omap2_mcspi_platform_config *pdata;
337         static int spi_num;
338         struct omap2_mcspi_dev_attr *mcspi_attrib = oh->dev_attr;
339
340         pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
341         if (!pdata) {
342                 pr_err("Memory allocation for McSPI device failed\n");
343                 return -ENOMEM;
344         }
345
346         pdata->num_cs = mcspi_attrib->num_chipselect;
347         switch (oh->class->rev) {
348         case OMAP2_MCSPI_REV:
349         case OMAP3_MCSPI_REV:
350                         pdata->regs_offset = 0;
351                         break;
352         case OMAP4_MCSPI_REV:
353                         pdata->regs_offset = OMAP4_MCSPI_REG_OFFSET;
354                         break;
355         default:
356                         pr_err("Invalid McSPI Revision value\n");
357                         return -EINVAL;
358         }
359
360         spi_num++;
361         od = omap_device_build(name, spi_num, oh, pdata,
362                                 sizeof(*pdata), omap_mcspi_latency,
363                                 ARRAY_SIZE(omap_mcspi_latency), 0);
364         WARN(IS_ERR(od), "Cant build omap_device for %s:%s\n",
365                                 name, oh->name);
366         kfree(pdata);
367         return 0;
368 }
369
370 static void omap_init_mcspi(void)
371 {
372         omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init, NULL);
373 }
374
375 #else
376 static inline void omap_init_mcspi(void) {}
377 #endif
378
379 static struct resource omap2_pmu_resource = {
380         .start  = 3,
381         .end    = 3,
382         .flags  = IORESOURCE_IRQ,
383 };
384
385 static struct resource omap3_pmu_resource = {
386         .start  = INT_34XX_BENCH_MPU_EMUL,
387         .end    = INT_34XX_BENCH_MPU_EMUL,
388         .flags  = IORESOURCE_IRQ,
389 };
390
391 static struct platform_device omap_pmu_device = {
392         .name           = "arm-pmu",
393         .id             = ARM_PMU_DEVICE_CPU,
394         .num_resources  = 1,
395 };
396
397 static void omap_init_pmu(void)
398 {
399         if (cpu_is_omap24xx())
400                 omap_pmu_device.resource = &omap2_pmu_resource;
401         else if (cpu_is_omap34xx())
402                 omap_pmu_device.resource = &omap3_pmu_resource;
403         else
404                 return;
405
406         platform_device_register(&omap_pmu_device);
407 }
408
409
410 #if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE)
411
412 #ifdef CONFIG_ARCH_OMAP2
413 static struct resource omap2_sham_resources[] = {
414         {
415                 .start  = OMAP24XX_SEC_SHA1MD5_BASE,
416                 .end    = OMAP24XX_SEC_SHA1MD5_BASE + 0x64,
417                 .flags  = IORESOURCE_MEM,
418         },
419         {
420                 .start  = INT_24XX_SHA1MD5,
421                 .flags  = IORESOURCE_IRQ,
422         }
423 };
424 static int omap2_sham_resources_sz = ARRAY_SIZE(omap2_sham_resources);
425 #else
426 #define omap2_sham_resources            NULL
427 #define omap2_sham_resources_sz         0
428 #endif
429
430 #ifdef CONFIG_ARCH_OMAP3
431 static struct resource omap3_sham_resources[] = {
432         {
433                 .start  = OMAP34XX_SEC_SHA1MD5_BASE,
434                 .end    = OMAP34XX_SEC_SHA1MD5_BASE + 0x64,
435                 .flags  = IORESOURCE_MEM,
436         },
437         {
438                 .start  = INT_34XX_SHA1MD52_IRQ,
439                 .flags  = IORESOURCE_IRQ,
440         },
441         {
442                 .start  = OMAP34XX_DMA_SHA1MD5_RX,
443                 .flags  = IORESOURCE_DMA,
444         }
445 };
446 static int omap3_sham_resources_sz = ARRAY_SIZE(omap3_sham_resources);
447 #else
448 #define omap3_sham_resources            NULL
449 #define omap3_sham_resources_sz         0
450 #endif
451
452 static struct platform_device sham_device = {
453         .name           = "omap-sham",
454         .id             = -1,
455 };
456
457 static void omap_init_sham(void)
458 {
459         if (cpu_is_omap24xx()) {
460                 sham_device.resource = omap2_sham_resources;
461                 sham_device.num_resources = omap2_sham_resources_sz;
462         } else if (cpu_is_omap34xx()) {
463                 sham_device.resource = omap3_sham_resources;
464                 sham_device.num_resources = omap3_sham_resources_sz;
465         } else {
466                 pr_err("%s: platform not supported\n", __func__);
467                 return;
468         }
469         platform_device_register(&sham_device);
470 }
471 #else
472 static inline void omap_init_sham(void) { }
473 #endif
474
475 #if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE)
476
477 #ifdef CONFIG_ARCH_OMAP2
478 static struct resource omap2_aes_resources[] = {
479         {
480                 .start  = OMAP24XX_SEC_AES_BASE,
481                 .end    = OMAP24XX_SEC_AES_BASE + 0x4C,
482                 .flags  = IORESOURCE_MEM,
483         },
484         {
485                 .start  = OMAP24XX_DMA_AES_TX,
486                 .flags  = IORESOURCE_DMA,
487         },
488         {
489                 .start  = OMAP24XX_DMA_AES_RX,
490                 .flags  = IORESOURCE_DMA,
491         }
492 };
493 static int omap2_aes_resources_sz = ARRAY_SIZE(omap2_aes_resources);
494 #else
495 #define omap2_aes_resources             NULL
496 #define omap2_aes_resources_sz          0
497 #endif
498
499 #ifdef CONFIG_ARCH_OMAP3
500 static struct resource omap3_aes_resources[] = {
501         {
502                 .start  = OMAP34XX_SEC_AES_BASE,
503                 .end    = OMAP34XX_SEC_AES_BASE + 0x4C,
504                 .flags  = IORESOURCE_MEM,
505         },
506         {
507                 .start  = OMAP34XX_DMA_AES2_TX,
508                 .flags  = IORESOURCE_DMA,
509         },
510         {
511                 .start  = OMAP34XX_DMA_AES2_RX,
512                 .flags  = IORESOURCE_DMA,
513         }
514 };
515 static int omap3_aes_resources_sz = ARRAY_SIZE(omap3_aes_resources);
516 #else
517 #define omap3_aes_resources             NULL
518 #define omap3_aes_resources_sz          0
519 #endif
520
521 static struct platform_device aes_device = {
522         .name           = "omap-aes",
523         .id             = -1,
524 };
525
526 static void omap_init_aes(void)
527 {
528         if (cpu_is_omap24xx()) {
529                 aes_device.resource = omap2_aes_resources;
530                 aes_device.num_resources = omap2_aes_resources_sz;
531         } else if (cpu_is_omap34xx()) {
532                 aes_device.resource = omap3_aes_resources;
533                 aes_device.num_resources = omap3_aes_resources_sz;
534         } else {
535                 pr_err("%s: platform not supported\n", __func__);
536                 return;
537         }
538         platform_device_register(&aes_device);
539 }
540
541 #else
542 static inline void omap_init_aes(void) { }
543 #endif
544
545 /*-------------------------------------------------------------------------*/
546
547 #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
548
549 static inline void omap242x_mmc_mux(struct omap_mmc_platform_data
550                                                         *mmc_controller)
551 {
552         if ((mmc_controller->slots[0].switch_pin > 0) && \
553                 (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
554                 omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
555                                         OMAP_PIN_INPUT_PULLUP);
556         if ((mmc_controller->slots[0].gpio_wp > 0) && \
557                 (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
558                 omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
559                                         OMAP_PIN_INPUT_PULLUP);
560
561         omap_mux_init_signal("sdmmc_cmd", 0);
562         omap_mux_init_signal("sdmmc_clki", 0);
563         omap_mux_init_signal("sdmmc_clko", 0);
564         omap_mux_init_signal("sdmmc_dat0", 0);
565         omap_mux_init_signal("sdmmc_dat_dir0", 0);
566         omap_mux_init_signal("sdmmc_cmd_dir", 0);
567         if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) {
568                 omap_mux_init_signal("sdmmc_dat1", 0);
569                 omap_mux_init_signal("sdmmc_dat2", 0);
570                 omap_mux_init_signal("sdmmc_dat3", 0);
571                 omap_mux_init_signal("sdmmc_dat_dir1", 0);
572                 omap_mux_init_signal("sdmmc_dat_dir2", 0);
573                 omap_mux_init_signal("sdmmc_dat_dir3", 0);
574         }
575
576         /*
577          * Use internal loop-back in MMC/SDIO Module Input Clock
578          * selection
579          */
580         if (mmc_controller->slots[0].internal_clock) {
581                 u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
582                 v |= (1 << 24);
583                 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
584         }
585 }
586
587 void __init omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
588 {
589         char *name = "mmci-omap";
590
591         if (!mmc_data[0]) {
592                 pr_err("%s fails: Incomplete platform data\n", __func__);
593                 return;
594         }
595
596         omap242x_mmc_mux(mmc_data[0]);
597         omap_mmc_add(name, 0, OMAP2_MMC1_BASE, OMAP2420_MMC_SIZE,
598                                         INT_24XX_MMC_IRQ, mmc_data[0]);
599 }
600
601 #endif
602
603 /*-------------------------------------------------------------------------*/
604
605 #if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
606 #if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430)
607 #define OMAP_HDQ_BASE   0x480B2000
608 #endif
609 static struct resource omap_hdq_resources[] = {
610         {
611                 .start          = OMAP_HDQ_BASE,
612                 .end            = OMAP_HDQ_BASE + 0x1C,
613                 .flags          = IORESOURCE_MEM,
614         },
615         {
616                 .start          = INT_24XX_HDQ_IRQ,
617                 .flags          = IORESOURCE_IRQ,
618         },
619 };
620 static struct platform_device omap_hdq_dev = {
621         .name = "omap_hdq",
622         .id = 0,
623         .dev = {
624                 .platform_data = NULL,
625         },
626         .num_resources  = ARRAY_SIZE(omap_hdq_resources),
627         .resource       = omap_hdq_resources,
628 };
629 static inline void omap_hdq_init(void)
630 {
631         (void) platform_device_register(&omap_hdq_dev);
632 }
633 #else
634 static inline void omap_hdq_init(void) {}
635 #endif
636
637 /*---------------------------------------------------------------------------*/
638
639 #if defined(CONFIG_VIDEO_OMAP2_VOUT) || \
640         defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE)
641 #if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
642 static struct resource omap_vout_resource[3 - CONFIG_FB_OMAP2_NUM_FBS] = {
643 };
644 #else
645 static struct resource omap_vout_resource[2] = {
646 };
647 #endif
648
649 static struct platform_device omap_vout_device = {
650         .name           = "omap_vout",
651         .num_resources  = ARRAY_SIZE(omap_vout_resource),
652         .resource       = &omap_vout_resource[0],
653         .id             = -1,
654 };
655 static void omap_init_vout(void)
656 {
657         if (platform_device_register(&omap_vout_device) < 0)
658                 printk(KERN_ERR "Unable to register OMAP-VOUT device\n");
659 }
660 #else
661 static inline void omap_init_vout(void) {}
662 #endif
663
664 /*-------------------------------------------------------------------------*/
665
666 static int __init omap2_init_devices(void)
667 {
668         /*
669          * please keep these calls, and their implementations above,
670          * in alphabetical order so they're easier to sort through.
671          */
672         omap_init_audio();
673         omap_init_camera();
674         omap_init_mbox();
675         omap_init_mcspi();
676         omap_init_pmu();
677         omap_hdq_init();
678         omap_init_sti();
679         omap_init_sham();
680         omap_init_aes();
681         omap_init_vout();
682
683         return 0;
684 }
685 arch_initcall(omap2_init_devices);
686
687 #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
688 static struct omap_device_pm_latency omap_wdt_latency[] = {
689         [0] = {
690                 .deactivate_func = omap_device_idle_hwmods,
691                 .activate_func   = omap_device_enable_hwmods,
692                 .flags           = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
693         },
694 };
695
696 static int __init omap_init_wdt(void)
697 {
698         int id = -1;
699         struct omap_device *od;
700         struct omap_hwmod *oh;
701         char *oh_name = "wd_timer2";
702         char *dev_name = "omap_wdt";
703
704         if (!cpu_class_is_omap2())
705                 return 0;
706
707         oh = omap_hwmod_lookup(oh_name);
708         if (!oh) {
709                 pr_err("Could not look up wd_timer%d hwmod\n", id);
710                 return -EINVAL;
711         }
712
713         od = omap_device_build(dev_name, id, oh, NULL, 0,
714                                 omap_wdt_latency,
715                                 ARRAY_SIZE(omap_wdt_latency), 0);
716         WARN(IS_ERR(od), "Cant build omap_device for %s:%s.\n",
717                                 dev_name, oh->name);
718         return 0;
719 }
720 subsys_initcall(omap_init_wdt);
721 #endif