blob: 0dd6398bade4787510c4d5c62210b7a61cfb7595 [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 */
Russell King2f8163b2011-07-26 10:53:52 +010011#include <linux/gpio.h>
Tony Lindgren1dbae812005-11-10 14:26:51 +000012#include <linux/kernel.h>
13#include <linux/init.h>
14#include <linux/platform_device.h>
Russell Kingfced80c2008-09-06 12:10:45 +010015#include <linux/io.h>
Kevin Hilman917fa282008-12-10 17:37:17 -080016#include <linux/clk.h>
Varadarajan, Charulathaf2ce6232010-09-23 20:02:42 +053017#include <linux/err.h>
Charulatha V1a5d8192011-02-02 17:52:14 +053018#include <linux/slab.h>
Benoit Coussonad8dfac2011-08-12 13:48:47 +020019#include <linux/of.h>
Matt Porter484202f2012-09-17 16:26:11 -070020#include <linux/pinctrl/machine.h>
Felipe Balbi0f1142a2012-03-16 22:47:48 -070021#include <linux/platform_data/omap4-keypad.h>
Suman Annab8a7cf82013-01-28 17:21:58 -060022#include <linux/platform_data/mailbox-omap.h>
Tony Lindgren1dbae812005-11-10 14:26:51 +000023
Tony Lindgren1dbae812005-11-10 14:26:51 +000024#include <asm/mach-types.h>
25#include <asm/mach/map.h>
26
Tony Lindgren45c3eb72012-11-30 08:41:50 -080027#include <linux/omap-dma.h>
Tony Lindgren2a296c82012-10-02 17:41:35 -070028
Tony Lindgrenee0839c2012-02-24 10:34:35 -080029#include "iomap.h"
Tony Lindgren2a296c82012-10-02 17:41:35 -070030#include "omap_hwmod.h"
Tony Lindgren25c7d492012-10-02 17:25:48 -070031#include "omap_device.h"
Tony Lindgren0e701562012-09-20 11:42:20 -070032#include "omap4-keypad.h"
Tony Lindgren1dbae812005-11-10 14:26:51 +000033
Tony Lindgren7d7e1eb2012-08-27 17:43:01 -070034#include "soc.h"
35#include "common.h"
Tony Lindgren4896e392009-12-11 16:16:32 -080036#include "mux.h"
Paul Walmsley4814ced2010-10-08 11:40:20 -060037#include "control.h"
Laurent Pincharta11f6702009-12-14 08:09:07 -030038#include "devices.h"
Archit Taneja576e5bd2013-09-16 12:48:31 +053039#include "display.h"
Tony Lindgren4896e392009-12-11 16:16:32 -080040
sricharan0abcf612011-02-08 14:10:45 +053041#define L3_MODULES_MAX_LEN 12
sricharana4dc6162011-03-09 16:00:29 +053042#define L3_MODULES 3
sricharan0abcf612011-02-08 14:10:45 +053043
44static int __init omap3_l3_init(void)
45{
sricharan0abcf612011-02-08 14:10:45 +053046 struct omap_hwmod *oh;
Kevin Hilman3528c582011-07-21 13:48:45 -070047 struct platform_device *pdev;
sricharan0abcf612011-02-08 14:10:45 +053048 char oh_name[L3_MODULES_MAX_LEN];
49
50 /*
51 * To avoid code running on other OMAPs in
52 * multi-omap builds
53 */
54 if (!(cpu_is_omap34xx()))
55 return -ENODEV;
56
Paul Walmsleyeeb37112012-04-13 06:34:32 -060057 snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main");
sricharan0abcf612011-02-08 14:10:45 +053058
59 oh = omap_hwmod_lookup(oh_name);
60
61 if (!oh)
62 pr_err("could not look up %s\n", oh_name);
63
Paul Walmsleyc1d1cd52013-01-26 00:48:53 -070064 pdev = omap_device_build("omap_l3_smx", 0, oh, NULL, 0);
sricharan0abcf612011-02-08 14:10:45 +053065
Kevin Hilman3528c582011-07-21 13:48:45 -070066 WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
sricharan0abcf612011-02-08 14:10:45 +053067
Thomas Meyer12616742013-06-01 11:44:44 +020068 return PTR_RET(pdev);
sricharan0abcf612011-02-08 14:10:45 +053069}
Tony Lindgrenb76c8b12013-01-11 11:24:18 -080070omap_postcore_initcall(omap3_l3_init);
sricharan0abcf612011-02-08 14:10:45 +053071
sricharana4dc6162011-03-09 16:00:29 +053072static int __init omap4_l3_init(void)
73{
Paul Walmsleyeeb37112012-04-13 06:34:32 -060074 int i;
sricharana4dc6162011-03-09 16:00:29 +053075 struct omap_hwmod *oh[3];
Kevin Hilman3528c582011-07-21 13:48:45 -070076 struct platform_device *pdev;
sricharana4dc6162011-03-09 16:00:29 +053077 char oh_name[L3_MODULES_MAX_LEN];
78
Benoit Coussonad8dfac2011-08-12 13:48:47 +020079 /* If dtb is there, the devices will be created dynamically */
80 if (of_have_populated_dt())
81 return -ENODEV;
82
sricharana4dc6162011-03-09 16:00:29 +053083 /*
84 * To avoid code running on other OMAPs in
85 * multi-omap builds
86 */
R Sricharane17933c2011-11-04 15:52:59 +053087 if (!cpu_is_omap44xx() && !soc_is_omap54xx())
sricharana4dc6162011-03-09 16:00:29 +053088 return -ENODEV;
89
90 for (i = 0; i < L3_MODULES; i++) {
Paul Walmsleyeeb37112012-04-13 06:34:32 -060091 snprintf(oh_name, L3_MODULES_MAX_LEN, "l3_main_%d", i+1);
sricharana4dc6162011-03-09 16:00:29 +053092
93 oh[i] = omap_hwmod_lookup(oh_name);
94 if (!(oh[i]))
95 pr_err("could not look up %s\n", oh_name);
96 }
97
Paul Walmsleyc1d1cd52013-01-26 00:48:53 -070098 pdev = omap_device_build_ss("omap_l3_noc", 0, oh, 3, NULL, 0);
sricharana4dc6162011-03-09 16:00:29 +053099
Kevin Hilman3528c582011-07-21 13:48:45 -0700100 WARN(IS_ERR(pdev), "could not build omap_device for %s\n", oh_name);
sricharana4dc6162011-03-09 16:00:29 +0530101
Thomas Meyer12616742013-06-01 11:44:44 +0200102 return PTR_RET(pdev);
sricharana4dc6162011-03-09 16:00:29 +0530103}
Tony Lindgrenb76c8b12013-01-11 11:24:18 -0800104omap_postcore_initcall(omap4_l3_init);
sricharana4dc6162011-03-09 16:00:29 +0530105
Tony Lindgren828c7072009-03-23 18:23:49 -0700106#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800107
Sergio Aguirrecfe2cde2010-11-15 11:29:54 -0300108static struct resource omap2cam_resources[] = {
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800109 {
Tony Lindgren828c7072009-03-23 18:23:49 -0700110 .start = OMAP24XX_CAMERA_BASE,
111 .end = OMAP24XX_CAMERA_BASE + 0xfff,
112 .flags = IORESOURCE_MEM,
113 },
114 {
Tony Lindgren7d7e1eb2012-08-27 17:43:01 -0700115 .start = 24 + OMAP_INTC_START,
Tony Lindgren828c7072009-03-23 18:23:49 -0700116 .flags = IORESOURCE_IRQ,
117 }
118};
119
Sergio Aguirrecfe2cde2010-11-15 11:29:54 -0300120static struct platform_device omap2cam_device = {
Tony Lindgren828c7072009-03-23 18:23:49 -0700121 .name = "omap24xxcam",
122 .id = -1,
Sergio Aguirrecfe2cde2010-11-15 11:29:54 -0300123 .num_resources = ARRAY_SIZE(omap2cam_resources),
124 .resource = omap2cam_resources,
Tony Lindgren828c7072009-03-23 18:23:49 -0700125};
Laurent Pincharta11f6702009-12-14 08:09:07 -0300126#endif
Tony Lindgren828c7072009-03-23 18:23:49 -0700127
Ohad Ben-Cohen1a51a0c2012-01-11 15:28:11 +0200128#if defined(CONFIG_IOMMU_API)
129
Tony Lindgren2ab7c842012-11-02 12:24:14 -0700130#include <linux/platform_data/iommu-omap.h>
Ohad Ben-Cohen1a51a0c2012-01-11 15:28:11 +0200131
Tony Lindgren828c7072009-03-23 18:23:49 -0700132static struct resource omap3isp_resources[] = {
133 {
134 .start = OMAP3430_ISP_BASE,
135 .end = OMAP3430_ISP_END,
136 .flags = IORESOURCE_MEM,
137 },
138 {
Tony Lindgren828c7072009-03-23 18:23:49 -0700139 .start = OMAP3430_ISP_CCP2_BASE,
140 .end = OMAP3430_ISP_CCP2_END,
141 .flags = IORESOURCE_MEM,
142 },
143 {
144 .start = OMAP3430_ISP_CCDC_BASE,
145 .end = OMAP3430_ISP_CCDC_END,
146 .flags = IORESOURCE_MEM,
147 },
148 {
149 .start = OMAP3430_ISP_HIST_BASE,
150 .end = OMAP3430_ISP_HIST_END,
151 .flags = IORESOURCE_MEM,
152 },
153 {
154 .start = OMAP3430_ISP_H3A_BASE,
155 .end = OMAP3430_ISP_H3A_END,
156 .flags = IORESOURCE_MEM,
157 },
158 {
159 .start = OMAP3430_ISP_PREV_BASE,
160 .end = OMAP3430_ISP_PREV_END,
161 .flags = IORESOURCE_MEM,
162 },
163 {
164 .start = OMAP3430_ISP_RESZ_BASE,
165 .end = OMAP3430_ISP_RESZ_END,
166 .flags = IORESOURCE_MEM,
167 },
168 {
169 .start = OMAP3430_ISP_SBL_BASE,
170 .end = OMAP3430_ISP_SBL_END,
171 .flags = IORESOURCE_MEM,
172 },
173 {
Tuukka Toivonen6817a692010-02-02 11:17:33 -0300174 .start = OMAP3430_ISP_CSI2A_REGS1_BASE,
175 .end = OMAP3430_ISP_CSI2A_REGS1_END,
Tony Lindgren828c7072009-03-23 18:23:49 -0700176 .flags = IORESOURCE_MEM,
177 },
178 {
Tuukka Toivonen6817a692010-02-02 11:17:33 -0300179 .start = OMAP3430_ISP_CSIPHY2_BASE,
180 .end = OMAP3430_ISP_CSIPHY2_END,
181 .flags = IORESOURCE_MEM,
182 },
183 {
184 .start = OMAP3630_ISP_CSI2A_REGS2_BASE,
185 .end = OMAP3630_ISP_CSI2A_REGS2_END,
186 .flags = IORESOURCE_MEM,
187 },
188 {
189 .start = OMAP3630_ISP_CSI2C_REGS1_BASE,
190 .end = OMAP3630_ISP_CSI2C_REGS1_END,
191 .flags = IORESOURCE_MEM,
192 },
193 {
194 .start = OMAP3630_ISP_CSIPHY1_BASE,
195 .end = OMAP3630_ISP_CSIPHY1_END,
196 .flags = IORESOURCE_MEM,
197 },
198 {
199 .start = OMAP3630_ISP_CSI2C_REGS2_BASE,
200 .end = OMAP3630_ISP_CSI2C_REGS2_END,
Tony Lindgren828c7072009-03-23 18:23:49 -0700201 .flags = IORESOURCE_MEM,
202 },
203 {
Sakari Ailusc19d19e2012-10-14 07:31:48 -0300204 .start = OMAP343X_CTRL_BASE + OMAP343X_CONTROL_CSIRXFE,
205 .end = OMAP343X_CTRL_BASE + OMAP343X_CONTROL_CSIRXFE + 3,
206 .flags = IORESOURCE_MEM,
207 },
208 {
209 .start = OMAP343X_CTRL_BASE + OMAP3630_CONTROL_CAMERA_PHY_CTRL,
210 .end = OMAP343X_CTRL_BASE + OMAP3630_CONTROL_CAMERA_PHY_CTRL + 3,
211 .flags = IORESOURCE_MEM,
212 },
213 {
Tony Lindgren7d7e1eb2012-08-27 17:43:01 -0700214 .start = 24 + OMAP_INTC_START,
Tony Lindgren828c7072009-03-23 18:23:49 -0700215 .flags = IORESOURCE_IRQ,
216 }
217};
218
219static struct platform_device omap3isp_device = {
220 .name = "omap3isp",
221 .id = -1,
222 .num_resources = ARRAY_SIZE(omap3isp_resources),
223 .resource = omap3isp_resources,
224};
225
Ohad Ben-Cohenc8eaab32011-09-23 16:44:57 +0300226static struct omap_iommu_arch_data omap3_isp_iommu = {
Omar Ramirez Luna72b15b62012-11-19 19:05:50 -0600227 .name = "mmu_isp",
Ohad Ben-Cohenc8eaab32011-09-23 16:44:57 +0300228};
229
Laurent Pincharta11f6702009-12-14 08:09:07 -0300230int omap3_init_camera(struct isp_platform_data *pdata)
Tony Lindgren828c7072009-03-23 18:23:49 -0700231{
Laurent Pincharta11f6702009-12-14 08:09:07 -0300232 omap3isp_device.dev.platform_data = pdata;
Ohad Ben-Cohenc8eaab32011-09-23 16:44:57 +0300233 omap3isp_device.dev.archdata.iommu = &omap3_isp_iommu;
234
Laurent Pincharta11f6702009-12-14 08:09:07 -0300235 return platform_device_register(&omap3isp_device);
Tony Lindgren828c7072009-03-23 18:23:49 -0700236}
Tony Lindgren828c7072009-03-23 18:23:49 -0700237
Ohad Ben-Cohen1a51a0c2012-01-11 15:28:11 +0200238#else /* !CONFIG_IOMMU_API */
239
240int omap3_init_camera(struct isp_platform_data *pdata)
241{
242 return 0;
243}
244
245#endif
246
Tony Lindgren1dbae812005-11-10 14:26:51 +0000247static inline void omap_init_camera(void)
248{
Sergio Aguirrecfe2cde2010-11-15 11:29:54 -0300249#if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
250 if (cpu_is_omap24xx())
251 platform_device_register(&omap2cam_device);
Tony Lindgren1dbae812005-11-10 14:26:51 +0000252#endif
Sergio Aguirrecfe2cde2010-11-15 11:29:54 -0300253}
Tony Lindgren1dbae812005-11-10 14:26:51 +0000254
Syed Rafiuddin59556762010-12-27 05:51:45 +0000255int __init omap4_keyboard_init(struct omap4_keypad_platform_data
Shubhrajyoti Dattaf67df6c2011-07-05 03:38:24 -0700256 *sdp4430_keypad_data, struct omap_board_data *bdata)
Syed Rafiuddin59556762010-12-27 05:51:45 +0000257{
Kevin Hilman3528c582011-07-21 13:48:45 -0700258 struct platform_device *pdev;
Syed Rafiuddin59556762010-12-27 05:51:45 +0000259 struct omap_hwmod *oh;
260 struct omap4_keypad_platform_data *keypad_data;
261 unsigned int id = -1;
262 char *oh_name = "kbd";
263 char *name = "omap4-keypad";
264
265 oh = omap_hwmod_lookup(oh_name);
266 if (!oh) {
267 pr_err("Could not look up %s\n", oh_name);
268 return -ENODEV;
269 }
270
271 keypad_data = sdp4430_keypad_data;
272
Kevin Hilman3528c582011-07-21 13:48:45 -0700273 pdev = omap_device_build(name, id, oh, keypad_data,
Paul Walmsleyc1d1cd52013-01-26 00:48:53 -0700274 sizeof(struct omap4_keypad_platform_data));
Syed Rafiuddin59556762010-12-27 05:51:45 +0000275
Kevin Hilman3528c582011-07-21 13:48:45 -0700276 if (IS_ERR(pdev)) {
Lucas De Marchi25985ed2011-03-30 22:57:33 -0300277 WARN(1, "Can't build omap_device for %s:%s.\n",
Syed Rafiuddin59556762010-12-27 05:51:45 +0000278 name, oh->name);
Kevin Hilman3528c582011-07-21 13:48:45 -0700279 return PTR_ERR(pdev);
Syed Rafiuddin59556762010-12-27 05:51:45 +0000280 }
Shubhrajyoti Dattaf67df6c2011-07-05 03:38:24 -0700281 oh->mux = omap_hwmod_mux_init(bdata->pads, bdata->pads_cnt);
Syed Rafiuddin59556762010-12-27 05:51:45 +0000282
283 return 0;
284}
285
Suman Annac869c752013-03-12 17:55:29 -0500286#if defined(CONFIG_OMAP2PLUS_MBOX) || defined(CONFIG_OMAP2PLUS_MBOX_MODULE)
Kevin Hilman9cf793f2012-02-20 09:43:30 -0800287static inline void __init omap_init_mbox(void)
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800288{
Felipe Contreras69dbf852011-02-24 12:51:33 -0800289 struct omap_hwmod *oh;
Kevin Hilman3528c582011-07-21 13:48:45 -0700290 struct platform_device *pdev;
Suman Annab8a7cf82013-01-28 17:21:58 -0600291 struct omap_mbox_pdata *pdata;
Felipe Contreras69dbf852011-02-24 12:51:33 -0800292
293 oh = omap_hwmod_lookup("mailbox");
294 if (!oh) {
295 pr_err("%s: unable to find hwmod\n", __func__);
Hiroshi DOYU6c20a682009-03-23 18:07:23 -0700296 return;
297 }
Suman Annab8a7cf82013-01-28 17:21:58 -0600298 if (!oh->dev_attr) {
299 pr_err("%s: hwmod doesn't have valid attrs\n", __func__);
300 return;
301 }
Felipe Contreras69dbf852011-02-24 12:51:33 -0800302
Suman Annab8a7cf82013-01-28 17:21:58 -0600303 pdata = (struct omap_mbox_pdata *)oh->dev_attr;
304 pdev = omap_device_build("omap-mailbox", -1, oh, pdata, sizeof(*pdata));
Kevin Hilman3528c582011-07-21 13:48:45 -0700305 WARN(IS_ERR(pdev), "%s: could not build device, err %ld\n",
306 __func__, PTR_ERR(pdev));
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800307}
308#else
309static inline void omap_init_mbox(void) { }
Suman Annac869c752013-03-12 17:55:29 -0500310#endif /* CONFIG_OMAP2PLUS_MBOX */
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800311
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100312static inline void omap_init_sti(void) {}
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100313
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000314#if defined(CONFIG_SND_SOC) || defined(CONFIG_SND_SOC_MODULE)
315
316static struct platform_device omap_pcm = {
317 .name = "omap-pcm-audio",
318 .id = -1,
319};
320
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000321static void omap_init_audio(void)
322{
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000323 platform_device_register(&omap_pcm);
324}
325
326#else
327static inline void omap_init_audio(void) {}
328#endif
329
Ricardo Neri5eeec212012-05-09 14:19:14 -0700330#if defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI) || \
331 defined(CONFIG_SND_OMAP_SOC_OMAP_HDMI_MODULE)
332
333static struct platform_device omap_hdmi_audio = {
334 .name = "omap-hdmi-audio",
335 .id = -1,
336};
337
338static void __init omap_init_hdmi_audio(void)
339{
340 struct omap_hwmod *oh;
341 struct platform_device *pdev;
342
343 oh = omap_hwmod_lookup("dss_hdmi");
Peter Ujfalusi7252db52013-06-11 10:32:00 +0200344 if (!oh)
Ricardo Neri5eeec212012-05-09 14:19:14 -0700345 return;
Ricardo Neri5eeec212012-05-09 14:19:14 -0700346
Paul Walmsley6efc3fe2013-02-12 03:58:35 +0000347 pdev = omap_device_build("omap-hdmi-audio-dai", -1, oh, NULL, 0);
Ricardo Neri5eeec212012-05-09 14:19:14 -0700348 WARN(IS_ERR(pdev),
349 "Can't build omap_device for omap-hdmi-audio-dai.\n");
350
351 platform_device_register(&omap_hdmi_audio);
352}
353#else
354static inline void omap_init_hdmi_audio(void) {}
355#endif
356
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300357#if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700358
Arnd Bergmann22037472012-08-24 15:21:06 +0200359#include <linux/platform_data/spi-omap2-mcspi.h>
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700360
Kevin Hilman9cf793f2012-02-20 09:43:30 -0800361static int __init omap_mcspi_init(struct omap_hwmod *oh, void *unused)
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700362{
Kevin Hilman3528c582011-07-21 13:48:45 -0700363 struct platform_device *pdev;
Charulatha V1a5d8192011-02-02 17:52:14 +0530364 char *name = "omap2_mcspi";
365 struct omap2_mcspi_platform_config *pdata;
366 static int spi_num;
367 struct omap2_mcspi_dev_attr *mcspi_attrib = oh->dev_attr;
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700368
Charulatha V1a5d8192011-02-02 17:52:14 +0530369 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
370 if (!pdata) {
371 pr_err("Memory allocation for McSPI device failed\n");
372 return -ENOMEM;
373 }
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700374
Charulatha V1a5d8192011-02-02 17:52:14 +0530375 pdata->num_cs = mcspi_attrib->num_chipselect;
376 switch (oh->class->rev) {
377 case OMAP2_MCSPI_REV:
378 case OMAP3_MCSPI_REV:
379 pdata->regs_offset = 0;
380 break;
381 case OMAP4_MCSPI_REV:
382 pdata->regs_offset = OMAP4_MCSPI_REG_OFFSET;
383 break;
384 default:
385 pr_err("Invalid McSPI Revision value\n");
Julia Lawalle0feca892011-12-23 18:39:31 +0100386 kfree(pdata);
Charulatha V1a5d8192011-02-02 17:52:14 +0530387 return -EINVAL;
388 }
389
390 spi_num++;
Paul Walmsleyc1d1cd52013-01-26 00:48:53 -0700391 pdev = omap_device_build(name, spi_num, oh, pdata, sizeof(*pdata));
Kevin Hilman3528c582011-07-21 13:48:45 -0700392 WARN(IS_ERR(pdev), "Can't build omap_device for %s:%s\n",
Charulatha V1a5d8192011-02-02 17:52:14 +0530393 name, oh->name);
394 kfree(pdata);
395 return 0;
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700396}
Tony Lindgrenaf41a122009-09-24 16:23:05 -0700397
398static void omap_init_mcspi(void)
399{
Charulatha V1a5d8192011-02-02 17:52:14 +0530400 omap_hwmod_for_each_by_class("mcspi", omap_mcspi_init, NULL);
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700401}
402
403#else
404static inline void omap_init_mcspi(void) {}
405#endif
406
Paul Walmsley4848d462012-09-23 17:28:27 -0600407/**
408 * omap_init_rng - bind the RNG hwmod to the RNG omap_device
409 *
410 * Bind the RNG hwmod to the RNG omap_device. No return value.
411 */
412static void omap_init_rng(void)
413{
414 struct omap_hwmod *oh;
415 struct platform_device *pdev;
416
417 oh = omap_hwmod_lookup("rng");
418 if (!oh)
419 return;
420
Paul Walmsleyc1d1cd52013-01-26 00:48:53 -0700421 pdev = omap_device_build("omap_rng", -1, oh, NULL, 0);
Paul Walmsley4848d462012-09-23 17:28:27 -0600422 WARN(IS_ERR(pdev), "Can't build omap_device for omap_rng\n");
423}
Will Deacon88341332010-04-09 13:54:43 +0100424
Mark A. Greer26f88e62013-03-18 10:06:32 -0600425static void __init omap_init_sham(void)
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300426{
Mark A. Greer8c7bb572013-03-18 10:06:33 -0600427 struct omap_hwmod *oh;
428 struct platform_device *pdev;
Mark A. Greere569e992013-03-30 15:49:19 -0600429
Mark A. Greer8c7bb572013-03-18 10:06:33 -0600430 oh = omap_hwmod_lookup("sham");
431 if (!oh)
432 return;
Mark A. Greere569e992013-03-30 15:49:19 -0600433
Mark A. Greer8c7bb572013-03-18 10:06:33 -0600434 pdev = omap_device_build("omap-sham", -1, oh, NULL, 0);
435 WARN(IS_ERR(pdev), "Can't build omap_device for omap-sham\n");
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300436}
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300437
Mark A. Greer14ae5562012-12-21 09:28:10 -0700438static void __init omap_init_aes(void)
Dmitry Kasatkinb744c672010-09-03 19:13:55 +0800439{
Mark A. Greer77e2fd82012-12-21 09:28:11 -0700440 struct omap_hwmod *oh;
441 struct platform_device *pdev;
Mark A. Greer660ffd62012-12-21 09:28:09 -0700442
Mark A. Greer77e2fd82012-12-21 09:28:11 -0700443 oh = omap_hwmod_lookup("aes");
444 if (!oh)
445 return;
Mark A. Greer660ffd62012-12-21 09:28:09 -0700446
Mark A. Greer77e2fd82012-12-21 09:28:11 -0700447 pdev = omap_device_build("omap-aes", -1, oh, NULL, 0);
448 WARN(IS_ERR(pdev), "Can't build omap_device for omap-aes\n");
Dmitry Kasatkinb744c672010-09-03 19:13:55 +0800449}
450
Tony Lindgrend8874662008-12-10 17:37:16 -0800451/*-------------------------------------------------------------------------*/
452
Vaibhav Hiremathb2273582010-05-10 14:29:14 -0700453#if defined(CONFIG_VIDEO_OMAP2_VOUT) || \
454 defined(CONFIG_VIDEO_OMAP2_VOUT_MODULE)
455#if defined(CONFIG_FB_OMAP2) || defined(CONFIG_FB_OMAP2_MODULE)
456static struct resource omap_vout_resource[3 - CONFIG_FB_OMAP2_NUM_FBS] = {
457};
458#else
459static struct resource omap_vout_resource[2] = {
460};
461#endif
462
463static struct platform_device omap_vout_device = {
464 .name = "omap_vout",
465 .num_resources = ARRAY_SIZE(omap_vout_resource),
466 .resource = &omap_vout_resource[0],
467 .id = -1,
468};
Archit Taneja576e5bd2013-09-16 12:48:31 +0530469
470int __init omap_init_vout(void)
Vaibhav Hiremathb2273582010-05-10 14:29:14 -0700471{
Archit Taneja576e5bd2013-09-16 12:48:31 +0530472 return platform_device_register(&omap_vout_device);
Vaibhav Hiremathb2273582010-05-10 14:29:14 -0700473}
474#else
Archit Taneja576e5bd2013-09-16 12:48:31 +0530475int __init omap_init_vout(void) { return 0; }
Vaibhav Hiremathb2273582010-05-10 14:29:14 -0700476#endif
477
Tony Lindgren1dbae812005-11-10 14:26:51 +0000478/*-------------------------------------------------------------------------*/
479
480static int __init omap2_init_devices(void)
481{
Matt Porter484202f2012-09-17 16:26:11 -0700482 /* Enable dummy states for those platforms without pinctrl support */
483 if (!of_have_populated_dt())
484 pinctrl_provide_dummies();
485
Paul Walmsley81fbc5ef2010-12-21 19:56:17 -0700486 /*
487 * please keep these calls, and their implementations above,
Tony Lindgren1dbae812005-11-10 14:26:51 +0000488 * in alphabetical order so they're easier to sort through.
489 */
Liam Girdwoodf0fba2a2010-03-17 20:15:21 +0000490 omap_init_audio();
Tony Lindgren828c7072009-03-23 18:23:49 -0700491 omap_init_camera();
Ricardo Neri5eeec212012-05-09 14:19:14 -0700492 omap_init_hdmi_audio();
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800493 omap_init_mbox();
Benoit Coussonefcf1e52012-01-20 14:15:58 +0100494 /* If dtb is there, the devices will be created dynamically */
Peter Ujfalusi259bd6c2012-05-02 15:23:18 +0300495 if (!of_have_populated_dt()) {
Benoit Coussonefcf1e52012-01-20 14:15:58 +0100496 omap_init_mcspi();
Mark A. Greer114d7a82013-03-18 10:06:33 -0600497 omap_init_sham();
Mark A. Greer53335ac2012-12-21 09:28:12 -0700498 omap_init_aes();
Lokesh Vutla674ee082013-08-05 20:17:22 +0530499 omap_init_rng();
Peter Ujfalusi259bd6c2012-05-02 15:23:18 +0300500 }
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100501 omap_init_sti();
Tony Lindgren1dbae812005-11-10 14:26:51 +0000502
503 return 0;
504}
Tony Lindgrenb76c8b12013-01-11 11:24:18 -0800505omap_arch_initcall(omap2_init_devices);