blob: 95c69f95d96614f973ff14385237c70afc0909b5 [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>
Tony Lindgren1dbae812005-11-10 14:26:51 +000018
Russell Kinga09e64f2008-08-05 16:14:15 +010019#include <mach/hardware.h>
Will Deacon88341332010-04-09 13:54:43 +010020#include <mach/irqs.h>
Tony Lindgren1dbae812005-11-10 14:26:51 +000021#include <asm/mach-types.h>
22#include <asm/mach/map.h>
Will Deacon88341332010-04-09 13:54:43 +010023#include <asm/pmu.h>
Tony Lindgren1dbae812005-11-10 14:26:51 +000024
Tony Lindgrence491cf2009-10-20 09:40:47 -070025#include <plat/tc.h>
26#include <plat/board.h>
Jarkko Nikulaa09f73f2010-10-04 15:04:53 +030027#include <plat/mcbsp.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010028#include <mach/gpio.h>
Tony Lindgrence491cf2009-10-20 09:40:47 -070029#include <plat/mmc.h>
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +080030#include <plat/dma.h>
Varadarajan, Charulathaf2ce6232010-09-23 20:02:42 +053031#include <plat/omap_hwmod.h>
32#include <plat/omap_device.h>
Tony Lindgren1dbae812005-11-10 14:26:51 +000033
Tony Lindgren4896e392009-12-11 16:16:32 -080034#include "mux.h"
Paul Walmsley4814ced2010-10-08 11:40:20 -060035#include "control.h"
Tony Lindgren4896e392009-12-11 16:16:32 -080036
Tony Lindgren828c7072009-03-23 18:23:49 -070037#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
Tony Lindgrenc40fae952006-12-07 13:58:10 -080038
Tony Lindgren828c7072009-03-23 18:23:49 -070039static struct resource cam_resources[] = {
Tony Lindgrenc40fae952006-12-07 13:58:10 -080040 {
Tony Lindgren828c7072009-03-23 18:23:49 -070041 .start = OMAP24XX_CAMERA_BASE,
42 .end = OMAP24XX_CAMERA_BASE + 0xfff,
43 .flags = IORESOURCE_MEM,
44 },
45 {
46 .start = INT_24XX_CAM_IRQ,
47 .flags = IORESOURCE_IRQ,
48 }
49};
50
51static struct platform_device omap_cam_device = {
52 .name = "omap24xxcam",
53 .id = -1,
54 .num_resources = ARRAY_SIZE(cam_resources),
55 .resource = cam_resources,
56};
57
58static inline void omap_init_camera(void)
59{
60 platform_device_register(&omap_cam_device);
61}
62
63#elif defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
64
65static struct resource omap3isp_resources[] = {
66 {
67 .start = OMAP3430_ISP_BASE,
68 .end = OMAP3430_ISP_END,
69 .flags = IORESOURCE_MEM,
70 },
71 {
72 .start = OMAP3430_ISP_CBUFF_BASE,
73 .end = OMAP3430_ISP_CBUFF_END,
74 .flags = IORESOURCE_MEM,
75 },
76 {
77 .start = OMAP3430_ISP_CCP2_BASE,
78 .end = OMAP3430_ISP_CCP2_END,
79 .flags = IORESOURCE_MEM,
80 },
81 {
82 .start = OMAP3430_ISP_CCDC_BASE,
83 .end = OMAP3430_ISP_CCDC_END,
84 .flags = IORESOURCE_MEM,
85 },
86 {
87 .start = OMAP3430_ISP_HIST_BASE,
88 .end = OMAP3430_ISP_HIST_END,
89 .flags = IORESOURCE_MEM,
90 },
91 {
92 .start = OMAP3430_ISP_H3A_BASE,
93 .end = OMAP3430_ISP_H3A_END,
94 .flags = IORESOURCE_MEM,
95 },
96 {
97 .start = OMAP3430_ISP_PREV_BASE,
98 .end = OMAP3430_ISP_PREV_END,
99 .flags = IORESOURCE_MEM,
100 },
101 {
102 .start = OMAP3430_ISP_RESZ_BASE,
103 .end = OMAP3430_ISP_RESZ_END,
104 .flags = IORESOURCE_MEM,
105 },
106 {
107 .start = OMAP3430_ISP_SBL_BASE,
108 .end = OMAP3430_ISP_SBL_END,
109 .flags = IORESOURCE_MEM,
110 },
111 {
Tuukka Toivonen6817a692010-02-02 11:17:33 -0300112 .start = OMAP3430_ISP_CSI2A_REGS1_BASE,
113 .end = OMAP3430_ISP_CSI2A_REGS1_END,
Tony Lindgren828c7072009-03-23 18:23:49 -0700114 .flags = IORESOURCE_MEM,
115 },
116 {
Tuukka Toivonen6817a692010-02-02 11:17:33 -0300117 .start = OMAP3430_ISP_CSIPHY2_BASE,
118 .end = OMAP3430_ISP_CSIPHY2_END,
119 .flags = IORESOURCE_MEM,
120 },
121 {
122 .start = OMAP3630_ISP_CSI2A_REGS2_BASE,
123 .end = OMAP3630_ISP_CSI2A_REGS2_END,
124 .flags = IORESOURCE_MEM,
125 },
126 {
127 .start = OMAP3630_ISP_CSI2C_REGS1_BASE,
128 .end = OMAP3630_ISP_CSI2C_REGS1_END,
129 .flags = IORESOURCE_MEM,
130 },
131 {
132 .start = OMAP3630_ISP_CSIPHY1_BASE,
133 .end = OMAP3630_ISP_CSIPHY1_END,
134 .flags = IORESOURCE_MEM,
135 },
136 {
137 .start = OMAP3630_ISP_CSI2C_REGS2_BASE,
138 .end = OMAP3630_ISP_CSI2C_REGS2_END,
Tony Lindgren828c7072009-03-23 18:23:49 -0700139 .flags = IORESOURCE_MEM,
140 },
141 {
142 .start = INT_34XX_CAM_IRQ,
143 .flags = IORESOURCE_IRQ,
144 }
145};
146
147static struct platform_device omap3isp_device = {
148 .name = "omap3isp",
149 .id = -1,
150 .num_resources = ARRAY_SIZE(omap3isp_resources),
151 .resource = omap3isp_resources,
152};
153
154static inline void omap_init_camera(void)
155{
156 platform_device_register(&omap3isp_device);
157}
158#else
159static inline void omap_init_camera(void)
160{
161}
162#endif
163
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700164#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800165
C A Subramaniam454bf342009-11-22 10:11:18 -0800166#define MBOX_REG_SIZE 0x120
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700167
C A Subramaniam454bf342009-11-22 10:11:18 -0800168#ifdef CONFIG_ARCH_OMAP2
Tony Lindgrend10f2b62010-02-12 12:26:47 -0800169static struct resource omap2_mbox_resources[] = {
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800170 {
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700171 .start = OMAP24XX_MAILBOX_BASE,
172 .end = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800173 .flags = IORESOURCE_MEM,
174 },
175 {
176 .start = INT_24XX_MAIL_U0_MPU,
177 .flags = IORESOURCE_IRQ,
Felipe Contreras1f2c4df2010-06-11 15:51:44 +0000178 .name = "dsp",
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800179 },
180 {
181 .start = INT_24XX_MAIL_U3_MPU,
182 .flags = IORESOURCE_IRQ,
Felipe Contreras1f2c4df2010-06-11 15:51:44 +0000183 .name = "iva",
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800184 },
185};
Tony Lindgrend10f2b62010-02-12 12:26:47 -0800186static int omap2_mbox_resources_sz = ARRAY_SIZE(omap2_mbox_resources);
187#else
188#define omap2_mbox_resources NULL
189#define omap2_mbox_resources_sz 0
C A Subramaniam454bf342009-11-22 10:11:18 -0800190#endif
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800191
C A Subramaniam454bf342009-11-22 10:11:18 -0800192#ifdef CONFIG_ARCH_OMAP3
Tony Lindgrend10f2b62010-02-12 12:26:47 -0800193static struct resource omap3_mbox_resources[] = {
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700194 {
195 .start = OMAP34XX_MAILBOX_BASE,
196 .end = OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
197 .flags = IORESOURCE_MEM,
198 },
199 {
200 .start = INT_24XX_MAIL_U0_MPU,
201 .flags = IORESOURCE_IRQ,
Felipe Contreras1f2c4df2010-06-11 15:51:44 +0000202 .name = "dsp",
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700203 },
204};
Tony Lindgrend10f2b62010-02-12 12:26:47 -0800205static int omap3_mbox_resources_sz = ARRAY_SIZE(omap3_mbox_resources);
206#else
207#define omap3_mbox_resources NULL
208#define omap3_mbox_resources_sz 0
C A Subramaniam454bf342009-11-22 10:11:18 -0800209#endif
210
211#ifdef CONFIG_ARCH_OMAP4
212
213#define OMAP4_MBOX_REG_SIZE 0x130
Tony Lindgrend10f2b62010-02-12 12:26:47 -0800214static struct resource omap4_mbox_resources[] = {
C A Subramaniam454bf342009-11-22 10:11:18 -0800215 {
216 .start = OMAP44XX_MAILBOX_BASE,
217 .end = OMAP44XX_MAILBOX_BASE +
218 OMAP4_MBOX_REG_SIZE - 1,
219 .flags = IORESOURCE_MEM,
220 },
221 {
Santosh Shilimkar5772ca72010-02-18 03:14:12 +0530222 .start = OMAP44XX_IRQ_MAIL_U0,
C A Subramaniam454bf342009-11-22 10:11:18 -0800223 .flags = IORESOURCE_IRQ,
Felipe Contreras1f2c4df2010-06-11 15:51:44 +0000224 .name = "mbox",
C A Subramaniam454bf342009-11-22 10:11:18 -0800225 },
226};
Tony Lindgrend10f2b62010-02-12 12:26:47 -0800227static int omap4_mbox_resources_sz = ARRAY_SIZE(omap4_mbox_resources);
228#else
229#define omap4_mbox_resources NULL
230#define omap4_mbox_resources_sz 0
C A Subramaniam454bf342009-11-22 10:11:18 -0800231#endif
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700232
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800233static struct platform_device mbox_device = {
Felipe Contrerasd7427092010-06-11 15:51:48 +0000234 .name = "omap-mailbox",
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800235 .id = -1,
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800236};
237
238static inline void omap_init_mbox(void)
239{
Tony Lindgrend10f2b62010-02-12 12:26:47 -0800240 if (cpu_is_omap24xx()) {
241 mbox_device.resource = omap2_mbox_resources;
242 mbox_device.num_resources = omap2_mbox_resources_sz;
243 } else if (cpu_is_omap34xx()) {
244 mbox_device.resource = omap3_mbox_resources;
245 mbox_device.num_resources = omap3_mbox_resources_sz;
246 } else if (cpu_is_omap44xx()) {
247 mbox_device.resource = omap4_mbox_resources;
248 mbox_device.num_resources = omap4_mbox_resources_sz;
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700249 } else {
250 pr_err("%s: platform not supported\n", __func__);
251 return;
252 }
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800253 platform_device_register(&mbox_device);
254}
255#else
256static inline void omap_init_mbox(void) { }
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700257#endif /* CONFIG_OMAP_MBOX_FWK */
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800258
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100259static inline void omap_init_sti(void) {}
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100260
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000261#if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
262
263static struct platform_device omap_pcm = {
264 .name = "omap-pcm-audio",
265 .id = -1,
266};
267
268/*
269 * OMAP2420 has 2 McBSP ports
270 * OMAP2430 has 5 McBSP ports
271 * OMAP3 has 5 McBSP ports
272 * OMAP4 has 4 McBSP ports
273 */
274OMAP_MCBSP_PLATFORM_DEVICE(1);
275OMAP_MCBSP_PLATFORM_DEVICE(2);
276OMAP_MCBSP_PLATFORM_DEVICE(3);
277OMAP_MCBSP_PLATFORM_DEVICE(4);
278OMAP_MCBSP_PLATFORM_DEVICE(5);
279
280static void omap_init_audio(void)
281{
282 platform_device_register(&omap_mcbsp1);
283 platform_device_register(&omap_mcbsp2);
284 if (cpu_is_omap243x() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
285 platform_device_register(&omap_mcbsp3);
286 platform_device_register(&omap_mcbsp4);
287 }
288 if (cpu_is_omap243x() || cpu_is_omap34xx())
289 platform_device_register(&omap_mcbsp5);
290
291 platform_device_register(&omap_pcm);
292}
293
294#else
295static inline void omap_init_audio(void) {}
296#endif
297
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300298#if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700299
Tony Lindgrence491cf2009-10-20 09:40:47 -0700300#include <plat/mcspi.h>
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700301
302#define OMAP2_MCSPI1_BASE 0x48098000
303#define OMAP2_MCSPI2_BASE 0x4809a000
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300304#define OMAP2_MCSPI3_BASE 0x480b8000
305#define OMAP2_MCSPI4_BASE 0x480ba000
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700306
Syed Rafiuddin7869c0b2009-09-22 16:46:18 -0700307#define OMAP4_MCSPI1_BASE 0x48098100
308#define OMAP4_MCSPI2_BASE 0x4809a100
309#define OMAP4_MCSPI3_BASE 0x480b8100
310#define OMAP4_MCSPI4_BASE 0x480ba100
311
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700312static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700313 .num_cs = 4,
314};
315
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800316static struct resource omap2_mcspi1_resources[] = {
317 {
318 .start = OMAP2_MCSPI1_BASE,
319 .end = OMAP2_MCSPI1_BASE + 0xff,
320 .flags = IORESOURCE_MEM,
321 },
322};
323
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300324static struct platform_device omap2_mcspi1 = {
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700325 .name = "omap2_mcspi",
326 .id = 1,
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800327 .num_resources = ARRAY_SIZE(omap2_mcspi1_resources),
328 .resource = omap2_mcspi1_resources,
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700329 .dev = {
330 .platform_data = &omap2_mcspi1_config,
331 },
332};
333
334static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700335 .num_cs = 2,
336};
337
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800338static struct resource omap2_mcspi2_resources[] = {
339 {
340 .start = OMAP2_MCSPI2_BASE,
341 .end = OMAP2_MCSPI2_BASE + 0xff,
342 .flags = IORESOURCE_MEM,
343 },
344};
345
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300346static struct platform_device omap2_mcspi2 = {
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700347 .name = "omap2_mcspi",
348 .id = 2,
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800349 .num_resources = ARRAY_SIZE(omap2_mcspi2_resources),
350 .resource = omap2_mcspi2_resources,
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700351 .dev = {
352 .platform_data = &omap2_mcspi2_config,
353 },
354};
355
Syed Rafiuddin7869c0b2009-09-22 16:46:18 -0700356#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
357 defined(CONFIG_ARCH_OMAP4)
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300358static struct omap2_mcspi_platform_config omap2_mcspi3_config = {
359 .num_cs = 2,
360};
361
362static struct resource omap2_mcspi3_resources[] = {
363 {
364 .start = OMAP2_MCSPI3_BASE,
365 .end = OMAP2_MCSPI3_BASE + 0xff,
366 .flags = IORESOURCE_MEM,
367 },
368};
369
370static struct platform_device omap2_mcspi3 = {
371 .name = "omap2_mcspi",
372 .id = 3,
373 .num_resources = ARRAY_SIZE(omap2_mcspi3_resources),
374 .resource = omap2_mcspi3_resources,
375 .dev = {
376 .platform_data = &omap2_mcspi3_config,
377 },
378};
379#endif
380
Syed Rafiuddin7869c0b2009-09-22 16:46:18 -0700381#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300382static struct omap2_mcspi_platform_config omap2_mcspi4_config = {
383 .num_cs = 1,
384};
385
386static struct resource omap2_mcspi4_resources[] = {
387 {
388 .start = OMAP2_MCSPI4_BASE,
389 .end = OMAP2_MCSPI4_BASE + 0xff,
390 .flags = IORESOURCE_MEM,
391 },
392};
393
394static struct platform_device omap2_mcspi4 = {
395 .name = "omap2_mcspi",
396 .id = 4,
397 .num_resources = ARRAY_SIZE(omap2_mcspi4_resources),
398 .resource = omap2_mcspi4_resources,
399 .dev = {
400 .platform_data = &omap2_mcspi4_config,
401 },
402};
403#endif
404
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700405#ifdef CONFIG_ARCH_OMAP4
406static inline void omap4_mcspi_fixup(void)
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700407{
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700408 omap2_mcspi1_resources[0].start = OMAP4_MCSPI1_BASE;
409 omap2_mcspi1_resources[0].end = OMAP4_MCSPI1_BASE + 0xff;
410 omap2_mcspi2_resources[0].start = OMAP4_MCSPI2_BASE;
411 omap2_mcspi2_resources[0].end = OMAP4_MCSPI2_BASE + 0xff;
412 omap2_mcspi3_resources[0].start = OMAP4_MCSPI3_BASE;
413 omap2_mcspi3_resources[0].end = OMAP4_MCSPI3_BASE + 0xff;
414 omap2_mcspi4_resources[0].start = OMAP4_MCSPI4_BASE;
415 omap2_mcspi4_resources[0].end = OMAP4_MCSPI4_BASE + 0xff;
416}
417#else
418static inline void omap4_mcspi_fixup(void)
419{
420}
421#endif
422
Syed Rafiuddin7869c0b2009-09-22 16:46:18 -0700423#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
424 defined(CONFIG_ARCH_OMAP4)
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700425static inline void omap2_mcspi3_init(void)
426{
427 platform_device_register(&omap2_mcspi3);
428}
429#else
430static inline void omap2_mcspi3_init(void)
431{
432}
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300433#endif
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700434
Syed Rafiuddin7869c0b2009-09-22 16:46:18 -0700435#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700436static inline void omap2_mcspi4_init(void)
437{
438 platform_device_register(&omap2_mcspi4);
439}
440#else
441static inline void omap2_mcspi4_init(void)
442{
443}
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300444#endif
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700445
446static void omap_init_mcspi(void)
447{
448 if (cpu_is_omap44xx())
449 omap4_mcspi_fixup();
450
451 platform_device_register(&omap2_mcspi1);
452 platform_device_register(&omap2_mcspi2);
453
454 if (cpu_is_omap2430() || cpu_is_omap343x() || cpu_is_omap44xx())
455 omap2_mcspi3_init();
456
457 if (cpu_is_omap343x() || cpu_is_omap44xx())
458 omap2_mcspi4_init();
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700459}
460
461#else
462static inline void omap_init_mcspi(void) {}
463#endif
464
Will Deacon88341332010-04-09 13:54:43 +0100465static struct resource omap2_pmu_resource = {
466 .start = 3,
467 .end = 3,
468 .flags = IORESOURCE_IRQ,
469};
470
471static struct resource omap3_pmu_resource = {
472 .start = INT_34XX_BENCH_MPU_EMUL,
473 .end = INT_34XX_BENCH_MPU_EMUL,
474 .flags = IORESOURCE_IRQ,
475};
476
477static struct platform_device omap_pmu_device = {
478 .name = "arm-pmu",
479 .id = ARM_PMU_DEVICE_CPU,
480 .num_resources = 1,
481};
482
483static void omap_init_pmu(void)
484{
485 if (cpu_is_omap24xx())
486 omap_pmu_device.resource = &omap2_pmu_resource;
487 else if (cpu_is_omap34xx())
488 omap_pmu_device.resource = &omap3_pmu_resource;
489 else
490 return;
491
492 platform_device_register(&omap_pmu_device);
493}
494
495
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800496#if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE)
497
Dmitry Kasatkinedc774e2010-05-14 14:45:08 +1000498#ifdef CONFIG_ARCH_OMAP2
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800499static struct resource omap2_sham_resources[] = {
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300500 {
501 .start = OMAP24XX_SEC_SHA1MD5_BASE,
502 .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64,
503 .flags = IORESOURCE_MEM,
504 },
505 {
506 .start = INT_24XX_SHA1MD5,
507 .flags = IORESOURCE_IRQ,
508 }
509};
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800510static int omap2_sham_resources_sz = ARRAY_SIZE(omap2_sham_resources);
511#else
512#define omap2_sham_resources NULL
513#define omap2_sham_resources_sz 0
514#endif
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300515
Dmitry Kasatkinedc774e2010-05-14 14:45:08 +1000516#ifdef CONFIG_ARCH_OMAP3
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800517static struct resource omap3_sham_resources[] = {
518 {
519 .start = OMAP34XX_SEC_SHA1MD5_BASE,
520 .end = OMAP34XX_SEC_SHA1MD5_BASE + 0x64,
521 .flags = IORESOURCE_MEM,
522 },
523 {
524 .start = INT_34XX_SHA1MD52_IRQ,
525 .flags = IORESOURCE_IRQ,
526 },
527 {
528 .start = OMAP34XX_DMA_SHA1MD5_RX,
529 .flags = IORESOURCE_DMA,
530 }
531};
532static int omap3_sham_resources_sz = ARRAY_SIZE(omap3_sham_resources);
533#else
534#define omap3_sham_resources NULL
535#define omap3_sham_resources_sz 0
536#endif
537
538static struct platform_device sham_device = {
539 .name = "omap-sham",
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300540 .id = -1,
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300541};
542
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800543static void omap_init_sham(void)
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300544{
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800545 if (cpu_is_omap24xx()) {
546 sham_device.resource = omap2_sham_resources;
547 sham_device.num_resources = omap2_sham_resources_sz;
548 } else if (cpu_is_omap34xx()) {
549 sham_device.resource = omap3_sham_resources;
550 sham_device.num_resources = omap3_sham_resources_sz;
551 } else {
552 pr_err("%s: platform not supported\n", __func__);
553 return;
554 }
555 platform_device_register(&sham_device);
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300556}
557#else
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800558static inline void omap_init_sham(void) { }
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300559#endif
560
Dmitry Kasatkinb744c672010-09-03 19:13:55 +0800561#if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE)
562
Dmitry Kasatkin82a0c142010-08-20 13:44:46 +0000563#ifdef CONFIG_ARCH_OMAP2
Dmitry Kasatkinb744c672010-09-03 19:13:55 +0800564static struct resource omap2_aes_resources[] = {
565 {
566 .start = OMAP24XX_SEC_AES_BASE,
567 .end = OMAP24XX_SEC_AES_BASE + 0x4C,
568 .flags = IORESOURCE_MEM,
569 },
570 {
571 .start = OMAP24XX_DMA_AES_TX,
572 .flags = IORESOURCE_DMA,
573 },
574 {
575 .start = OMAP24XX_DMA_AES_RX,
576 .flags = IORESOURCE_DMA,
577 }
578};
579static int omap2_aes_resources_sz = ARRAY_SIZE(omap2_aes_resources);
580#else
581#define omap2_aes_resources NULL
582#define omap2_aes_resources_sz 0
583#endif
584
Dmitry Kasatkin82a0c142010-08-20 13:44:46 +0000585#ifdef CONFIG_ARCH_OMAP3
Dmitry Kasatkinb744c672010-09-03 19:13:55 +0800586static struct resource omap3_aes_resources[] = {
587 {
588 .start = OMAP34XX_SEC_AES_BASE,
589 .end = OMAP34XX_SEC_AES_BASE + 0x4C,
590 .flags = IORESOURCE_MEM,
591 },
592 {
593 .start = OMAP34XX_DMA_AES2_TX,
594 .flags = IORESOURCE_DMA,
595 },
596 {
597 .start = OMAP34XX_DMA_AES2_RX,
598 .flags = IORESOURCE_DMA,
599 }
600};
601static int omap3_aes_resources_sz = ARRAY_SIZE(omap3_aes_resources);
602#else
603#define omap3_aes_resources NULL
604#define omap3_aes_resources_sz 0
605#endif
606
607static struct platform_device aes_device = {
608 .name = "omap-aes",
609 .id = -1,
610};
611
612static void omap_init_aes(void)
613{
614 if (cpu_is_omap24xx()) {
615 aes_device.resource = omap2_aes_resources;
616 aes_device.num_resources = omap2_aes_resources_sz;
617 } else if (cpu_is_omap34xx()) {
618 aes_device.resource = omap3_aes_resources;
619 aes_device.num_resources = omap3_aes_resources_sz;
620 } else {
621 pr_err("%s: platform not supported\n", __func__);
622 return;
623 }
624 platform_device_register(&aes_device);
625}
626
627#else
628static inline void omap_init_aes(void) { }
629#endif
630
Tony Lindgrend8874662008-12-10 17:37:16 -0800631/*-------------------------------------------------------------------------*/
632
kishore kadiyala82cf8182009-09-22 16:45:25 -0700633#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
Kevin Hilman917fa282008-12-10 17:37:17 -0800634
635#define MMCHS_SYSCONFIG 0x0010
636#define MMCHS_SYSCONFIG_SWRESET (1 << 1)
637#define MMCHS_SYSSTATUS 0x0014
638#define MMCHS_SYSSTATUS_RESETDONE (1 << 0)
639
640static struct platform_device dummy_pdev = {
641 .dev = {
642 .bus = &platform_bus_type,
643 },
644};
645
646/**
647 * omap_hsmmc_reset() - Full reset of each HS-MMC controller
648 *
649 * Ensure that each MMC controller is fully reset. Controllers
650 * left in an unknown state (by bootloader) may prevent retention
651 * or OFF-mode. This is especially important in cases where the
652 * MMC driver is not enabled, _or_ built as a module.
653 *
654 * In order for reset to work, interface, functional and debounce
655 * clocks must be enabled. The debounce clock comes from func_32k_clk
656 * and is not under SW control, so we only enable i- and f-clocks.
657 **/
658static void __init omap_hsmmc_reset(void)
659{
Tony Lindgren4323e9f2010-02-12 12:26:48 -0800660 u32 i, nr_controllers;
Aaro Koskinen434c23a2010-12-20 18:48:15 -0800661 struct clk *iclk, *fclk;
Tony Lindgren4323e9f2010-02-12 12:26:48 -0800662
663 if (cpu_is_omap242x())
664 return;
665
666 nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC :
kishore kadiyala82cf8182009-09-22 16:45:25 -0700667 (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC);
Kevin Hilman917fa282008-12-10 17:37:17 -0800668
669 for (i = 0; i < nr_controllers; i++) {
670 u32 v, base = 0;
Kevin Hilman917fa282008-12-10 17:37:17 -0800671 struct device *dev = &dummy_pdev.dev;
672
673 switch (i) {
674 case 0:
675 base = OMAP2_MMC1_BASE;
676 break;
677 case 1:
678 base = OMAP2_MMC2_BASE;
679 break;
680 case 2:
681 base = OMAP3_MMC3_BASE;
682 break;
kishore kadiyala82cf8182009-09-22 16:45:25 -0700683 case 3:
684 if (!cpu_is_omap44xx())
685 return;
686 base = OMAP4_MMC4_BASE;
687 break;
688 case 4:
689 if (!cpu_is_omap44xx())
690 return;
691 base = OMAP4_MMC5_BASE;
692 break;
Kevin Hilman917fa282008-12-10 17:37:17 -0800693 }
694
kishore kadiyala82cf8182009-09-22 16:45:25 -0700695 if (cpu_is_omap44xx())
696 base += OMAP4_MMC_REG_OFFSET;
697
Kevin Hilman917fa282008-12-10 17:37:17 -0800698 dummy_pdev.id = i;
Russell King1e98ffa2009-01-19 18:56:17 +0000699 dev_set_name(&dummy_pdev.dev, "mmci-omap-hs.%d", i);
Russell King6f7607c2009-01-28 10:22:50 +0000700 iclk = clk_get(dev, "ick");
Aaro Koskinen434c23a2010-12-20 18:48:15 -0800701 if (IS_ERR(iclk))
702 goto err1;
703 if (clk_enable(iclk))
704 goto err2;
Kevin Hilman917fa282008-12-10 17:37:17 -0800705
Russell King6f7607c2009-01-28 10:22:50 +0000706 fclk = clk_get(dev, "fck");
Aaro Koskinen434c23a2010-12-20 18:48:15 -0800707 if (IS_ERR(fclk))
708 goto err3;
709 if (clk_enable(fclk))
710 goto err4;
Kevin Hilman917fa282008-12-10 17:37:17 -0800711
712 omap_writel(MMCHS_SYSCONFIG_SWRESET, base + MMCHS_SYSCONFIG);
713 v = omap_readl(base + MMCHS_SYSSTATUS);
714 while (!(omap_readl(base + MMCHS_SYSSTATUS) &
715 MMCHS_SYSSTATUS_RESETDONE))
716 cpu_relax();
717
Aaro Koskinen434c23a2010-12-20 18:48:15 -0800718 clk_disable(fclk);
719 clk_put(fclk);
720 clk_disable(iclk);
721 clk_put(iclk);
Kevin Hilman917fa282008-12-10 17:37:17 -0800722 }
Aaro Koskinen434c23a2010-12-20 18:48:15 -0800723 return;
724
725err4:
726 clk_put(fclk);
727err3:
728 clk_disable(iclk);
729err2:
730 clk_put(iclk);
731err1:
732 printk(KERN_WARNING "%s: Unable to enable clocks for MMC%d, "
733 "cannot reset.\n", __func__, i);
Kevin Hilman917fa282008-12-10 17:37:17 -0800734}
735#else
736static inline void omap_hsmmc_reset(void) {}
737#endif
738
Tony Lindgrend8874662008-12-10 17:37:16 -0800739#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
740 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
741
742static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
743 int controller_nr)
744{
stanley.miaoed8303fc2010-05-13 12:39:30 +0000745 if ((mmc_controller->slots[0].switch_pin > 0) && \
746 (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
747 omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
748 OMAP_PIN_INPUT_PULLUP);
749 if ((mmc_controller->slots[0].gpio_wp > 0) && \
750 (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
751 omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
752 OMAP_PIN_INPUT_PULLUP);
753
Tony Lindgrend8874662008-12-10 17:37:16 -0800754 if (cpu_is_omap2420() && controller_nr == 0) {
Tony Lindgrenf99bf162010-07-05 16:31:40 +0300755 omap_mux_init_signal("sdmmc_cmd", 0);
756 omap_mux_init_signal("sdmmc_clki", 0);
757 omap_mux_init_signal("sdmmc_clko", 0);
758 omap_mux_init_signal("sdmmc_dat0", 0);
759 omap_mux_init_signal("sdmmc_dat_dir0", 0);
760 omap_mux_init_signal("sdmmc_cmd_dir", 0);
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000761 if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) {
Tony Lindgrenf99bf162010-07-05 16:31:40 +0300762 omap_mux_init_signal("sdmmc_dat1", 0);
763 omap_mux_init_signal("sdmmc_dat2", 0);
764 omap_mux_init_signal("sdmmc_dat3", 0);
765 omap_mux_init_signal("sdmmc_dat_dir1", 0);
766 omap_mux_init_signal("sdmmc_dat_dir2", 0);
767 omap_mux_init_signal("sdmmc_dat_dir3", 0);
Tony Lindgrend8874662008-12-10 17:37:16 -0800768 }
769
770 /*
771 * Use internal loop-back in MMC/SDIO Module Input Clock
772 * selection
773 */
774 if (mmc_controller->slots[0].internal_clock) {
775 u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
776 v |= (1 << 24);
777 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
778 }
779 }
Vikram Pandita57b9daa2009-08-28 11:24:11 -0700780
Madhu4596d142009-11-22 10:11:06 -0800781 if (cpu_is_omap34xx()) {
Vikram Pandita57b9daa2009-08-28 11:24:11 -0700782 if (controller_nr == 0) {
Tony Lindgren4896e392009-12-11 16:16:32 -0800783 omap_mux_init_signal("sdmmc1_clk",
784 OMAP_PIN_INPUT_PULLUP);
785 omap_mux_init_signal("sdmmc1_cmd",
786 OMAP_PIN_INPUT_PULLUP);
787 omap_mux_init_signal("sdmmc1_dat0",
788 OMAP_PIN_INPUT_PULLUP);
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000789 if (mmc_controller->slots[0].caps &
790 (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
Tony Lindgren4896e392009-12-11 16:16:32 -0800791 omap_mux_init_signal("sdmmc1_dat1",
792 OMAP_PIN_INPUT_PULLUP);
793 omap_mux_init_signal("sdmmc1_dat2",
794 OMAP_PIN_INPUT_PULLUP);
795 omap_mux_init_signal("sdmmc1_dat3",
796 OMAP_PIN_INPUT_PULLUP);
Vikram Pandita57b9daa2009-08-28 11:24:11 -0700797 }
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000798 if (mmc_controller->slots[0].caps &
799 MMC_CAP_8_BIT_DATA) {
Tony Lindgren4896e392009-12-11 16:16:32 -0800800 omap_mux_init_signal("sdmmc1_dat4",
801 OMAP_PIN_INPUT_PULLUP);
802 omap_mux_init_signal("sdmmc1_dat5",
803 OMAP_PIN_INPUT_PULLUP);
804 omap_mux_init_signal("sdmmc1_dat6",
805 OMAP_PIN_INPUT_PULLUP);
806 omap_mux_init_signal("sdmmc1_dat7",
807 OMAP_PIN_INPUT_PULLUP);
Vikram Pandita57b9daa2009-08-28 11:24:11 -0700808 }
809 }
810 if (controller_nr == 1) {
811 /* MMC2 */
Tony Lindgren4896e392009-12-11 16:16:32 -0800812 omap_mux_init_signal("sdmmc2_clk",
813 OMAP_PIN_INPUT_PULLUP);
814 omap_mux_init_signal("sdmmc2_cmd",
815 OMAP_PIN_INPUT_PULLUP);
816 omap_mux_init_signal("sdmmc2_dat0",
817 OMAP_PIN_INPUT_PULLUP);
Vikram Pandita57b9daa2009-08-28 11:24:11 -0700818
819 /*
820 * For 8 wire configurations, Lines DAT4, 5, 6 and 7 need to be muxed
821 * in the board-*.c files
822 */
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000823 if (mmc_controller->slots[0].caps &
824 (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
Tony Lindgren4896e392009-12-11 16:16:32 -0800825 omap_mux_init_signal("sdmmc2_dat1",
826 OMAP_PIN_INPUT_PULLUP);
827 omap_mux_init_signal("sdmmc2_dat2",
828 OMAP_PIN_INPUT_PULLUP);
829 omap_mux_init_signal("sdmmc2_dat3",
830 OMAP_PIN_INPUT_PULLUP);
Vikram Pandita57b9daa2009-08-28 11:24:11 -0700831 }
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000832 if (mmc_controller->slots[0].caps &
833 MMC_CAP_8_BIT_DATA) {
Tony Lindgren4896e392009-12-11 16:16:32 -0800834 omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
835 OMAP_PIN_INPUT_PULLUP);
836 omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5",
837 OMAP_PIN_INPUT_PULLUP);
838 omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
839 OMAP_PIN_INPUT_PULLUP);
840 omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7",
841 OMAP_PIN_INPUT_PULLUP);
Madhu46792322009-11-22 10:11:08 -0800842 }
Vikram Pandita57b9daa2009-08-28 11:24:11 -0700843 }
844
845 /*
846 * For MMC3 the pins need to be muxed in the board-*.c files
847 */
848 }
Tony Lindgrend8874662008-12-10 17:37:16 -0800849}
850
851void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
852 int nr_controllers)
853{
854 int i;
Tony Lindgren0dffb5c2009-01-29 08:57:16 -0800855 char *name;
Tony Lindgrend8874662008-12-10 17:37:16 -0800856
857 for (i = 0; i < nr_controllers; i++) {
858 unsigned long base, size;
859 unsigned int irq = 0;
860
861 if (!mmc_data[i])
862 continue;
863
864 omap2_mmc_mux(mmc_data[i], i);
865
866 switch (i) {
867 case 0:
868 base = OMAP2_MMC1_BASE;
869 irq = INT_24XX_MMC_IRQ;
870 break;
871 case 1:
872 base = OMAP2_MMC2_BASE;
873 irq = INT_24XX_MMC2_IRQ;
874 break;
875 case 2:
kishore kadiyala82cf8182009-09-22 16:45:25 -0700876 if (!cpu_is_omap44xx() && !cpu_is_omap34xx())
Tony Lindgrend8874662008-12-10 17:37:16 -0800877 return;
878 base = OMAP3_MMC3_BASE;
879 irq = INT_34XX_MMC3_IRQ;
880 break;
kishore kadiyala82cf8182009-09-22 16:45:25 -0700881 case 3:
882 if (!cpu_is_omap44xx())
883 return;
kishore kadiyala91a0b082010-10-01 16:35:28 -0700884 base = OMAP4_MMC4_BASE;
Santosh Shilimkar5772ca72010-02-18 03:14:12 +0530885 irq = OMAP44XX_IRQ_MMC4;
kishore kadiyala82cf8182009-09-22 16:45:25 -0700886 break;
887 case 4:
888 if (!cpu_is_omap44xx())
889 return;
kishore kadiyala91a0b082010-10-01 16:35:28 -0700890 base = OMAP4_MMC5_BASE;
kishore kadiyala9df76b72010-04-21 18:19:37 +0000891 irq = OMAP44XX_IRQ_MMC5;
kishore kadiyala82cf8182009-09-22 16:45:25 -0700892 break;
Tony Lindgrend8874662008-12-10 17:37:16 -0800893 default:
894 continue;
895 }
896
Tony Lindgren0dffb5c2009-01-29 08:57:16 -0800897 if (cpu_is_omap2420()) {
Tony Lindgrend8874662008-12-10 17:37:16 -0800898 size = OMAP2420_MMC_SIZE;
Tony Lindgren0dffb5c2009-01-29 08:57:16 -0800899 name = "mmci-omap";
kishore kadiyala82cf8182009-09-22 16:45:25 -0700900 } else if (cpu_is_omap44xx()) {
kishore kadiyala91a0b082010-10-01 16:35:28 -0700901 if (i < 3)
Santosh Shilimkar5772ca72010-02-18 03:14:12 +0530902 irq += OMAP44XX_IRQ_GIC_START;
kishore kadiyala82cf8182009-09-22 16:45:25 -0700903 size = OMAP4_HSMMC_SIZE;
904 name = "mmci-omap-hs";
Tony Lindgren0dffb5c2009-01-29 08:57:16 -0800905 } else {
kishore kadiyala82cf8182009-09-22 16:45:25 -0700906 size = OMAP3_HSMMC_SIZE;
Tony Lindgren0dffb5c2009-01-29 08:57:16 -0800907 name = "mmci-omap-hs";
908 }
909 omap_mmc_add(name, i, base, size, irq, mmc_data[i]);
Tony Lindgrend8874662008-12-10 17:37:16 -0800910 };
911}
912
913#endif
914
915/*-------------------------------------------------------------------------*/
916
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300917#if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
918#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
919#define OMAP_HDQ_BASE 0x480B2000
920#endif
921static struct resource omap_hdq_resources[] = {
922 {
923 .start = OMAP_HDQ_BASE,
924 .end = OMAP_HDQ_BASE + 0x1C,
925 .flags = IORESOURCE_MEM,
926 },
927 {
928 .start = INT_24XX_HDQ_IRQ,
929 .flags = IORESOURCE_IRQ,
930 },
931};
932static struct platform_device omap_hdq_dev = {
933 .name = "omap_hdq",
934 .id = 0,
935 .dev = {
936 .platform_data = NULL,
937 },
938 .num_resources = ARRAY_SIZE(omap_hdq_resources),
939 .resource = omap_hdq_resources,
940};
941static inline void omap_hdq_init(void)
942{
943 (void) platform_device_register(&omap_hdq_dev);
944}
945#else
946static inline void omap_hdq_init(void) {}
947#endif
948
Vaibhav Hiremathb2273582010-05-10 14:29:14 -0700949/*---------------------------------------------------------------------------*/
950
951#if defined(CONFIG_VIDEO_OMAP2_VOUT) || \
952 defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE)
953#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
954static struct resource omap_vout_resource[3 - CONFIG_FB_OMAP2_NUM_FBS] = {
955};
956#else
957static struct resource omap_vout_resource[2] = {
958};
959#endif
960
961static struct platform_device omap_vout_device = {
962 .name = "omap_vout",
963 .num_resources = ARRAY_SIZE(omap_vout_resource),
964 .resource = &omap_vout_resource[0],
965 .id = -1,
966};
967static void omap_init_vout(void)
968{
969 if (platform_device_register(&omap_vout_device) < 0)
970 printk(KERN_ERR "Unable to register OMAP-VOUT device\n");
971}
972#else
973static inline void omap_init_vout(void) {}
974#endif
975
Tony Lindgren1dbae812005-11-10 14:26:51 +0000976/*-------------------------------------------------------------------------*/
977
978static int __init omap2_init_devices(void)
979{
Paul Walmsley81fbc5ef2010-12-21 19:56:17 -0700980 /*
981 * please keep these calls, and their implementations above,
Tony Lindgren1dbae812005-11-10 14:26:51 +0000982 * in alphabetical order so they're easier to sort through.
983 */
Kevin Hilman917fa282008-12-10 17:37:17 -0800984 omap_hsmmc_reset();
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000985 omap_init_audio();
Tony Lindgren828c7072009-03-23 18:23:49 -0700986 omap_init_camera();
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800987 omap_init_mbox();
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700988 omap_init_mcspi();
Will Deacon88341332010-04-09 13:54:43 +0100989 omap_init_pmu();
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300990 omap_hdq_init();
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100991 omap_init_sti();
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800992 omap_init_sham();
Dmitry Kasatkinb744c672010-09-03 19:13:55 +0800993 omap_init_aes();
Vaibhav Hiremathb2273582010-05-10 14:29:14 -0700994 omap_init_vout();
Tony Lindgren1dbae812005-11-10 14:26:51 +0000995
996 return 0;
997}
998arch_initcall(omap2_init_devices);
Varadarajan, Charulathaf2ce6232010-09-23 20:02:42 +0530999
1000#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
Nishanth Menona9b365b2011-01-06 19:49:29 -08001001static struct omap_device_pm_latency omap_wdt_latency[] = {
Varadarajan, Charulathaf2ce6232010-09-23 20:02:42 +05301002 [0] = {
1003 .deactivate_func = omap_device_idle_hwmods,
1004 .activate_func = omap_device_enable_hwmods,
1005 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
1006 },
1007};
1008
1009static int __init omap_init_wdt(void)
1010{
1011 int id = -1;
1012 struct omap_device *od;
1013 struct omap_hwmod *oh;
1014 char *oh_name = "wd_timer2";
1015 char *dev_name = "omap_wdt";
1016
1017 if (!cpu_class_is_omap2())
1018 return 0;
1019
1020 oh = omap_hwmod_lookup(oh_name);
1021 if (!oh) {
1022 pr_err("Could not look up wd_timer%d hwmod\n", id);
1023 return -EINVAL;
1024 }
1025
1026 od = omap_device_build(dev_name, id, oh, NULL, 0,
1027 omap_wdt_latency,
1028 ARRAY_SIZE(omap_wdt_latency), 0);
1029 WARN(IS_ERR(od), "Cant build omap_device for %s:%s.\n",
1030 dev_name, oh->name);
1031 return 0;
1032}
1033subsys_initcall(omap_init_wdt);
1034#endif