blob: 8800486f946711460406a9bbc175c3afe5f61c40 [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>
Syed Rafiuddin59556762010-12-27 05:51:45 +000033#include <plat/omap4-keypad.h>
Tony Lindgren1dbae812005-11-10 14:26:51 +000034
Tony Lindgren4896e392009-12-11 16:16:32 -080035#include "mux.h"
Paul Walmsley4814ced2010-10-08 11:40:20 -060036#include "control.h"
Tony Lindgren4896e392009-12-11 16:16:32 -080037
Tony Lindgren828c7072009-03-23 18:23:49 -070038#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
Tony Lindgrenc40fae952006-12-07 13:58:10 -080039
Tony Lindgren828c7072009-03-23 18:23:49 -070040static struct resource cam_resources[] = {
Tony Lindgrenc40fae952006-12-07 13:58:10 -080041 {
Tony Lindgren828c7072009-03-23 18:23:49 -070042 .start = OMAP24XX_CAMERA_BASE,
43 .end = OMAP24XX_CAMERA_BASE + 0xfff,
44 .flags = IORESOURCE_MEM,
45 },
46 {
47 .start = INT_24XX_CAM_IRQ,
48 .flags = IORESOURCE_IRQ,
49 }
50};
51
52static struct platform_device omap_cam_device = {
53 .name = "omap24xxcam",
54 .id = -1,
55 .num_resources = ARRAY_SIZE(cam_resources),
56 .resource = cam_resources,
57};
58
59static inline void omap_init_camera(void)
60{
61 platform_device_register(&omap_cam_device);
62}
63
64#elif defined(CONFIG_VIDEO_OMAP3) || defined(CONFIG_VIDEO_OMAP3_MODULE)
65
66static struct resource omap3isp_resources[] = {
67 {
68 .start = OMAP3430_ISP_BASE,
69 .end = OMAP3430_ISP_END,
70 .flags = IORESOURCE_MEM,
71 },
72 {
73 .start = OMAP3430_ISP_CBUFF_BASE,
74 .end = OMAP3430_ISP_CBUFF_END,
75 .flags = IORESOURCE_MEM,
76 },
77 {
78 .start = OMAP3430_ISP_CCP2_BASE,
79 .end = OMAP3430_ISP_CCP2_END,
80 .flags = IORESOURCE_MEM,
81 },
82 {
83 .start = OMAP3430_ISP_CCDC_BASE,
84 .end = OMAP3430_ISP_CCDC_END,
85 .flags = IORESOURCE_MEM,
86 },
87 {
88 .start = OMAP3430_ISP_HIST_BASE,
89 .end = OMAP3430_ISP_HIST_END,
90 .flags = IORESOURCE_MEM,
91 },
92 {
93 .start = OMAP3430_ISP_H3A_BASE,
94 .end = OMAP3430_ISP_H3A_END,
95 .flags = IORESOURCE_MEM,
96 },
97 {
98 .start = OMAP3430_ISP_PREV_BASE,
99 .end = OMAP3430_ISP_PREV_END,
100 .flags = IORESOURCE_MEM,
101 },
102 {
103 .start = OMAP3430_ISP_RESZ_BASE,
104 .end = OMAP3430_ISP_RESZ_END,
105 .flags = IORESOURCE_MEM,
106 },
107 {
108 .start = OMAP3430_ISP_SBL_BASE,
109 .end = OMAP3430_ISP_SBL_END,
110 .flags = IORESOURCE_MEM,
111 },
112 {
113 .start = OMAP3430_ISP_CSI2A_BASE,
114 .end = OMAP3430_ISP_CSI2A_END,
115 .flags = IORESOURCE_MEM,
116 },
117 {
118 .start = OMAP3430_ISP_CSI2PHY_BASE,
119 .end = OMAP3430_ISP_CSI2PHY_END,
120 .flags = IORESOURCE_MEM,
121 },
122 {
123 .start = INT_34XX_CAM_IRQ,
124 .flags = IORESOURCE_IRQ,
125 }
126};
127
128static struct platform_device omap3isp_device = {
129 .name = "omap3isp",
130 .id = -1,
131 .num_resources = ARRAY_SIZE(omap3isp_resources),
132 .resource = omap3isp_resources,
133};
134
135static inline void omap_init_camera(void)
136{
137 platform_device_register(&omap3isp_device);
138}
139#else
140static inline void omap_init_camera(void)
141{
142}
143#endif
144
Syed Rafiuddin59556762010-12-27 05:51:45 +0000145struct omap_device_pm_latency omap_keyboard_latency[] = {
146 {
147 .deactivate_func = omap_device_idle_hwmods,
148 .activate_func = omap_device_enable_hwmods,
149 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
150 },
151};
152
153int __init omap4_keyboard_init(struct omap4_keypad_platform_data
154 *sdp4430_keypad_data)
155{
156 struct omap_device *od;
157 struct omap_hwmod *oh;
158 struct omap4_keypad_platform_data *keypad_data;
159 unsigned int id = -1;
160 char *oh_name = "kbd";
161 char *name = "omap4-keypad";
162
163 oh = omap_hwmod_lookup(oh_name);
164 if (!oh) {
165 pr_err("Could not look up %s\n", oh_name);
166 return -ENODEV;
167 }
168
169 keypad_data = sdp4430_keypad_data;
170
171 od = omap_device_build(name, id, oh, keypad_data,
172 sizeof(struct omap4_keypad_platform_data),
173 omap_keyboard_latency,
174 ARRAY_SIZE(omap_keyboard_latency), 0);
175
176 if (IS_ERR(od)) {
177 WARN(1, "Cant build omap_device for %s:%s.\n",
178 name, oh->name);
179 return PTR_ERR(od);
180 }
181
182 return 0;
183}
184
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700185#if defined(CONFIG_OMAP_MBOX_FWK) || defined(CONFIG_OMAP_MBOX_FWK_MODULE)
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800186
C A Subramaniam454bf342009-11-22 10:11:18 -0800187#define MBOX_REG_SIZE 0x120
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700188
C A Subramaniam454bf342009-11-22 10:11:18 -0800189#ifdef CONFIG_ARCH_OMAP2
Tony Lindgrend10f2b62010-02-12 12:26:47 -0800190static struct resource omap2_mbox_resources[] = {
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800191 {
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700192 .start = OMAP24XX_MAILBOX_BASE,
193 .end = OMAP24XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800194 .flags = IORESOURCE_MEM,
195 },
196 {
197 .start = INT_24XX_MAIL_U0_MPU,
198 .flags = IORESOURCE_IRQ,
Felipe Contreras1f2c4df2010-06-11 15:51:44 +0000199 .name = "dsp",
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800200 },
201 {
202 .start = INT_24XX_MAIL_U3_MPU,
203 .flags = IORESOURCE_IRQ,
Felipe Contreras1f2c4df2010-06-11 15:51:44 +0000204 .name = "iva",
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800205 },
206};
Tony Lindgrend10f2b62010-02-12 12:26:47 -0800207static int omap2_mbox_resources_sz = ARRAY_SIZE(omap2_mbox_resources);
208#else
209#define omap2_mbox_resources NULL
210#define omap2_mbox_resources_sz 0
C A Subramaniam454bf342009-11-22 10:11:18 -0800211#endif
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800212
C A Subramaniam454bf342009-11-22 10:11:18 -0800213#ifdef CONFIG_ARCH_OMAP3
Tony Lindgrend10f2b62010-02-12 12:26:47 -0800214static struct resource omap3_mbox_resources[] = {
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700215 {
216 .start = OMAP34XX_MAILBOX_BASE,
217 .end = OMAP34XX_MAILBOX_BASE + MBOX_REG_SIZE - 1,
218 .flags = IORESOURCE_MEM,
219 },
220 {
221 .start = INT_24XX_MAIL_U0_MPU,
222 .flags = IORESOURCE_IRQ,
Felipe Contreras1f2c4df2010-06-11 15:51:44 +0000223 .name = "dsp",
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700224 },
225};
Tony Lindgrend10f2b62010-02-12 12:26:47 -0800226static int omap3_mbox_resources_sz = ARRAY_SIZE(omap3_mbox_resources);
227#else
228#define omap3_mbox_resources NULL
229#define omap3_mbox_resources_sz 0
C A Subramaniam454bf342009-11-22 10:11:18 -0800230#endif
231
232#ifdef CONFIG_ARCH_OMAP4
233
234#define OMAP4_MBOX_REG_SIZE 0x130
Tony Lindgrend10f2b62010-02-12 12:26:47 -0800235static struct resource omap4_mbox_resources[] = {
C A Subramaniam454bf342009-11-22 10:11:18 -0800236 {
237 .start = OMAP44XX_MAILBOX_BASE,
238 .end = OMAP44XX_MAILBOX_BASE +
239 OMAP4_MBOX_REG_SIZE - 1,
240 .flags = IORESOURCE_MEM,
241 },
242 {
Santosh Shilimkar5772ca72010-02-18 03:14:12 +0530243 .start = OMAP44XX_IRQ_MAIL_U0,
C A Subramaniam454bf342009-11-22 10:11:18 -0800244 .flags = IORESOURCE_IRQ,
Felipe Contreras1f2c4df2010-06-11 15:51:44 +0000245 .name = "mbox",
C A Subramaniam454bf342009-11-22 10:11:18 -0800246 },
247};
Tony Lindgrend10f2b62010-02-12 12:26:47 -0800248static int omap4_mbox_resources_sz = ARRAY_SIZE(omap4_mbox_resources);
249#else
250#define omap4_mbox_resources NULL
251#define omap4_mbox_resources_sz 0
C A Subramaniam454bf342009-11-22 10:11:18 -0800252#endif
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700253
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800254static struct platform_device mbox_device = {
Felipe Contrerasd7427092010-06-11 15:51:48 +0000255 .name = "omap-mailbox",
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800256 .id = -1,
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800257};
258
259static inline void omap_init_mbox(void)
260{
Tony Lindgrend10f2b62010-02-12 12:26:47 -0800261 if (cpu_is_omap24xx()) {
262 mbox_device.resource = omap2_mbox_resources;
263 mbox_device.num_resources = omap2_mbox_resources_sz;
264 } else if (cpu_is_omap34xx()) {
265 mbox_device.resource = omap3_mbox_resources;
266 mbox_device.num_resources = omap3_mbox_resources_sz;
267 } else if (cpu_is_omap44xx()) {
268 mbox_device.resource = omap4_mbox_resources;
269 mbox_device.num_resources = omap4_mbox_resources_sz;
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700270 } else {
271 pr_err("%s: platform not supported\n", __func__);
272 return;
273 }
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800274 platform_device_register(&mbox_device);
275}
276#else
277static inline void omap_init_mbox(void) { }
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700278#endif /* CONFIG_OMAP_MBOX_FWK */
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800279
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100280static inline void omap_init_sti(void) {}
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100281
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000282#if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
283
284static struct platform_device omap_pcm = {
285 .name = "omap-pcm-audio",
286 .id = -1,
287};
288
289/*
290 * OMAP2420 has 2 McBSP ports
291 * OMAP2430 has 5 McBSP ports
292 * OMAP3 has 5 McBSP ports
293 * OMAP4 has 4 McBSP ports
294 */
295OMAP_MCBSP_PLATFORM_DEVICE(1);
296OMAP_MCBSP_PLATFORM_DEVICE(2);
297OMAP_MCBSP_PLATFORM_DEVICE(3);
298OMAP_MCBSP_PLATFORM_DEVICE(4);
299OMAP_MCBSP_PLATFORM_DEVICE(5);
300
301static void omap_init_audio(void)
302{
303 platform_device_register(&omap_mcbsp1);
304 platform_device_register(&omap_mcbsp2);
305 if (cpu_is_omap243x() || cpu_is_omap34xx() || cpu_is_omap44xx()) {
306 platform_device_register(&omap_mcbsp3);
307 platform_device_register(&omap_mcbsp4);
308 }
309 if (cpu_is_omap243x() || cpu_is_omap34xx())
310 platform_device_register(&omap_mcbsp5);
311
312 platform_device_register(&omap_pcm);
313}
314
315#else
316static inline void omap_init_audio(void) {}
317#endif
318
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300319#if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700320
Tony Lindgrence491cf2009-10-20 09:40:47 -0700321#include <plat/mcspi.h>
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700322
323#define OMAP2_MCSPI1_BASE 0x48098000
324#define OMAP2_MCSPI2_BASE 0x4809a000
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300325#define OMAP2_MCSPI3_BASE 0x480b8000
326#define OMAP2_MCSPI4_BASE 0x480ba000
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700327
Syed Rafiuddin7869c0b2009-09-22 16:46:18 -0700328#define OMAP4_MCSPI1_BASE 0x48098100
329#define OMAP4_MCSPI2_BASE 0x4809a100
330#define OMAP4_MCSPI3_BASE 0x480b8100
331#define OMAP4_MCSPI4_BASE 0x480ba100
332
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700333static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700334 .num_cs = 4,
335};
336
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800337static struct resource omap2_mcspi1_resources[] = {
338 {
339 .start = OMAP2_MCSPI1_BASE,
340 .end = OMAP2_MCSPI1_BASE + 0xff,
341 .flags = IORESOURCE_MEM,
342 },
343};
344
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300345static struct platform_device omap2_mcspi1 = {
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700346 .name = "omap2_mcspi",
347 .id = 1,
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800348 .num_resources = ARRAY_SIZE(omap2_mcspi1_resources),
349 .resource = omap2_mcspi1_resources,
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700350 .dev = {
351 .platform_data = &omap2_mcspi1_config,
352 },
353};
354
355static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700356 .num_cs = 2,
357};
358
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800359static struct resource omap2_mcspi2_resources[] = {
360 {
361 .start = OMAP2_MCSPI2_BASE,
362 .end = OMAP2_MCSPI2_BASE + 0xff,
363 .flags = IORESOURCE_MEM,
364 },
365};
366
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300367static struct platform_device omap2_mcspi2 = {
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700368 .name = "omap2_mcspi",
369 .id = 2,
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800370 .num_resources = ARRAY_SIZE(omap2_mcspi2_resources),
371 .resource = omap2_mcspi2_resources,
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700372 .dev = {
373 .platform_data = &omap2_mcspi2_config,
374 },
375};
376
Tony Lindgren59b479e2011-01-27 16:39:40 -0800377#if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
Syed Rafiuddin7869c0b2009-09-22 16:46:18 -0700378 defined(CONFIG_ARCH_OMAP4)
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300379static struct omap2_mcspi_platform_config omap2_mcspi3_config = {
380 .num_cs = 2,
381};
382
383static struct resource omap2_mcspi3_resources[] = {
384 {
385 .start = OMAP2_MCSPI3_BASE,
386 .end = OMAP2_MCSPI3_BASE + 0xff,
387 .flags = IORESOURCE_MEM,
388 },
389};
390
391static struct platform_device omap2_mcspi3 = {
392 .name = "omap2_mcspi",
393 .id = 3,
394 .num_resources = ARRAY_SIZE(omap2_mcspi3_resources),
395 .resource = omap2_mcspi3_resources,
396 .dev = {
397 .platform_data = &omap2_mcspi3_config,
398 },
399};
400#endif
401
Syed Rafiuddin7869c0b2009-09-22 16:46:18 -0700402#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300403static struct omap2_mcspi_platform_config omap2_mcspi4_config = {
404 .num_cs = 1,
405};
406
407static struct resource omap2_mcspi4_resources[] = {
408 {
409 .start = OMAP2_MCSPI4_BASE,
410 .end = OMAP2_MCSPI4_BASE + 0xff,
411 .flags = IORESOURCE_MEM,
412 },
413};
414
415static struct platform_device omap2_mcspi4 = {
416 .name = "omap2_mcspi",
417 .id = 4,
418 .num_resources = ARRAY_SIZE(omap2_mcspi4_resources),
419 .resource = omap2_mcspi4_resources,
420 .dev = {
421 .platform_data = &omap2_mcspi4_config,
422 },
423};
424#endif
425
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700426#ifdef CONFIG_ARCH_OMAP4
427static inline void omap4_mcspi_fixup(void)
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700428{
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700429 omap2_mcspi1_resources[0].start = OMAP4_MCSPI1_BASE;
430 omap2_mcspi1_resources[0].end = OMAP4_MCSPI1_BASE + 0xff;
431 omap2_mcspi2_resources[0].start = OMAP4_MCSPI2_BASE;
432 omap2_mcspi2_resources[0].end = OMAP4_MCSPI2_BASE + 0xff;
433 omap2_mcspi3_resources[0].start = OMAP4_MCSPI3_BASE;
434 omap2_mcspi3_resources[0].end = OMAP4_MCSPI3_BASE + 0xff;
435 omap2_mcspi4_resources[0].start = OMAP4_MCSPI4_BASE;
436 omap2_mcspi4_resources[0].end = OMAP4_MCSPI4_BASE + 0xff;
437}
438#else
439static inline void omap4_mcspi_fixup(void)
440{
441}
442#endif
443
Tony Lindgren59b479e2011-01-27 16:39:40 -0800444#if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_ARCH_OMAP3) || \
Syed Rafiuddin7869c0b2009-09-22 16:46:18 -0700445 defined(CONFIG_ARCH_OMAP4)
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700446static inline void omap2_mcspi3_init(void)
447{
448 platform_device_register(&omap2_mcspi3);
449}
450#else
451static inline void omap2_mcspi3_init(void)
452{
453}
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300454#endif
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700455
Syed Rafiuddin7869c0b2009-09-22 16:46:18 -0700456#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700457static inline void omap2_mcspi4_init(void)
458{
459 platform_device_register(&omap2_mcspi4);
460}
461#else
462static inline void omap2_mcspi4_init(void)
463{
464}
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300465#endif
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700466
467static void omap_init_mcspi(void)
468{
469 if (cpu_is_omap44xx())
470 omap4_mcspi_fixup();
471
472 platform_device_register(&omap2_mcspi1);
473 platform_device_register(&omap2_mcspi2);
474
475 if (cpu_is_omap2430() || cpu_is_omap343x() || cpu_is_omap44xx())
476 omap2_mcspi3_init();
477
478 if (cpu_is_omap343x() || cpu_is_omap44xx())
479 omap2_mcspi4_init();
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700480}
481
482#else
483static inline void omap_init_mcspi(void) {}
484#endif
485
Will Deacon88341332010-04-09 13:54:43 +0100486static struct resource omap2_pmu_resource = {
487 .start = 3,
488 .end = 3,
489 .flags = IORESOURCE_IRQ,
490};
491
492static struct resource omap3_pmu_resource = {
493 .start = INT_34XX_BENCH_MPU_EMUL,
494 .end = INT_34XX_BENCH_MPU_EMUL,
495 .flags = IORESOURCE_IRQ,
496};
497
498static struct platform_device omap_pmu_device = {
499 .name = "arm-pmu",
500 .id = ARM_PMU_DEVICE_CPU,
501 .num_resources = 1,
502};
503
504static void omap_init_pmu(void)
505{
506 if (cpu_is_omap24xx())
507 omap_pmu_device.resource = &omap2_pmu_resource;
508 else if (cpu_is_omap34xx())
509 omap_pmu_device.resource = &omap3_pmu_resource;
510 else
511 return;
512
513 platform_device_register(&omap_pmu_device);
514}
515
516
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800517#if defined(CONFIG_CRYPTO_DEV_OMAP_SHAM) || defined(CONFIG_CRYPTO_DEV_OMAP_SHAM_MODULE)
518
Dmitry Kasatkinedc774e2010-05-14 14:45:08 +1000519#ifdef CONFIG_ARCH_OMAP2
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800520static struct resource omap2_sham_resources[] = {
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300521 {
522 .start = OMAP24XX_SEC_SHA1MD5_BASE,
523 .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64,
524 .flags = IORESOURCE_MEM,
525 },
526 {
527 .start = INT_24XX_SHA1MD5,
528 .flags = IORESOURCE_IRQ,
529 }
530};
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800531static int omap2_sham_resources_sz = ARRAY_SIZE(omap2_sham_resources);
532#else
533#define omap2_sham_resources NULL
534#define omap2_sham_resources_sz 0
535#endif
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300536
Dmitry Kasatkinedc774e2010-05-14 14:45:08 +1000537#ifdef CONFIG_ARCH_OMAP3
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800538static struct resource omap3_sham_resources[] = {
539 {
540 .start = OMAP34XX_SEC_SHA1MD5_BASE,
541 .end = OMAP34XX_SEC_SHA1MD5_BASE + 0x64,
542 .flags = IORESOURCE_MEM,
543 },
544 {
545 .start = INT_34XX_SHA1MD52_IRQ,
546 .flags = IORESOURCE_IRQ,
547 },
548 {
549 .start = OMAP34XX_DMA_SHA1MD5_RX,
550 .flags = IORESOURCE_DMA,
551 }
552};
553static int omap3_sham_resources_sz = ARRAY_SIZE(omap3_sham_resources);
554#else
555#define omap3_sham_resources NULL
556#define omap3_sham_resources_sz 0
557#endif
558
559static struct platform_device sham_device = {
560 .name = "omap-sham",
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300561 .id = -1,
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300562};
563
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800564static void omap_init_sham(void)
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300565{
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800566 if (cpu_is_omap24xx()) {
567 sham_device.resource = omap2_sham_resources;
568 sham_device.num_resources = omap2_sham_resources_sz;
569 } else if (cpu_is_omap34xx()) {
570 sham_device.resource = omap3_sham_resources;
571 sham_device.num_resources = omap3_sham_resources_sz;
572 } else {
573 pr_err("%s: platform not supported\n", __func__);
574 return;
575 }
576 platform_device_register(&sham_device);
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300577}
578#else
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +0800579static inline void omap_init_sham(void) { }
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300580#endif
581
Dmitry Kasatkinb744c672010-09-03 19:13:55 +0800582#if defined(CONFIG_CRYPTO_DEV_OMAP_AES) || defined(CONFIG_CRYPTO_DEV_OMAP_AES_MODULE)
583
Dmitry Kasatkin82a0c142010-08-20 13:44:46 +0000584#ifdef CONFIG_ARCH_OMAP2
Dmitry Kasatkinb744c672010-09-03 19:13:55 +0800585static struct resource omap2_aes_resources[] = {
586 {
587 .start = OMAP24XX_SEC_AES_BASE,
588 .end = OMAP24XX_SEC_AES_BASE + 0x4C,
589 .flags = IORESOURCE_MEM,
590 },
591 {
592 .start = OMAP24XX_DMA_AES_TX,
593 .flags = IORESOURCE_DMA,
594 },
595 {
596 .start = OMAP24XX_DMA_AES_RX,
597 .flags = IORESOURCE_DMA,
598 }
599};
600static int omap2_aes_resources_sz = ARRAY_SIZE(omap2_aes_resources);
601#else
602#define omap2_aes_resources NULL
603#define omap2_aes_resources_sz 0
604#endif
605
Dmitry Kasatkin82a0c142010-08-20 13:44:46 +0000606#ifdef CONFIG_ARCH_OMAP3
Dmitry Kasatkinb744c672010-09-03 19:13:55 +0800607static struct resource omap3_aes_resources[] = {
608 {
609 .start = OMAP34XX_SEC_AES_BASE,
610 .end = OMAP34XX_SEC_AES_BASE + 0x4C,
611 .flags = IORESOURCE_MEM,
612 },
613 {
614 .start = OMAP34XX_DMA_AES2_TX,
615 .flags = IORESOURCE_DMA,
616 },
617 {
618 .start = OMAP34XX_DMA_AES2_RX,
619 .flags = IORESOURCE_DMA,
620 }
621};
622static int omap3_aes_resources_sz = ARRAY_SIZE(omap3_aes_resources);
623#else
624#define omap3_aes_resources NULL
625#define omap3_aes_resources_sz 0
626#endif
627
628static struct platform_device aes_device = {
629 .name = "omap-aes",
630 .id = -1,
631};
632
633static void omap_init_aes(void)
634{
635 if (cpu_is_omap24xx()) {
636 aes_device.resource = omap2_aes_resources;
637 aes_device.num_resources = omap2_aes_resources_sz;
638 } else if (cpu_is_omap34xx()) {
639 aes_device.resource = omap3_aes_resources;
640 aes_device.num_resources = omap3_aes_resources_sz;
641 } else {
642 pr_err("%s: platform not supported\n", __func__);
643 return;
644 }
645 platform_device_register(&aes_device);
646}
647
648#else
649static inline void omap_init_aes(void) { }
650#endif
651
Tony Lindgrend8874662008-12-10 17:37:16 -0800652/*-------------------------------------------------------------------------*/
653
kishore kadiyala82cf8182009-09-22 16:45:25 -0700654#if defined(CONFIG_ARCH_OMAP3) || defined(CONFIG_ARCH_OMAP4)
Kevin Hilman917fa282008-12-10 17:37:17 -0800655
656#define MMCHS_SYSCONFIG 0x0010
657#define MMCHS_SYSCONFIG_SWRESET (1 << 1)
658#define MMCHS_SYSSTATUS 0x0014
659#define MMCHS_SYSSTATUS_RESETDONE (1 << 0)
660
661static struct platform_device dummy_pdev = {
662 .dev = {
663 .bus = &platform_bus_type,
664 },
665};
666
667/**
668 * omap_hsmmc_reset() - Full reset of each HS-MMC controller
669 *
670 * Ensure that each MMC controller is fully reset. Controllers
671 * left in an unknown state (by bootloader) may prevent retention
672 * or OFF-mode. This is especially important in cases where the
673 * MMC driver is not enabled, _or_ built as a module.
674 *
675 * In order for reset to work, interface, functional and debounce
676 * clocks must be enabled. The debounce clock comes from func_32k_clk
677 * and is not under SW control, so we only enable i- and f-clocks.
678 **/
679static void __init omap_hsmmc_reset(void)
680{
Tony Lindgren4323e9f2010-02-12 12:26:48 -0800681 u32 i, nr_controllers;
Aaro Koskinen434c23a2010-12-20 18:48:15 -0800682 struct clk *iclk, *fclk;
Tony Lindgren4323e9f2010-02-12 12:26:48 -0800683
684 if (cpu_is_omap242x())
685 return;
686
687 nr_controllers = cpu_is_omap44xx() ? OMAP44XX_NR_MMC :
kishore kadiyala82cf8182009-09-22 16:45:25 -0700688 (cpu_is_omap34xx() ? OMAP34XX_NR_MMC : OMAP24XX_NR_MMC);
Kevin Hilman917fa282008-12-10 17:37:17 -0800689
690 for (i = 0; i < nr_controllers; i++) {
691 u32 v, base = 0;
Kevin Hilman917fa282008-12-10 17:37:17 -0800692 struct device *dev = &dummy_pdev.dev;
693
694 switch (i) {
695 case 0:
696 base = OMAP2_MMC1_BASE;
697 break;
698 case 1:
699 base = OMAP2_MMC2_BASE;
700 break;
701 case 2:
702 base = OMAP3_MMC3_BASE;
703 break;
kishore kadiyala82cf8182009-09-22 16:45:25 -0700704 case 3:
705 if (!cpu_is_omap44xx())
706 return;
707 base = OMAP4_MMC4_BASE;
708 break;
709 case 4:
710 if (!cpu_is_omap44xx())
711 return;
712 base = OMAP4_MMC5_BASE;
713 break;
Kevin Hilman917fa282008-12-10 17:37:17 -0800714 }
715
kishore kadiyala82cf8182009-09-22 16:45:25 -0700716 if (cpu_is_omap44xx())
717 base += OMAP4_MMC_REG_OFFSET;
718
Kevin Hilman917fa282008-12-10 17:37:17 -0800719 dummy_pdev.id = i;
Russell King1e98ffa2009-01-19 18:56:17 +0000720 dev_set_name(&dummy_pdev.dev, "mmci-omap-hs.%d", i);
Russell King6f7607c2009-01-28 10:22:50 +0000721 iclk = clk_get(dev, "ick");
Aaro Koskinen434c23a2010-12-20 18:48:15 -0800722 if (IS_ERR(iclk))
723 goto err1;
724 if (clk_enable(iclk))
725 goto err2;
Kevin Hilman917fa282008-12-10 17:37:17 -0800726
Russell King6f7607c2009-01-28 10:22:50 +0000727 fclk = clk_get(dev, "fck");
Aaro Koskinen434c23a2010-12-20 18:48:15 -0800728 if (IS_ERR(fclk))
729 goto err3;
730 if (clk_enable(fclk))
731 goto err4;
Kevin Hilman917fa282008-12-10 17:37:17 -0800732
733 omap_writel(MMCHS_SYSCONFIG_SWRESET, base + MMCHS_SYSCONFIG);
734 v = omap_readl(base + MMCHS_SYSSTATUS);
735 while (!(omap_readl(base + MMCHS_SYSSTATUS) &
736 MMCHS_SYSSTATUS_RESETDONE))
737 cpu_relax();
738
Aaro Koskinen434c23a2010-12-20 18:48:15 -0800739 clk_disable(fclk);
740 clk_put(fclk);
741 clk_disable(iclk);
742 clk_put(iclk);
Kevin Hilman917fa282008-12-10 17:37:17 -0800743 }
Aaro Koskinen434c23a2010-12-20 18:48:15 -0800744 return;
745
746err4:
747 clk_put(fclk);
748err3:
749 clk_disable(iclk);
750err2:
751 clk_put(iclk);
752err1:
753 printk(KERN_WARNING "%s: Unable to enable clocks for MMC%d, "
754 "cannot reset.\n", __func__, i);
Kevin Hilman917fa282008-12-10 17:37:17 -0800755}
756#else
757static inline void omap_hsmmc_reset(void) {}
758#endif
759
Tony Lindgrend8874662008-12-10 17:37:16 -0800760#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
761 defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
762
763static inline void omap2_mmc_mux(struct omap_mmc_platform_data *mmc_controller,
764 int controller_nr)
765{
stanley.miaoed8303fc2010-05-13 12:39:30 +0000766 if ((mmc_controller->slots[0].switch_pin > 0) && \
767 (mmc_controller->slots[0].switch_pin < OMAP_MAX_GPIO_LINES))
768 omap_mux_init_gpio(mmc_controller->slots[0].switch_pin,
769 OMAP_PIN_INPUT_PULLUP);
770 if ((mmc_controller->slots[0].gpio_wp > 0) && \
771 (mmc_controller->slots[0].gpio_wp < OMAP_MAX_GPIO_LINES))
772 omap_mux_init_gpio(mmc_controller->slots[0].gpio_wp,
773 OMAP_PIN_INPUT_PULLUP);
774
Tony Lindgrend8874662008-12-10 17:37:16 -0800775 if (cpu_is_omap2420() && controller_nr == 0) {
Tony Lindgrenf99bf162010-07-05 16:31:40 +0300776 omap_mux_init_signal("sdmmc_cmd", 0);
777 omap_mux_init_signal("sdmmc_clki", 0);
778 omap_mux_init_signal("sdmmc_clko", 0);
779 omap_mux_init_signal("sdmmc_dat0", 0);
780 omap_mux_init_signal("sdmmc_dat_dir0", 0);
781 omap_mux_init_signal("sdmmc_cmd_dir", 0);
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000782 if (mmc_controller->slots[0].caps & MMC_CAP_4_BIT_DATA) {
Tony Lindgrenf99bf162010-07-05 16:31:40 +0300783 omap_mux_init_signal("sdmmc_dat1", 0);
784 omap_mux_init_signal("sdmmc_dat2", 0);
785 omap_mux_init_signal("sdmmc_dat3", 0);
786 omap_mux_init_signal("sdmmc_dat_dir1", 0);
787 omap_mux_init_signal("sdmmc_dat_dir2", 0);
788 omap_mux_init_signal("sdmmc_dat_dir3", 0);
Tony Lindgrend8874662008-12-10 17:37:16 -0800789 }
790
791 /*
792 * Use internal loop-back in MMC/SDIO Module Input Clock
793 * selection
794 */
795 if (mmc_controller->slots[0].internal_clock) {
796 u32 v = omap_ctrl_readl(OMAP2_CONTROL_DEVCONF0);
797 v |= (1 << 24);
798 omap_ctrl_writel(v, OMAP2_CONTROL_DEVCONF0);
799 }
800 }
Vikram Pandita57b9daa2009-08-28 11:24:11 -0700801
Madhu4596d142009-11-22 10:11:06 -0800802 if (cpu_is_omap34xx()) {
Vikram Pandita57b9daa2009-08-28 11:24:11 -0700803 if (controller_nr == 0) {
Tony Lindgren4896e392009-12-11 16:16:32 -0800804 omap_mux_init_signal("sdmmc1_clk",
805 OMAP_PIN_INPUT_PULLUP);
806 omap_mux_init_signal("sdmmc1_cmd",
807 OMAP_PIN_INPUT_PULLUP);
808 omap_mux_init_signal("sdmmc1_dat0",
809 OMAP_PIN_INPUT_PULLUP);
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000810 if (mmc_controller->slots[0].caps &
811 (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
Tony Lindgren4896e392009-12-11 16:16:32 -0800812 omap_mux_init_signal("sdmmc1_dat1",
813 OMAP_PIN_INPUT_PULLUP);
814 omap_mux_init_signal("sdmmc1_dat2",
815 OMAP_PIN_INPUT_PULLUP);
816 omap_mux_init_signal("sdmmc1_dat3",
817 OMAP_PIN_INPUT_PULLUP);
Vikram Pandita57b9daa2009-08-28 11:24:11 -0700818 }
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000819 if (mmc_controller->slots[0].caps &
820 MMC_CAP_8_BIT_DATA) {
Tony Lindgren4896e392009-12-11 16:16:32 -0800821 omap_mux_init_signal("sdmmc1_dat4",
822 OMAP_PIN_INPUT_PULLUP);
823 omap_mux_init_signal("sdmmc1_dat5",
824 OMAP_PIN_INPUT_PULLUP);
825 omap_mux_init_signal("sdmmc1_dat6",
826 OMAP_PIN_INPUT_PULLUP);
827 omap_mux_init_signal("sdmmc1_dat7",
828 OMAP_PIN_INPUT_PULLUP);
Vikram Pandita57b9daa2009-08-28 11:24:11 -0700829 }
830 }
831 if (controller_nr == 1) {
832 /* MMC2 */
Tony Lindgren4896e392009-12-11 16:16:32 -0800833 omap_mux_init_signal("sdmmc2_clk",
834 OMAP_PIN_INPUT_PULLUP);
835 omap_mux_init_signal("sdmmc2_cmd",
836 OMAP_PIN_INPUT_PULLUP);
837 omap_mux_init_signal("sdmmc2_dat0",
838 OMAP_PIN_INPUT_PULLUP);
Vikram Pandita57b9daa2009-08-28 11:24:11 -0700839
840 /*
841 * For 8 wire configurations, Lines DAT4, 5, 6 and 7 need to be muxed
842 * in the board-*.c files
843 */
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000844 if (mmc_controller->slots[0].caps &
845 (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA)) {
Tony Lindgren4896e392009-12-11 16:16:32 -0800846 omap_mux_init_signal("sdmmc2_dat1",
847 OMAP_PIN_INPUT_PULLUP);
848 omap_mux_init_signal("sdmmc2_dat2",
849 OMAP_PIN_INPUT_PULLUP);
850 omap_mux_init_signal("sdmmc2_dat3",
851 OMAP_PIN_INPUT_PULLUP);
Vikram Pandita57b9daa2009-08-28 11:24:11 -0700852 }
Sukumar Ghorai3a638332010-09-15 14:49:23 +0000853 if (mmc_controller->slots[0].caps &
854 MMC_CAP_8_BIT_DATA) {
Tony Lindgren4896e392009-12-11 16:16:32 -0800855 omap_mux_init_signal("sdmmc2_dat4.sdmmc2_dat4",
856 OMAP_PIN_INPUT_PULLUP);
857 omap_mux_init_signal("sdmmc2_dat5.sdmmc2_dat5",
858 OMAP_PIN_INPUT_PULLUP);
859 omap_mux_init_signal("sdmmc2_dat6.sdmmc2_dat6",
860 OMAP_PIN_INPUT_PULLUP);
861 omap_mux_init_signal("sdmmc2_dat7.sdmmc2_dat7",
862 OMAP_PIN_INPUT_PULLUP);
Madhu46792322009-11-22 10:11:08 -0800863 }
Vikram Pandita57b9daa2009-08-28 11:24:11 -0700864 }
865
866 /*
867 * For MMC3 the pins need to be muxed in the board-*.c files
868 */
869 }
Tony Lindgrend8874662008-12-10 17:37:16 -0800870}
871
872void __init omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
873 int nr_controllers)
874{
875 int i;
Tony Lindgren0dffb5c2009-01-29 08:57:16 -0800876 char *name;
Tony Lindgrend8874662008-12-10 17:37:16 -0800877
878 for (i = 0; i < nr_controllers; i++) {
879 unsigned long base, size;
880 unsigned int irq = 0;
881
882 if (!mmc_data[i])
883 continue;
884
885 omap2_mmc_mux(mmc_data[i], i);
886
887 switch (i) {
888 case 0:
889 base = OMAP2_MMC1_BASE;
890 irq = INT_24XX_MMC_IRQ;
891 break;
892 case 1:
893 base = OMAP2_MMC2_BASE;
894 irq = INT_24XX_MMC2_IRQ;
895 break;
896 case 2:
kishore kadiyala82cf8182009-09-22 16:45:25 -0700897 if (!cpu_is_omap44xx() && !cpu_is_omap34xx())
Tony Lindgrend8874662008-12-10 17:37:16 -0800898 return;
899 base = OMAP3_MMC3_BASE;
900 irq = INT_34XX_MMC3_IRQ;
901 break;
kishore kadiyala82cf8182009-09-22 16:45:25 -0700902 case 3:
903 if (!cpu_is_omap44xx())
904 return;
kishore kadiyala91a0b082010-10-01 16:35:28 -0700905 base = OMAP4_MMC4_BASE;
Santosh Shilimkar5772ca72010-02-18 03:14:12 +0530906 irq = OMAP44XX_IRQ_MMC4;
kishore kadiyala82cf8182009-09-22 16:45:25 -0700907 break;
908 case 4:
909 if (!cpu_is_omap44xx())
910 return;
kishore kadiyala91a0b082010-10-01 16:35:28 -0700911 base = OMAP4_MMC5_BASE;
kishore kadiyala9df76b72010-04-21 18:19:37 +0000912 irq = OMAP44XX_IRQ_MMC5;
kishore kadiyala82cf8182009-09-22 16:45:25 -0700913 break;
Tony Lindgrend8874662008-12-10 17:37:16 -0800914 default:
915 continue;
916 }
917
Tony Lindgren0dffb5c2009-01-29 08:57:16 -0800918 if (cpu_is_omap2420()) {
Tony Lindgrend8874662008-12-10 17:37:16 -0800919 size = OMAP2420_MMC_SIZE;
Tony Lindgren0dffb5c2009-01-29 08:57:16 -0800920 name = "mmci-omap";
kishore kadiyala82cf8182009-09-22 16:45:25 -0700921 } else if (cpu_is_omap44xx()) {
kishore kadiyala91a0b082010-10-01 16:35:28 -0700922 if (i < 3)
Santosh Shilimkar5772ca72010-02-18 03:14:12 +0530923 irq += OMAP44XX_IRQ_GIC_START;
kishore kadiyala82cf8182009-09-22 16:45:25 -0700924 size = OMAP4_HSMMC_SIZE;
925 name = "mmci-omap-hs";
Tony Lindgren0dffb5c2009-01-29 08:57:16 -0800926 } else {
kishore kadiyala82cf8182009-09-22 16:45:25 -0700927 size = OMAP3_HSMMC_SIZE;
Tony Lindgren0dffb5c2009-01-29 08:57:16 -0800928 name = "mmci-omap-hs";
929 }
930 omap_mmc_add(name, i, base, size, irq, mmc_data[i]);
Tony Lindgrend8874662008-12-10 17:37:16 -0800931 };
932}
933
934#endif
935
936/*-------------------------------------------------------------------------*/
937
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300938#if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
Tony Lindgren59b479e2011-01-27 16:39:40 -0800939#if defined(CONFIG_SOC_OMAP2430) || defined(CONFIG_SOC_OMAP3430)
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300940#define OMAP_HDQ_BASE 0x480B2000
941#endif
942static struct resource omap_hdq_resources[] = {
943 {
944 .start = OMAP_HDQ_BASE,
945 .end = OMAP_HDQ_BASE + 0x1C,
946 .flags = IORESOURCE_MEM,
947 },
948 {
949 .start = INT_24XX_HDQ_IRQ,
950 .flags = IORESOURCE_IRQ,
951 },
952};
953static struct platform_device omap_hdq_dev = {
954 .name = "omap_hdq",
955 .id = 0,
956 .dev = {
957 .platform_data = NULL,
958 },
959 .num_resources = ARRAY_SIZE(omap_hdq_resources),
960 .resource = omap_hdq_resources,
961};
962static inline void omap_hdq_init(void)
963{
964 (void) platform_device_register(&omap_hdq_dev);
965}
966#else
967static inline void omap_hdq_init(void) {}
968#endif
969
Vaibhav Hiremathb2273582010-05-10 14:29:14 -0700970/*---------------------------------------------------------------------------*/
971
972#if defined(CONFIG_VIDEO_OMAP2_VOUT) || \
973 defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE)
974#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
975static struct resource omap_vout_resource[3 - CONFIG_FB_OMAP2_NUM_FBS] = {
976};
977#else
978static struct resource omap_vout_resource[2] = {
979};
980#endif
981
982static struct platform_device omap_vout_device = {
983 .name = "omap_vout",
984 .num_resources = ARRAY_SIZE(omap_vout_resource),
985 .resource = &omap_vout_resource[0],
986 .id = -1,
987};
988static void omap_init_vout(void)
989{
990 if (platform_device_register(&omap_vout_device) < 0)
991 printk(KERN_ERR "Unable to register OMAP-VOUT device\n");
992}
993#else
994static inline void omap_init_vout(void) {}
995#endif
996
Tony Lindgren1dbae812005-11-10 14:26:51 +0000997/*-------------------------------------------------------------------------*/
998
999static int __init omap2_init_devices(void)
1000{
Paul Walmsley81fbc5ef2010-12-21 19:56:17 -07001001 /*
1002 * please keep these calls, and their implementations above,
Tony Lindgren1dbae812005-11-10 14:26:51 +00001003 * in alphabetical order so they're easier to sort through.
1004 */
Kevin Hilman917fa282008-12-10 17:37:17 -08001005 omap_hsmmc_reset();
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +00001006 omap_init_audio();
Tony Lindgren828c7072009-03-23 18:23:49 -07001007 omap_init_camera();
Tony Lindgrenc40fae952006-12-07 13:58:10 -08001008 omap_init_mbox();
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -07001009 omap_init_mcspi();
Will Deacon88341332010-04-09 13:54:43 +01001010 omap_init_pmu();
Tony Lindgren646e3ed2008-10-06 15:49:36 +03001011 omap_hdq_init();
Tony Lindgren9b6553c2006-04-02 17:46:30 +01001012 omap_init_sti();
Dmitry Kasatkinee5500c2010-05-03 11:10:03 +08001013 omap_init_sham();
Dmitry Kasatkinb744c672010-09-03 19:13:55 +08001014 omap_init_aes();
Vaibhav Hiremathb2273582010-05-10 14:29:14 -07001015 omap_init_vout();
Tony Lindgren1dbae812005-11-10 14:26:51 +00001016
1017 return 0;
1018}
1019arch_initcall(omap2_init_devices);
Varadarajan, Charulathaf2ce6232010-09-23 20:02:42 +05301020
1021#if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE)
Nishanth Menona9b365b2011-01-06 19:49:29 -08001022static struct omap_device_pm_latency omap_wdt_latency[] = {
Varadarajan, Charulathaf2ce6232010-09-23 20:02:42 +05301023 [0] = {
1024 .deactivate_func = omap_device_idle_hwmods,
1025 .activate_func = omap_device_enable_hwmods,
1026 .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST,
1027 },
1028};
1029
1030static int __init omap_init_wdt(void)
1031{
1032 int id = -1;
1033 struct omap_device *od;
1034 struct omap_hwmod *oh;
1035 char *oh_name = "wd_timer2";
1036 char *dev_name = "omap_wdt";
1037
1038 if (!cpu_class_is_omap2())
1039 return 0;
1040
1041 oh = omap_hwmod_lookup(oh_name);
1042 if (!oh) {
1043 pr_err("Could not look up wd_timer%d hwmod\n", id);
1044 return -EINVAL;
1045 }
1046
1047 od = omap_device_build(dev_name, id, oh, NULL, 0,
1048 omap_wdt_latency,
1049 ARRAY_SIZE(omap_wdt_latency), 0);
1050 WARN(IS_ERR(od), "Cant build omap_device for %s:%s.\n",
1051 dev_name, oh->name);
1052 return 0;
1053}
1054subsys_initcall(omap_init_wdt);
1055#endif