Merge branch 'topic/misc' into topic/pcsp-fix
[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/msm_iomap.h>
20 #include "devices.h"
21
22 #include <asm/mach/flash.h>
23 #include <linux/mtd/nand.h>
24 #include <linux/mtd/partitions.h>
25
26 static struct resource resources_uart1[] = {
27         {
28                 .start  = INT_UART1,
29                 .end    = INT_UART1,
30                 .flags  = IORESOURCE_IRQ,
31         },
32         {
33                 .start  = MSM_UART1_PHYS,
34                 .end    = MSM_UART1_PHYS + MSM_UART1_SIZE - 1,
35                 .flags  = IORESOURCE_MEM,
36         },
37 };
38
39 static struct resource resources_uart2[] = {
40         {
41                 .start  = INT_UART2,
42                 .end    = INT_UART2,
43                 .flags  = IORESOURCE_IRQ,
44         },
45         {
46                 .start  = MSM_UART2_PHYS,
47                 .end    = MSM_UART2_PHYS + MSM_UART2_SIZE - 1,
48                 .flags  = IORESOURCE_MEM,
49         },
50 };
51
52 static struct resource resources_uart3[] = {
53         {
54                 .start  = INT_UART3,
55                 .end    = INT_UART3,
56                 .flags  = IORESOURCE_IRQ,
57         },
58         {
59                 .start  = MSM_UART3_PHYS,
60                 .end    = MSM_UART3_PHYS + MSM_UART3_SIZE - 1,
61                 .flags  = IORESOURCE_MEM,
62         },
63 };
64
65 struct platform_device msm_device_uart1 = {
66         .name   = "msm_serial",
67         .id     = 0,
68         .num_resources  = ARRAY_SIZE(resources_uart1),
69         .resource       = resources_uart1,
70 };
71
72 struct platform_device msm_device_uart2 = {
73         .name   = "msm_serial",
74         .id     = 1,
75         .num_resources  = ARRAY_SIZE(resources_uart2),
76         .resource       = resources_uart2,
77 };
78
79 struct platform_device msm_device_uart3 = {
80         .name   = "msm_serial",
81         .id     = 2,
82         .num_resources  = ARRAY_SIZE(resources_uart3),
83         .resource       = resources_uart3,
84 };
85
86 static struct resource resources_i2c[] = {
87         {
88                 .start  = MSM_I2C_PHYS,
89                 .end    = MSM_I2C_PHYS + MSM_I2C_SIZE - 1,
90                 .flags  = IORESOURCE_MEM,
91         },
92         {
93                 .start  = INT_PWB_I2C,
94                 .end    = INT_PWB_I2C,
95                 .flags  = IORESOURCE_IRQ,
96         },
97 };
98
99 struct platform_device msm_device_i2c = {
100         .name           = "msm_i2c",
101         .id             = 0,
102         .num_resources  = ARRAY_SIZE(resources_i2c),
103         .resource       = resources_i2c,
104 };
105
106 static struct resource resources_hsusb[] = {
107         {
108                 .start  = MSM_HSUSB_PHYS,
109                 .end    = MSM_HSUSB_PHYS + MSM_HSUSB_SIZE,
110                 .flags  = IORESOURCE_MEM,
111         },
112         {
113                 .start  = INT_USB_HS,
114                 .end    = INT_USB_HS,
115                 .flags  = IORESOURCE_IRQ,
116         },
117 };
118
119 struct platform_device msm_device_hsusb = {
120         .name           = "msm_hsusb",
121         .id             = -1,
122         .num_resources  = ARRAY_SIZE(resources_hsusb),
123         .resource       = resources_hsusb,
124         .dev            = {
125                 .coherent_dma_mask      = 0xffffffff,
126         },
127 };
128
129 struct flash_platform_data msm_nand_data = {
130         .parts          = NULL,
131         .nr_parts       = 0,
132 };
133
134 static struct resource resources_nand[] = {
135         [0] = {
136                 .start  = 7,
137                 .end    = 7,
138                 .flags  = IORESOURCE_DMA,
139         },
140 };
141
142 struct platform_device msm_device_nand = {
143         .name           = "msm_nand",
144         .id             = -1,
145         .num_resources  = ARRAY_SIZE(resources_nand),
146         .resource       = resources_nand,
147         .dev            = {
148                 .platform_data  = &msm_nand_data,
149         },
150 };
151
152 struct platform_device msm_device_smd = {
153         .name   = "msm_smd",
154         .id     = -1,
155 };
156
157 static struct resource resources_sdc1[] = {
158         {
159                 .start  = MSM_SDC1_PHYS,
160                 .end    = MSM_SDC1_PHYS + MSM_SDC1_SIZE - 1,
161                 .flags  = IORESOURCE_MEM,
162         },
163         {
164                 .start  = INT_SDC1_0,
165                 .end    = INT_SDC1_1,
166                 .flags  = IORESOURCE_IRQ,
167         },
168         {
169                 .start  = 8,
170                 .end    = 8,
171                 .flags  = IORESOURCE_DMA,
172         },
173 };
174
175 static struct resource resources_sdc2[] = {
176         {
177                 .start  = MSM_SDC2_PHYS,
178                 .end    = MSM_SDC2_PHYS + MSM_SDC2_SIZE - 1,
179                 .flags  = IORESOURCE_MEM,
180         },
181         {
182                 .start  = INT_SDC2_0,
183                 .end    = INT_SDC2_1,
184                 .flags  = IORESOURCE_IRQ,
185         },
186         {
187                 .start  = 8,
188                 .end    = 8,
189                 .flags  = IORESOURCE_DMA,
190         },
191 };
192
193 static struct resource resources_sdc3[] = {
194         {
195                 .start  = MSM_SDC3_PHYS,
196                 .end    = MSM_SDC3_PHYS + MSM_SDC3_SIZE - 1,
197                 .flags  = IORESOURCE_MEM,
198         },
199         {
200                 .start  = INT_SDC3_0,
201                 .end    = INT_SDC3_1,
202                 .flags  = IORESOURCE_IRQ,
203         },
204         {
205                 .start  = 8,
206                 .end    = 8,
207                 .flags  = IORESOURCE_DMA,
208         },
209 };
210
211 static struct resource resources_sdc4[] = {
212         {
213                 .start  = MSM_SDC4_PHYS,
214                 .end    = MSM_SDC4_PHYS + MSM_SDC4_SIZE - 1,
215                 .flags  = IORESOURCE_MEM,
216         },
217         {
218                 .start  = INT_SDC4_0,
219                 .end    = INT_SDC4_1,
220                 .flags  = IORESOURCE_IRQ,
221         },
222         {
223                 .start  = 8,
224                 .end    = 8,
225                 .flags  = IORESOURCE_DMA,
226         },
227 };
228
229 struct platform_device msm_device_sdc1 = {
230         .name           = "msm_sdcc",
231         .id             = 1,
232         .num_resources  = ARRAY_SIZE(resources_sdc1),
233         .resource       = resources_sdc1,
234         .dev            = {
235                 .coherent_dma_mask      = 0xffffffff,
236         },
237 };
238
239 struct platform_device msm_device_sdc2 = {
240         .name           = "msm_sdcc",
241         .id             = 2,
242         .num_resources  = ARRAY_SIZE(resources_sdc2),
243         .resource       = resources_sdc2,
244         .dev            = {
245                 .coherent_dma_mask      = 0xffffffff,
246         },
247 };
248
249 struct platform_device msm_device_sdc3 = {
250         .name           = "msm_sdcc",
251         .id             = 3,
252         .num_resources  = ARRAY_SIZE(resources_sdc3),
253         .resource       = resources_sdc3,
254         .dev            = {
255                 .coherent_dma_mask      = 0xffffffff,
256         },
257 };
258
259 struct platform_device msm_device_sdc4 = {
260         .name           = "msm_sdcc",
261         .id             = 4,
262         .num_resources  = ARRAY_SIZE(resources_sdc4),
263         .resource       = resources_sdc4,
264         .dev            = {
265                 .coherent_dma_mask      = 0xffffffff,
266         },
267 };