blob: 39bc474455c3d6ed09d42926e28385a21f4aac6e [file] [log] [blame]
Brian Swetlandbcc0f6a2008-09-10 14:00:53 -07001/* 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
Russell King80b02c12009-01-08 10:01:47 +000019#include <mach/irqs.h>
Brian Swetlandbcc0f6a2008-09-10 14:00:53 -070020#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
San Mehat5d4f77f2008-11-10 16:30:27 -080027#include <mach/mmc.h>
28
Brian Swetlandbcc0f6a2008-09-10 14:00:53 -070029static struct resource resources_uart1[] = {
30 {
31 .start = INT_UART1,
32 .end = INT_UART1,
33 .flags = IORESOURCE_IRQ,
34 },
35 {
36 .start = MSM_UART1_PHYS,
37 .end = MSM_UART1_PHYS + MSM_UART1_SIZE - 1,
38 .flags = IORESOURCE_MEM,
39 },
40};
41
42static struct resource resources_uart2[] = {
43 {
44 .start = INT_UART2,
45 .end = INT_UART2,
46 .flags = IORESOURCE_IRQ,
47 },
48 {
49 .start = MSM_UART2_PHYS,
50 .end = MSM_UART2_PHYS + MSM_UART2_SIZE - 1,
51 .flags = IORESOURCE_MEM,
52 },
53};
54
55static struct resource resources_uart3[] = {
56 {
57 .start = INT_UART3,
58 .end = INT_UART3,
59 .flags = IORESOURCE_IRQ,
60 },
61 {
62 .start = MSM_UART3_PHYS,
63 .end = MSM_UART3_PHYS + MSM_UART3_SIZE - 1,
64 .flags = IORESOURCE_MEM,
65 },
66};
67
68struct platform_device msm_device_uart1 = {
69 .name = "msm_serial",
70 .id = 0,
71 .num_resources = ARRAY_SIZE(resources_uart1),
72 .resource = resources_uart1,
73};
74
75struct platform_device msm_device_uart2 = {
76 .name = "msm_serial",
77 .id = 1,
78 .num_resources = ARRAY_SIZE(resources_uart2),
79 .resource = resources_uart2,
80};
81
82struct platform_device msm_device_uart3 = {
83 .name = "msm_serial",
84 .id = 2,
85 .num_resources = ARRAY_SIZE(resources_uart3),
86 .resource = resources_uart3,
87};
88
89static struct resource resources_i2c[] = {
90 {
91 .start = MSM_I2C_PHYS,
92 .end = MSM_I2C_PHYS + MSM_I2C_SIZE - 1,
93 .flags = IORESOURCE_MEM,
94 },
95 {
96 .start = INT_PWB_I2C,
97 .end = INT_PWB_I2C,
98 .flags = IORESOURCE_IRQ,
99 },
100};
101
102struct platform_device msm_device_i2c = {
103 .name = "msm_i2c",
104 .id = 0,
105 .num_resources = ARRAY_SIZE(resources_i2c),
106 .resource = resources_i2c,
107};
108
109static struct resource resources_hsusb[] = {
110 {
111 .start = MSM_HSUSB_PHYS,
112 .end = MSM_HSUSB_PHYS + MSM_HSUSB_SIZE,
113 .flags = IORESOURCE_MEM,
114 },
115 {
116 .start = INT_USB_HS,
117 .end = INT_USB_HS,
118 .flags = IORESOURCE_IRQ,
119 },
120};
121
122struct platform_device msm_device_hsusb = {
123 .name = "msm_hsusb",
124 .id = -1,
125 .num_resources = ARRAY_SIZE(resources_hsusb),
126 .resource = resources_hsusb,
127 .dev = {
128 .coherent_dma_mask = 0xffffffff,
129 },
130};
131
132struct flash_platform_data msm_nand_data = {
133 .parts = NULL,
134 .nr_parts = 0,
135};
136
137static struct resource resources_nand[] = {
138 [0] = {
139 .start = 7,
140 .end = 7,
141 .flags = IORESOURCE_DMA,
142 },
143};
144
145struct platform_device msm_device_nand = {
146 .name = "msm_nand",
147 .id = -1,
148 .num_resources = ARRAY_SIZE(resources_nand),
149 .resource = resources_nand,
150 .dev = {
151 .platform_data = &msm_nand_data,
152 },
153};
154
155struct platform_device msm_device_smd = {
156 .name = "msm_smd",
157 .id = -1,
158};
159
160static struct resource resources_sdc1[] = {
161 {
162 .start = MSM_SDC1_PHYS,
163 .end = MSM_SDC1_PHYS + MSM_SDC1_SIZE - 1,
164 .flags = IORESOURCE_MEM,
165 },
166 {
167 .start = INT_SDC1_0,
168 .end = INT_SDC1_1,
169 .flags = IORESOURCE_IRQ,
170 },
171 {
172 .start = 8,
173 .end = 8,
174 .flags = IORESOURCE_DMA,
175 },
176};
177
178static struct resource resources_sdc2[] = {
179 {
180 .start = MSM_SDC2_PHYS,
181 .end = MSM_SDC2_PHYS + MSM_SDC2_SIZE - 1,
182 .flags = IORESOURCE_MEM,
183 },
184 {
185 .start = INT_SDC2_0,
186 .end = INT_SDC2_1,
187 .flags = IORESOURCE_IRQ,
188 },
189 {
190 .start = 8,
191 .end = 8,
192 .flags = IORESOURCE_DMA,
193 },
194};
195
196static struct resource resources_sdc3[] = {
197 {
198 .start = MSM_SDC3_PHYS,
199 .end = MSM_SDC3_PHYS + MSM_SDC3_SIZE - 1,
200 .flags = IORESOURCE_MEM,
201 },
202 {
203 .start = INT_SDC3_0,
204 .end = INT_SDC3_1,
205 .flags = IORESOURCE_IRQ,
206 },
207 {
208 .start = 8,
209 .end = 8,
210 .flags = IORESOURCE_DMA,
211 },
212};
213
214static struct resource resources_sdc4[] = {
215 {
216 .start = MSM_SDC4_PHYS,
217 .end = MSM_SDC4_PHYS + MSM_SDC4_SIZE - 1,
218 .flags = IORESOURCE_MEM,
219 },
220 {
221 .start = INT_SDC4_0,
222 .end = INT_SDC4_1,
223 .flags = IORESOURCE_IRQ,
224 },
225 {
226 .start = 8,
227 .end = 8,
228 .flags = IORESOURCE_DMA,
229 },
230};
231
232struct platform_device msm_device_sdc1 = {
233 .name = "msm_sdcc",
234 .id = 1,
235 .num_resources = ARRAY_SIZE(resources_sdc1),
236 .resource = resources_sdc1,
237 .dev = {
238 .coherent_dma_mask = 0xffffffff,
239 },
240};
241
242struct platform_device msm_device_sdc2 = {
243 .name = "msm_sdcc",
244 .id = 2,
245 .num_resources = ARRAY_SIZE(resources_sdc2),
246 .resource = resources_sdc2,
247 .dev = {
248 .coherent_dma_mask = 0xffffffff,
249 },
250};
251
252struct platform_device msm_device_sdc3 = {
253 .name = "msm_sdcc",
254 .id = 3,
255 .num_resources = ARRAY_SIZE(resources_sdc3),
256 .resource = resources_sdc3,
257 .dev = {
258 .coherent_dma_mask = 0xffffffff,
259 },
260};
261
262struct platform_device msm_device_sdc4 = {
263 .name = "msm_sdcc",
264 .id = 4,
265 .num_resources = ARRAY_SIZE(resources_sdc4),
266 .resource = resources_sdc4,
267 .dev = {
268 .coherent_dma_mask = 0xffffffff,
269 },
270};
San Mehat5d4f77f2008-11-10 16:30:27 -0800271
272static struct platform_device *msm_sdcc_devices[] __initdata = {
273 &msm_device_sdc1,
274 &msm_device_sdc2,
275 &msm_device_sdc3,
276 &msm_device_sdc4,
277};
278
279int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
280{
281 struct platform_device *pdev;
282
283 if (controller < 1 || controller > 4)
284 return -EINVAL;
285
286 pdev = msm_sdcc_devices[controller-1];
287 pdev->dev.platform_data = plat;
288 return platform_device_register(pdev);
289}
290