blob: 90af2ac469aaccc74401ceea7fe5487e63a7dd6b [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/module.h>
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/platform_device.h>
Russell Kingfced80c2008-09-06 12:10:45 +010016#include <linux/io.h>
Tony Lindgren1dbae812005-11-10 14:26:51 +000017
Russell Kinga09e64f2008-08-05 16:14:15 +010018#include <mach/hardware.h>
Tony Lindgren1dbae812005-11-10 14:26:51 +000019#include <asm/mach-types.h>
20#include <asm/mach/map.h>
21
Russell Kinga09e64f2008-08-05 16:14:15 +010022#include <mach/tc.h>
23#include <mach/board.h>
24#include <mach/mux.h>
25#include <mach/gpio.h>
Tony Lindgren646e3ed2008-10-06 15:49:36 +030026#include <mach/eac.h>
Tony Lindgren1dbae812005-11-10 14:26:51 +000027
Tony Lindgrenc40fae952006-12-07 13:58:10 -080028#if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
29#define OMAP2_MBOX_BASE IO_ADDRESS(OMAP24XX_MAILBOX_BASE)
30
31static struct resource mbox_resources[] = {
32 {
33 .start = OMAP2_MBOX_BASE,
34 .end = OMAP2_MBOX_BASE + 0x11f,
35 .flags = IORESOURCE_MEM,
36 },
37 {
38 .start = INT_24XX_MAIL_U0_MPU,
39 .flags = IORESOURCE_IRQ,
40 },
41 {
42 .start = INT_24XX_MAIL_U3_MPU,
43 .flags = IORESOURCE_IRQ,
44 },
45};
46
47static struct platform_device mbox_device = {
48 .name = "mailbox",
49 .id = -1,
50 .num_resources = ARRAY_SIZE(mbox_resources),
51 .resource = mbox_resources,
52};
53
54static inline void omap_init_mbox(void)
55{
56 platform_device_register(&mbox_device);
57}
58#else
59static inline void omap_init_mbox(void) { }
60#endif
61
Tony Lindgren9b6553c2006-04-02 17:46:30 +010062#if defined(CONFIG_OMAP_STI)
63
Tony Lindgren646e3ed2008-10-06 15:49:36 +030064#if defined(CONFIG_ARCH_OMAP2)
65
66#define OMAP2_STI_BASE 0x48068000
Tony Lindgren9b6553c2006-04-02 17:46:30 +010067#define OMAP2_STI_CHANNEL_BASE 0x54000000
68#define OMAP2_STI_IRQ 4
69
70static struct resource sti_resources[] = {
71 {
72 .start = OMAP2_STI_BASE,
73 .end = OMAP2_STI_BASE + 0x7ff,
74 .flags = IORESOURCE_MEM,
75 },
76 {
77 .start = OMAP2_STI_CHANNEL_BASE,
78 .end = OMAP2_STI_CHANNEL_BASE + SZ_64K - 1,
79 .flags = IORESOURCE_MEM,
80 },
81 {
82 .start = OMAP2_STI_IRQ,
83 .flags = IORESOURCE_IRQ,
84 }
85};
Tony Lindgren646e3ed2008-10-06 15:49:36 +030086#elif defined(CONFIG_ARCH_OMAP3)
87
88#define OMAP3_SDTI_BASE 0x54500000
89#define OMAP3_SDTI_CHANNEL_BASE 0x54600000
90
91static struct resource sti_resources[] = {
92 {
93 .start = OMAP3_SDTI_BASE,
94 .end = OMAP3_SDTI_BASE + 0xFFF,
95 .flags = IORESOURCE_MEM,
96 },
97 {
98 .start = OMAP3_SDTI_CHANNEL_BASE,
99 .end = OMAP3_SDTI_CHANNEL_BASE + SZ_1M - 1,
100 .flags = IORESOURCE_MEM,
101 }
102};
103
104#endif
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100105
106static struct platform_device sti_device = {
107 .name = "sti",
108 .id = -1,
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100109 .num_resources = ARRAY_SIZE(sti_resources),
110 .resource = sti_resources,
111};
112
113static inline void omap_init_sti(void)
114{
115 platform_device_register(&sti_device);
116}
117#else
118static inline void omap_init_sti(void) {}
119#endif
120
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300121#if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700122
Russell Kinga09e64f2008-08-05 16:14:15 +0100123#include <mach/mcspi.h>
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700124
125#define OMAP2_MCSPI1_BASE 0x48098000
126#define OMAP2_MCSPI2_BASE 0x4809a000
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300127#define OMAP2_MCSPI3_BASE 0x480b8000
128#define OMAP2_MCSPI4_BASE 0x480ba000
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700129
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700130static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700131 .num_cs = 4,
132};
133
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800134static struct resource omap2_mcspi1_resources[] = {
135 {
136 .start = OMAP2_MCSPI1_BASE,
137 .end = OMAP2_MCSPI1_BASE + 0xff,
138 .flags = IORESOURCE_MEM,
139 },
140};
141
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300142static struct platform_device omap2_mcspi1 = {
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700143 .name = "omap2_mcspi",
144 .id = 1,
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800145 .num_resources = ARRAY_SIZE(omap2_mcspi1_resources),
146 .resource = omap2_mcspi1_resources,
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700147 .dev = {
148 .platform_data = &omap2_mcspi1_config,
149 },
150};
151
152static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700153 .num_cs = 2,
154};
155
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800156static struct resource omap2_mcspi2_resources[] = {
157 {
158 .start = OMAP2_MCSPI2_BASE,
159 .end = OMAP2_MCSPI2_BASE + 0xff,
160 .flags = IORESOURCE_MEM,
161 },
162};
163
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300164static struct platform_device omap2_mcspi2 = {
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700165 .name = "omap2_mcspi",
166 .id = 2,
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800167 .num_resources = ARRAY_SIZE(omap2_mcspi2_resources),
168 .resource = omap2_mcspi2_resources,
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700169 .dev = {
170 .platform_data = &omap2_mcspi2_config,
171 },
172};
173
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300174#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3)
175static struct omap2_mcspi_platform_config omap2_mcspi3_config = {
176 .num_cs = 2,
177};
178
179static struct resource omap2_mcspi3_resources[] = {
180 {
181 .start = OMAP2_MCSPI3_BASE,
182 .end = OMAP2_MCSPI3_BASE + 0xff,
183 .flags = IORESOURCE_MEM,
184 },
185};
186
187static struct platform_device omap2_mcspi3 = {
188 .name = "omap2_mcspi",
189 .id = 3,
190 .num_resources = ARRAY_SIZE(omap2_mcspi3_resources),
191 .resource = omap2_mcspi3_resources,
192 .dev = {
193 .platform_data = &omap2_mcspi3_config,
194 },
195};
196#endif
197
198#ifdef CONFIG_ARCH_OMAP3
199static struct omap2_mcspi_platform_config omap2_mcspi4_config = {
200 .num_cs = 1,
201};
202
203static struct resource omap2_mcspi4_resources[] = {
204 {
205 .start = OMAP2_MCSPI4_BASE,
206 .end = OMAP2_MCSPI4_BASE + 0xff,
207 .flags = IORESOURCE_MEM,
208 },
209};
210
211static struct platform_device omap2_mcspi4 = {
212 .name = "omap2_mcspi",
213 .id = 4,
214 .num_resources = ARRAY_SIZE(omap2_mcspi4_resources),
215 .resource = omap2_mcspi4_resources,
216 .dev = {
217 .platform_data = &omap2_mcspi4_config,
218 },
219};
220#endif
221
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700222static void omap_init_mcspi(void)
223{
224 platform_device_register(&omap2_mcspi1);
225 platform_device_register(&omap2_mcspi2);
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300226#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3)
227 platform_device_register(&omap2_mcspi3);
228#endif
229#ifdef CONFIG_ARCH_OMAP3
230 platform_device_register(&omap2_mcspi4);
231#endif
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700232}
233
234#else
235static inline void omap_init_mcspi(void) {}
236#endif
237
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300238#ifdef CONFIG_SND_OMAP24XX_EAC
239
240#define OMAP2_EAC_BASE 0x48090000
241
242static struct resource omap2_eac_resources[] = {
243 {
244 .start = OMAP2_EAC_BASE,
245 .end = OMAP2_EAC_BASE + 0x109,
246 .flags = IORESOURCE_MEM,
247 },
248};
249
250static struct platform_device omap2_eac_device = {
251 .name = "omap24xx-eac",
252 .id = -1,
253 .num_resources = ARRAY_SIZE(omap2_eac_resources),
254 .resource = omap2_eac_resources,
255 .dev = {
256 .platform_data = NULL,
257 },
258};
259
260void omap_init_eac(struct eac_platform_data *pdata)
261{
262 omap2_eac_device.dev.platform_data = pdata;
263 platform_device_register(&omap2_eac_device);
264}
265
266#else
267void omap_init_eac(struct eac_platform_data *pdata) {}
268#endif
269
270#ifdef CONFIG_OMAP_SHA1_MD5
271static struct resource sha1_md5_resources[] = {
272 {
273 .start = OMAP24XX_SEC_SHA1MD5_BASE,
274 .end = OMAP24XX_SEC_SHA1MD5_BASE + 0x64,
275 .flags = IORESOURCE_MEM,
276 },
277 {
278 .start = INT_24XX_SHA1MD5,
279 .flags = IORESOURCE_IRQ,
280 }
281};
282
283static struct platform_device sha1_md5_device = {
284 .name = "OMAP SHA1/MD5",
285 .id = -1,
286 .num_resources = ARRAY_SIZE(sha1_md5_resources),
287 .resource = sha1_md5_resources,
288};
289
290static void omap_init_sha1_md5(void)
291{
292 platform_device_register(&sha1_md5_device);
293}
294#else
295static inline void omap_init_sha1_md5(void) { }
296#endif
297
298#if defined(CONFIG_HDQ_MASTER_OMAP) || defined(CONFIG_HDQ_MASTER_OMAP_MODULE)
299#if defined(CONFIG_ARCH_OMAP2430) || defined(CONFIG_ARCH_OMAP3430)
300#define OMAP_HDQ_BASE 0x480B2000
301#endif
302static struct resource omap_hdq_resources[] = {
303 {
304 .start = OMAP_HDQ_BASE,
305 .end = OMAP_HDQ_BASE + 0x1C,
306 .flags = IORESOURCE_MEM,
307 },
308 {
309 .start = INT_24XX_HDQ_IRQ,
310 .flags = IORESOURCE_IRQ,
311 },
312};
313static struct platform_device omap_hdq_dev = {
314 .name = "omap_hdq",
315 .id = 0,
316 .dev = {
317 .platform_data = NULL,
318 },
319 .num_resources = ARRAY_SIZE(omap_hdq_resources),
320 .resource = omap_hdq_resources,
321};
322static inline void omap_hdq_init(void)
323{
324 (void) platform_device_register(&omap_hdq_dev);
325}
326#else
327static inline void omap_hdq_init(void) {}
328#endif
329
Tony Lindgren1dbae812005-11-10 14:26:51 +0000330/*-------------------------------------------------------------------------*/
331
332static int __init omap2_init_devices(void)
333{
334 /* please keep these calls, and their implementations above,
335 * in alphabetical order so they're easier to sort through.
336 */
Tony Lindgrenc40fae952006-12-07 13:58:10 -0800337 omap_init_mbox();
Juha Yrjolaed7eb9d2006-06-26 16:16:10 -0700338 omap_init_mcspi();
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300339 omap_hdq_init();
Tony Lindgren9b6553c2006-04-02 17:46:30 +0100340 omap_init_sti();
Tony Lindgren646e3ed2008-10-06 15:49:36 +0300341 omap_init_sha1_md5();
Tony Lindgren1dbae812005-11-10 14:26:51 +0000342
343 return 0;
344}
345arch_initcall(omap2_init_devices);