Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/kaber/nf-next-2.6
[linux-2.6] / arch / arm / mach-msm / devices.c
1 /* linux/arch/arm/mach-msm/devices.c
2  *
3  * Copyright (C) 2008 Google, Inc.
4  *
5  * This software is licensed under the terms of the GNU General Public
6  * License version 2, as published by the Free Software Foundation, and
7  * may be copied, distributed, and modified under those terms.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  * GNU General Public License for more details.
13  *
14  */
15
16 #include <linux/kernel.h>
17 #include <linux/platform_device.h>
18
19 #include <mach/irqs.h>
20 #include <mach/msm_iomap.h>
21 #include "devices.h"
22
23 #include <asm/mach/flash.h>
24 #include <linux/mtd/nand.h>
25 #include <linux/mtd/partitions.h>
26
27 static struct resource resources_uart1[] = {
28         {
29                 .start  = INT_UART1,
30                 .end    = INT_UART1,
31                 .flags  = IORESOURCE_IRQ,
32         },
33         {
34                 .start  = MSM_UART1_PHYS,
35                 .end    = MSM_UART1_PHYS + MSM_UART1_SIZE - 1,
36                 .flags  = IORESOURCE_MEM,
37         },
38 };
39
40 static struct resource resources_uart2[] = {
41         {
42                 .start  = INT_UART2,
43                 .end    = INT_UART2,
44                 .flags  = IORESOURCE_IRQ,
45         },
46         {
47                 .start  = MSM_UART2_PHYS,
48                 .end    = MSM_UART2_PHYS + MSM_UART2_SIZE - 1,
49                 .flags  = IORESOURCE_MEM,
50         },
51 };
52
53 static struct resource resources_uart3[] = {
54         {
55                 .start  = INT_UART3,
56                 .end    = INT_UART3,
57                 .flags  = IORESOURCE_IRQ,
58         },
59         {
60                 .start  = MSM_UART3_PHYS,
61                 .end    = MSM_UART3_PHYS + MSM_UART3_SIZE - 1,
62                 .flags  = IORESOURCE_MEM,
63         },
64 };
65
66 struct platform_device msm_device_uart1 = {
67         .name   = "msm_serial",
68         .id     = 0,
69         .num_resources  = ARRAY_SIZE(resources_uart1),
70         .resource       = resources_uart1,
71 };
72
73 struct platform_device msm_device_uart2 = {
74         .name   = "msm_serial",
75         .id     = 1,
76         .num_resources  = ARRAY_SIZE(resources_uart2),
77         .resource       = resources_uart2,
78 };
79
80 struct platform_device msm_device_uart3 = {
81         .name   = "msm_serial",
82         .id     = 2,
83         .num_resources  = ARRAY_SIZE(resources_uart3),
84         .resource       = resources_uart3,
85 };
86
87 static struct resource resources_i2c[] = {
88         {
89                 .start  = MSM_I2C_PHYS,
90                 .end    = MSM_I2C_PHYS + MSM_I2C_SIZE - 1,
91                 .flags  = IORESOURCE_MEM,
92         },
93         {
94                 .start  = INT_PWB_I2C,
95                 .end    = INT_PWB_I2C,
96                 .flags  = IORESOURCE_IRQ,
97         },
98 };
99
100 struct platform_device msm_device_i2c = {
101         .name           = "msm_i2c",
102         .id             = 0,
103         .num_resources  = ARRAY_SIZE(resources_i2c),
104         .resource       = resources_i2c,
105 };
106
107 static struct resource resources_hsusb[] = {
108         {
109                 .start  = MSM_HSUSB_PHYS,
110                 .end    = MSM_HSUSB_PHYS + MSM_HSUSB_SIZE,
111                 .flags  = IORESOURCE_MEM,
112         },
113         {
114                 .start  = INT_USB_HS,
115                 .end    = INT_USB_HS,
116                 .flags  = IORESOURCE_IRQ,
117         },
118 };
119
120 struct platform_device msm_device_hsusb = {
121         .name           = "msm_hsusb",
122         .id             = -1,
123         .num_resources  = ARRAY_SIZE(resources_hsusb),
124         .resource       = resources_hsusb,
125         .dev            = {
126                 .coherent_dma_mask      = 0xffffffff,
127         },
128 };
129
130 struct flash_platform_data msm_nand_data = {
131         .parts          = NULL,
132         .nr_parts       = 0,
133 };
134
135 static struct resource resources_nand[] = {
136         [0] = {
137                 .start  = 7,
138                 .end    = 7,
139                 .flags  = IORESOURCE_DMA,
140         },
141 };
142
143 struct platform_device msm_device_nand = {
144         .name           = "msm_nand",
145         .id             = -1,
146         .num_resources  = ARRAY_SIZE(resources_nand),
147         .resource       = resources_nand,
148         .dev            = {
149                 .platform_data  = &msm_nand_data,
150         },
151 };
152
153 struct platform_device msm_device_smd = {
154         .name   = "msm_smd",
155         .id     = -1,
156 };
157
158 static struct resource resources_sdc1[] = {
159         {
160                 .start  = MSM_SDC1_PHYS,
161                 .end    = MSM_SDC1_PHYS + MSM_SDC1_SIZE - 1,
162                 .flags  = IORESOURCE_MEM,
163         },
164         {
165                 .start  = INT_SDC1_0,
166                 .end    = INT_SDC1_1,
167                 .flags  = IORESOURCE_IRQ,
168         },
169         {
170                 .start  = 8,
171                 .end    = 8,
172                 .flags  = IORESOURCE_DMA,
173         },
174 };
175
176 static struct resource resources_sdc2[] = {
177         {
178                 .start  = MSM_SDC2_PHYS,
179                 .end    = MSM_SDC2_PHYS + MSM_SDC2_SIZE - 1,
180                 .flags  = IORESOURCE_MEM,
181         },
182         {
183                 .start  = INT_SDC2_0,
184                 .end    = INT_SDC2_1,
185                 .flags  = IORESOURCE_IRQ,
186         },
187         {
188                 .start  = 8,
189                 .end    = 8,
190                 .flags  = IORESOURCE_DMA,
191         },
192 };
193
194 static struct resource resources_sdc3[] = {
195         {
196                 .start  = MSM_SDC3_PHYS,
197                 .end    = MSM_SDC3_PHYS + MSM_SDC3_SIZE - 1,
198                 .flags  = IORESOURCE_MEM,
199         },
200         {
201                 .start  = INT_SDC3_0,
202                 .end    = INT_SDC3_1,
203                 .flags  = IORESOURCE_IRQ,
204         },
205         {
206                 .start  = 8,
207                 .end    = 8,
208                 .flags  = IORESOURCE_DMA,
209         },
210 };
211
212 static struct resource resources_sdc4[] = {
213         {
214                 .start  = MSM_SDC4_PHYS,
215                 .end    = MSM_SDC4_PHYS + MSM_SDC4_SIZE - 1,
216                 .flags  = IORESOURCE_MEM,
217         },
218         {
219                 .start  = INT_SDC4_0,
220                 .end    = INT_SDC4_1,
221                 .flags  = IORESOURCE_IRQ,
222         },
223         {
224                 .start  = 8,
225                 .end    = 8,
226                 .flags  = IORESOURCE_DMA,
227         },
228 };
229
230 struct platform_device msm_device_sdc1 = {
231         .name           = "msm_sdcc",
232         .id             = 1,
233         .num_resources  = ARRAY_SIZE(resources_sdc1),
234         .resource       = resources_sdc1,
235         .dev            = {
236                 .coherent_dma_mask      = 0xffffffff,
237         },
238 };
239
240 struct platform_device msm_device_sdc2 = {
241         .name           = "msm_sdcc",
242         .id             = 2,
243         .num_resources  = ARRAY_SIZE(resources_sdc2),
244         .resource       = resources_sdc2,
245         .dev            = {
246                 .coherent_dma_mask      = 0xffffffff,
247         },
248 };
249
250 struct platform_device msm_device_sdc3 = {
251         .name           = "msm_sdcc",
252         .id             = 3,
253         .num_resources  = ARRAY_SIZE(resources_sdc3),
254         .resource       = resources_sdc3,
255         .dev            = {
256                 .coherent_dma_mask      = 0xffffffff,
257         },
258 };
259
260 struct platform_device msm_device_sdc4 = {
261         .name           = "msm_sdcc",
262         .id             = 4,
263         .num_resources  = ARRAY_SIZE(resources_sdc4),
264         .resource       = resources_sdc4,
265         .dev            = {
266                 .coherent_dma_mask      = 0xffffffff,
267         },
268 };