]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/blob - arch/arm/mach-omap2/devices.c
OMAP SHA1/MD5 module: Add suppor for SHA1/MD5 algorithm on OMAP.
[linux-2.6-omap-h63xx.git] / arch / arm / mach-omap2 / devices.c
1 /*
2  * linux/arch/arm/mach-omap2/devices.c
3  *
4  * OMAP2 platform device setup/initialization
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  */
11
12 #include <linux/module.h>
13 #include <linux/kernel.h>
14 #include <linux/init.h>
15 #include <linux/platform_device.h>
16
17 #include <asm/hardware.h>
18 #include <asm/io.h>
19 #include <asm/mach-types.h>
20 #include <asm/mach/map.h>
21
22 #include <asm/arch/tc.h>
23 #include <asm/arch/board.h>
24 #include <asm/arch/mux.h>
25 #include <asm/arch/gpio.h>
26 #include <asm/arch/eac.h>
27
28 #if defined(CONFIG_VIDEO_OMAP2) || defined(CONFIG_VIDEO_OMAP2_MODULE)
29
30 static struct resource cam_resources[] = {
31         {
32                 .start          = OMAP24XX_CAMERA_BASE,
33                 .end            = OMAP24XX_CAMERA_BASE + 0xfff,
34                 .flags          = IORESOURCE_MEM,
35         },
36         {
37                 .start          = INT_24XX_CAM_IRQ,
38                 .flags          = IORESOURCE_IRQ,
39         }
40 };
41
42 static struct platform_device omap_cam_device = {
43         .name           = "omap24xxcam",
44         .id             = -1,
45         .num_resources  = ARRAY_SIZE(cam_resources),
46         .resource       = cam_resources,
47 };
48
49 static inline void omap_init_camera(void)
50 {
51         platform_device_register(&omap_cam_device);
52 }
53 #else
54 static inline void omap_init_camera(void)
55 {
56 }
57 #endif
58
59 #if defined(CONFIG_OMAP_DSP) || defined(CONFIG_OMAP_DSP_MODULE)
60 #define OMAP2_MBOX_BASE         IO_ADDRESS(OMAP24XX_MAILBOX_BASE)
61
62 static struct resource mbox_resources[] = {
63         {
64                 .start          = OMAP2_MBOX_BASE,
65                 .end            = OMAP2_MBOX_BASE + 0x11f,
66                 .flags          = IORESOURCE_MEM,
67         },
68         {
69                 .start          = INT_24XX_MAIL_U0_MPU,
70                 .flags          = IORESOURCE_IRQ,
71         },
72         {
73                 .start          = INT_24XX_MAIL_U3_MPU,
74                 .flags          = IORESOURCE_IRQ,
75         },
76 };
77
78 static struct platform_device mbox_device = {
79         .name           = "mailbox",
80         .id             = -1,
81         .num_resources  = ARRAY_SIZE(mbox_resources),
82         .resource       = mbox_resources,
83 };
84
85 static inline void omap_init_mbox(void)
86 {
87         platform_device_register(&mbox_device);
88 }
89 #else
90 static inline void omap_init_mbox(void) { }
91 #endif
92
93 #if defined(CONFIG_OMAP_STI)
94
95 #define OMAP2_STI_BASE          IO_ADDRESS(0x48068000)
96 #define OMAP2_STI_CHANNEL_BASE  0x54000000
97 #define OMAP2_STI_IRQ           4
98
99 static struct resource sti_resources[] = {
100         {
101                 .start          = OMAP2_STI_BASE,
102                 .end            = OMAP2_STI_BASE + 0x7ff,
103                 .flags          = IORESOURCE_MEM,
104         },
105         {
106                 .start          = OMAP2_STI_CHANNEL_BASE,
107                 .end            = OMAP2_STI_CHANNEL_BASE + SZ_64K - 1,
108                 .flags          = IORESOURCE_MEM,
109         },
110         {
111                 .start          = OMAP2_STI_IRQ,
112                 .flags          = IORESOURCE_IRQ,
113         }
114 };
115
116 static struct platform_device sti_device = {
117         .name           = "sti",
118         .id             = -1,
119         .num_resources  = ARRAY_SIZE(sti_resources),
120         .resource       = sti_resources,
121 };
122
123 static inline void omap_init_sti(void)
124 {
125         platform_device_register(&sti_device);
126 }
127 #else
128 static inline void omap_init_sti(void) {}
129 #endif
130
131 #if defined(CONFIG_SPI_OMAP24XX) || defined(CONFIG_SPI_OMAP24XX_MODULE)
132
133 #include <asm/arch/mcspi.h>
134
135 #define OMAP2_MCSPI1_BASE               0x48098000
136 #define OMAP2_MCSPI2_BASE               0x4809a000
137
138 static struct omap2_mcspi_platform_config omap2_mcspi1_config = {
139         .num_cs         = 4,
140 };
141
142 static struct resource omap2_mcspi1_resources[] = {
143         {
144                 .start          = OMAP2_MCSPI1_BASE,
145                 .end            = OMAP2_MCSPI1_BASE + 0xff,
146                 .flags          = IORESOURCE_MEM,
147         },
148 };
149
150 struct platform_device omap2_mcspi1 = {
151         .name           = "omap2_mcspi",
152         .id             = 1,
153         .num_resources  = ARRAY_SIZE(omap2_mcspi1_resources),
154         .resource       = omap2_mcspi1_resources,
155         .dev            = {
156                 .platform_data = &omap2_mcspi1_config,
157         },
158 };
159
160 static struct omap2_mcspi_platform_config omap2_mcspi2_config = {
161         .num_cs         = 2,
162 };
163
164 static struct resource omap2_mcspi2_resources[] = {
165         {
166                 .start          = OMAP2_MCSPI2_BASE,
167                 .end            = OMAP2_MCSPI2_BASE + 0xff,
168                 .flags          = IORESOURCE_MEM,
169         },
170 };
171
172 struct platform_device omap2_mcspi2 = {
173         .name           = "omap2_mcspi",
174         .id             = 2,
175         .num_resources  = ARRAY_SIZE(omap2_mcspi2_resources),
176         .resource       = omap2_mcspi2_resources,
177         .dev            = {
178                 .platform_data = &omap2_mcspi2_config,
179         },
180 };
181
182 static void omap_init_mcspi(void)
183 {
184         platform_device_register(&omap2_mcspi1);
185         platform_device_register(&omap2_mcspi2);
186 }
187
188 #else
189 static inline void omap_init_mcspi(void) {}
190 #endif
191
192 #ifdef CONFIG_SND_OMAP24XX_EAC
193
194 #define OMAP2_EAC_BASE                  0x48090000
195
196 static struct resource omap2_eac_resources[] = {
197         {
198                 .start          = OMAP2_EAC_BASE,
199                 .end            = OMAP2_EAC_BASE + 0x109,
200                 .flags          = IORESOURCE_MEM,
201         },
202 };
203
204 static struct platform_device omap2_eac_device = {
205         .name           = "omap24xx-eac",
206         .id             = -1,
207         .num_resources  = ARRAY_SIZE(omap2_eac_resources),
208         .resource       = omap2_eac_resources,
209         .dev = {
210                 .platform_data = NULL,
211         },
212 };
213
214 void omap_init_eac(struct eac_platform_data *pdata)
215 {
216         omap2_eac_device.dev.platform_data = pdata;
217         platform_device_register(&omap2_eac_device);
218 }
219
220 #else
221 void omap_init_eac(struct eac_platform_data *pdata) {}
222 #endif
223
224 #ifdef CONFIG_OMAP_SHA1_MD5
225 static struct resource sha1_md5_resources[] = {
226         {
227                 .start  = OMAP2420_SEC_SHA1MD5_BASE,
228                 .end    = OMAP2420_SEC_SHA1MD5_BASE + 0x64,
229                 .flags  = IORESOURCE_MEM,
230         },
231         {
232                 .start  = INT_24XX_SHA1MD5,
233                 .flags  = IORESOURCE_IRQ,
234         }
235 };
236
237 static struct platform_device sha1_md5_device = {
238         .name           = "OMAP SHA1/MD5",
239         .id             = -1,
240         .num_resources  = ARRAY_SIZE(sha1_md5_resources),
241         .resource       = sha1_md5_resources,
242 };
243
244 static void omap_init_sha1_md5(void)
245 {
246         platform_device_register(&sha1_md5_device);
247 }
248 #else
249 static inline void omap_init_sha1_md5(void) { }
250 #endif
251
252 /*-------------------------------------------------------------------------*/
253
254 static int __init omap2_init_devices(void)
255 {
256         /* please keep these calls, and their implementations above,
257          * in alphabetical order so they're easier to sort through.
258          */
259         omap_init_camera();
260         omap_init_mbox();
261         omap_init_mcspi();
262         omap_init_sti();
263         omap_init_sha1_md5();
264
265         return 0;
266 }
267 arch_initcall(omap2_init_devices);