blob: 35e55ece86bfa6511b0cf8c1844803cc0d9d4aa8 [file] [log] [blame]
Daniel Walker62a6cc52010-05-05 07:27:16 -07001/*
2 * Copyright (C) 2008 Google, Inc.
Stepan Moskovchenkod41cb8c2011-01-17 20:33:32 -08003 * Copyright (c) 2008-2011, Code Aurora Forum. All rights reserved.
Daniel Walker62a6cc52010-05-05 07:27:16 -07004 *
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>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070018#include <linux/msm_kgsl.h>
Stephen Boydbd323442011-02-23 09:37:42 -080019
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/dma-mapping.h>
21#include <asm/clkdev.h>
Daniel Walker62a6cc52010-05-05 07:27:16 -070022#include <mach/irqs.h>
23#include <mach/msm_iomap.h>
24#include <mach/dma.h>
25#include <mach/board.h>
26
27#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070028#include "gpio_hw.h"
Daniel Walker62a6cc52010-05-05 07:27:16 -070029
30#include <asm/mach/flash.h>
31
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070032#include <asm/mach/mmc.h>
33#include <mach/msm_hsusb.h>
34#include <mach/usbdiag.h>
35#include <mach/usb_gadget_fserial.h>
36#include <mach/rpc_hsusb.h>
37
38static struct resource resources_uart1[] = {
39 {
40 .start = INT_UART1,
41 .end = INT_UART1,
42 .flags = IORESOURCE_IRQ,
43 },
44 {
45 .start = MSM_UART1_PHYS,
46 .end = MSM_UART1_PHYS + MSM_UART1_SIZE - 1,
47 .flags = IORESOURCE_MEM,
48 },
49};
50
51static struct resource resources_uart2[] = {
52 {
53 .start = INT_UART2,
54 .end = INT_UART2,
55 .flags = IORESOURCE_IRQ,
56 },
57 {
58 .start = MSM_UART2_PHYS,
59 .end = MSM_UART2_PHYS + MSM_UART2_SIZE - 1,
60 .flags = IORESOURCE_MEM,
61 },
62};
Daniel Walker62a6cc52010-05-05 07:27:16 -070063
64static struct resource resources_uart3[] = {
65 {
66 .start = INT_UART3,
67 .end = INT_UART3,
68 .flags = IORESOURCE_IRQ,
69 },
70 {
71 .start = MSM_UART3_PHYS,
72 .end = MSM_UART3_PHYS + MSM_UART3_SIZE - 1,
73 .flags = IORESOURCE_MEM,
Stepan Moskovchenkod41cb8c2011-01-17 20:33:32 -080074 .name = "uart_resource"
Daniel Walker62a6cc52010-05-05 07:27:16 -070075 },
76};
77
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070078struct platform_device msm_device_uart1 = {
79 .name = "msm_serial",
80 .id = 0,
81 .num_resources = ARRAY_SIZE(resources_uart1),
82 .resource = resources_uart1,
83};
84
85struct platform_device msm_device_uart2 = {
86 .name = "msm_serial",
87 .id = 1,
88 .num_resources = ARRAY_SIZE(resources_uart2),
89 .resource = resources_uart2,
90};
91
Daniel Walker62a6cc52010-05-05 07:27:16 -070092struct platform_device msm_device_uart3 = {
93 .name = "msm_serial",
94 .id = 2,
95 .num_resources = ARRAY_SIZE(resources_uart3),
96 .resource = resources_uart3,
97};
98
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070099#define MSM_UART1DM_PHYS 0xA0200000
100#define MSM_UART2DM_PHYS 0xA0900000
101static struct resource msm_uart1_dm_resources[] = {
102 {
103 .start = MSM_UART1DM_PHYS,
104 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
105 .flags = IORESOURCE_MEM,
106 },
107 {
108 .start = INT_UART1DM_IRQ,
109 .end = INT_UART1DM_IRQ,
110 .flags = IORESOURCE_IRQ,
111 },
112 {
113 .start = INT_UART1DM_RX,
114 .end = INT_UART1DM_RX,
115 .flags = IORESOURCE_IRQ,
116 },
117 {
118 .start = DMOV_HSUART1_TX_CHAN,
119 .end = DMOV_HSUART1_RX_CHAN,
120 .name = "uartdm_channels",
121 .flags = IORESOURCE_DMA,
122 },
123 {
124 .start = DMOV_HSUART1_TX_CRCI,
125 .end = DMOV_HSUART1_RX_CRCI,
126 .name = "uartdm_crci",
127 .flags = IORESOURCE_DMA,
128 },
129};
130
131static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32);
132
133struct platform_device msm_device_uart_dm1 = {
134 .name = "msm_serial_hs",
135 .id = 0,
136 .num_resources = ARRAY_SIZE(msm_uart1_dm_resources),
137 .resource = msm_uart1_dm_resources,
138 .dev = {
139 .dma_mask = &msm_uart_dm1_dma_mask,
140 .coherent_dma_mask = DMA_BIT_MASK(32),
141 },
142};
143
144static struct resource msm_uart2_dm_resources[] = {
145 {
146 .start = MSM_UART2DM_PHYS,
147 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
148 .flags = IORESOURCE_MEM,
149 },
150 {
151 .start = INT_UART2DM_IRQ,
152 .end = INT_UART2DM_IRQ,
153 .flags = IORESOURCE_IRQ,
154 },
155 {
156 .start = INT_UART2DM_RX,
157 .end = INT_UART2DM_RX,
158 .flags = IORESOURCE_IRQ,
159 },
160 {
161 .start = DMOV_HSUART2_TX_CHAN,
162 .end = DMOV_HSUART2_RX_CHAN,
163 .name = "uartdm_channels",
164 .flags = IORESOURCE_DMA,
165 },
166 {
167 .start = DMOV_HSUART2_TX_CRCI,
168 .end = DMOV_HSUART2_RX_CRCI,
169 .name = "uartdm_crci",
170 .flags = IORESOURCE_DMA,
171 },
172};
173
174static u64 msm_uart_dm2_dma_mask = DMA_BIT_MASK(32);
175
176struct platform_device msm_device_uart_dm2 = {
177 .name = "msm_serial_hs",
178 .id = 1,
179 .num_resources = ARRAY_SIZE(msm_uart2_dm_resources),
180 .resource = msm_uart2_dm_resources,
181 .dev = {
182 .dma_mask = &msm_uart_dm2_dma_mask,
183 .coherent_dma_mask = DMA_BIT_MASK(32),
184 },
185};
186
187#define MSM_I2C_SIZE SZ_4K
188#define MSM_I2C_PHYS 0xA9900000
189
190static struct resource resources_i2c[] = {
191 {
192 .start = MSM_I2C_PHYS,
193 .end = MSM_I2C_PHYS + MSM_I2C_SIZE - 1,
194 .flags = IORESOURCE_MEM,
195 },
196 {
197 .start = INT_PWB_I2C,
198 .end = INT_PWB_I2C,
199 .flags = IORESOURCE_IRQ,
200 },
201};
202
203struct platform_device msm_device_i2c = {
204 .name = "msm_i2c",
205 .id = 0,
206 .num_resources = ARRAY_SIZE(resources_i2c),
207 .resource = resources_i2c,
208};
209
210#define MSM_HSUSB_PHYS 0xA0800000
211static struct resource resources_hsusb_otg[] = {
212 {
213 .start = MSM_HSUSB_PHYS,
214 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
215 .flags = IORESOURCE_MEM,
216 },
217 {
218 .start = INT_USB_HS,
219 .end = INT_USB_HS,
220 .flags = IORESOURCE_IRQ,
221 },
222};
223
224static u64 dma_mask = 0xffffffffULL;
225struct platform_device msm_device_hsusb_otg = {
226 .name = "msm_hsusb_otg",
227 .id = -1,
228 .num_resources = ARRAY_SIZE(resources_hsusb_otg),
229 .resource = resources_hsusb_otg,
230 .dev = {
231 .dma_mask = &dma_mask,
232 .coherent_dma_mask = 0xffffffffULL,
233 },
234};
235
236static struct resource resources_hsusb_peripheral[] = {
237 {
238 .start = MSM_HSUSB_PHYS,
239 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
240 .flags = IORESOURCE_MEM,
241 },
242 {
243 .start = INT_USB_HS,
244 .end = INT_USB_HS,
245 .flags = IORESOURCE_IRQ,
246 },
247};
248
249static struct resource resources_gadget_peripheral[] = {
250 {
251 .start = MSM_HSUSB_PHYS,
252 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
253 .flags = IORESOURCE_MEM,
254 },
255 {
256 .start = INT_USB_HS,
257 .end = INT_USB_HS,
258 .flags = IORESOURCE_IRQ,
259 },
260};
261
262struct platform_device msm_device_hsusb_peripheral = {
263 .name = "msm_hsusb_peripheral",
264 .id = -1,
265 .num_resources = ARRAY_SIZE(resources_hsusb_peripheral),
266 .resource = resources_hsusb_peripheral,
267 .dev = {
268 .dma_mask = &dma_mask,
269 .coherent_dma_mask = 0xffffffffULL,
270 },
271};
272
273struct platform_device msm_device_gadget_peripheral = {
274 .name = "msm_hsusb",
275 .id = -1,
276 .num_resources = ARRAY_SIZE(resources_gadget_peripheral),
277 .resource = resources_gadget_peripheral,
278 .dev = {
279 .dma_mask = &dma_mask,
280 .coherent_dma_mask = 0xffffffffULL,
281 },
282};
283
284#ifdef CONFIG_USB_FS_HOST
285#define MSM_HS2USB_PHYS 0xA0800400
286static struct resource resources_hsusb_host2[] = {
287 {
288 .start = MSM_HS2USB_PHYS,
289 .end = MSM_HS2USB_PHYS + SZ_1K - 1,
290 .flags = IORESOURCE_MEM,
291 },
292 {
293 .start = INT_USB_OTG,
294 .end = INT_USB_OTG,
295 .flags = IORESOURCE_IRQ,
296 },
297};
298
299struct platform_device msm_device_hsusb_host2 = {
300 .name = "msm_hsusb_host",
301 .id = 1,
302 .num_resources = ARRAY_SIZE(resources_hsusb_host2),
303 .resource = resources_hsusb_host2,
304 .dev = {
305 .dma_mask = &dma_mask,
306 .coherent_dma_mask = 0xffffffffULL,
307 },
308};
309#endif
310
311static struct resource resources_hsusb_host[] = {
312 {
313 .start = MSM_HSUSB_PHYS,
314 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
315 .flags = IORESOURCE_MEM,
316 },
317 {
318 .start = INT_USB_HS,
319 .end = INT_USB_HS,
320 .flags = IORESOURCE_IRQ,
321 },
322};
323
324struct platform_device msm_device_hsusb_host = {
325 .name = "msm_hsusb_host",
326 .id = 0,
327 .num_resources = ARRAY_SIZE(resources_hsusb_host),
328 .resource = resources_hsusb_host,
329 .dev = {
330 .dma_mask = &dma_mask,
331 .coherent_dma_mask = 0xffffffffULL,
332 },
333};
334
335static struct platform_device *msm_host_devices[] = {
336 &msm_device_hsusb_host,
337#ifdef CONFIG_USB_FS_HOST
338 &msm_device_hsusb_host2,
339#endif
340};
341
342int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
343{
344 struct platform_device *pdev;
345
346 pdev = msm_host_devices[host];
347 if (!pdev)
348 return -ENODEV;
349 pdev->dev.platform_data = plat;
350 return platform_device_register(pdev);
351}
352
353#ifdef CONFIG_USB_ANDROID
354struct usb_diag_platform_data usb_diag_pdata = {
355 .ch_name = DIAG_LEGACY,
356 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
357};
358
359struct platform_device usb_diag_device = {
360 .name = "usb_diag",
361 .id = -1,
362 .dev = {
363 .platform_data = &usb_diag_pdata,
364 },
365};
366#endif
367
368#ifdef CONFIG_USB_F_SERIAL
369static struct usb_gadget_fserial_platform_data fserial_pdata = {
370 .no_ports = 2,
371};
372
373struct platform_device usb_gadget_fserial_device = {
374 .name = "usb_fserial",
375 .id = -1,
376 .dev = {
377 .platform_data = &fserial_pdata,
378 },
379};
380#endif
381
382#define MSM_NAND_PHYS 0xA0A00000
383static struct resource resources_nand[] = {
384 [0] = {
385 .name = "msm_nand_dmac",
386 .start = DMOV_NAND_CHAN,
387 .end = DMOV_NAND_CHAN,
388 .flags = IORESOURCE_DMA,
389 },
390 [1] = {
391 .name = "msm_nand_phys",
392 .start = MSM_NAND_PHYS,
393 .end = MSM_NAND_PHYS + 0x7FF,
394 .flags = IORESOURCE_MEM,
395 },
Niranjana Vishwanathapura88b52272010-10-06 13:52:11 -0700396};
397
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530398static struct resource resources_otg[] = {
399 {
400 .start = MSM_HSUSB_PHYS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700401 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530402 .flags = IORESOURCE_MEM,
403 },
404 {
405 .start = INT_USB_HS,
406 .end = INT_USB_HS,
407 .flags = IORESOURCE_IRQ,
408 },
409};
410
411struct platform_device msm_device_otg = {
412 .name = "msm_otg",
413 .id = -1,
414 .num_resources = ARRAY_SIZE(resources_otg),
415 .resource = resources_otg,
416 .dev = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700417 .coherent_dma_mask = 0xffffffffULL,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530418 },
419};
420
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700421struct flash_platform_data msm_nand_data = {
422 .parts = NULL,
423 .nr_parts = 0,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530424};
425
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700426struct platform_device msm_device_nand = {
427 .name = "msm_nand",
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530428 .id = -1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700429 .num_resources = ARRAY_SIZE(resources_nand),
430 .resource = resources_nand,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530431 .dev = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700432 .platform_data = &msm_nand_data,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530433 },
434};
435
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700436struct platform_device msm_device_smd = {
437 .name = "msm_smd",
438 .id = -1,
439};
440
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700441static struct resource msm_dmov_resource[] = {
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530442 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700443 .start = INT_ADM_AARM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700444 .flags = IORESOURCE_IRQ,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530445 },
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700446 {
447 .start = 0xA9700000,
448 .end = 0xA9700000 + SZ_4K - 1,
449 .flags = IORESOURCE_MEM,
450 },
451};
452
453static struct msm_dmov_pdata msm_dmov_pdata = {
454 .sd = 3,
455 .sd_size = 0x400,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530456};
457
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700458struct platform_device msm_device_dmov = {
459 .name = "msm_dmov",
460 .id = -1,
461 .resource = msm_dmov_resource,
462 .num_resources = ARRAY_SIZE(msm_dmov_resource),
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700463 .dev = {
464 .platform_data = &msm_dmov_pdata,
465 },
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530466};
467
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700468#define MSM_SDC1_BASE 0xA0300000
469#define MSM_SDC2_BASE 0xA0400000
470#define MSM_SDC3_BASE 0xA0500000
471#define MSM_SDC4_BASE 0xA0600000
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530472static struct resource resources_sdc1[] = {
473 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700474 .start = MSM_SDC1_BASE,
475 .end = MSM_SDC1_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530476 .flags = IORESOURCE_MEM,
477 },
478 {
479 .start = INT_SDC1_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530480 .end = INT_SDC1_1,
481 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530482 },
483 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700484 .name = "sdcc_dma_chnl",
485 .start = DMOV_SDC1_CHAN,
486 .end = DMOV_SDC1_CHAN,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530487 .flags = IORESOURCE_DMA,
488 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700489 {
490 .name = "sdcc_dma_crci",
491 .start = DMOV_SDC1_CRCI,
492 .end = DMOV_SDC1_CRCI,
493 .flags = IORESOURCE_DMA,
494 }
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530495};
496
497static struct resource resources_sdc2[] = {
498 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700499 .start = MSM_SDC2_BASE,
500 .end = MSM_SDC2_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530501 .flags = IORESOURCE_MEM,
502 },
503 {
504 .start = INT_SDC2_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530505 .end = INT_SDC2_1,
506 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530507 },
508 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700509 .name = "sdcc_dma_chnl",
510 .start = DMOV_SDC2_CHAN,
511 .end = DMOV_SDC2_CHAN,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530512 .flags = IORESOURCE_DMA,
513 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700514 {
515 .name = "sdcc_dma_crci",
516 .start = DMOV_SDC2_CRCI,
517 .end = DMOV_SDC2_CRCI,
518 .flags = IORESOURCE_DMA,
519 }
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530520};
521
522static struct resource resources_sdc3[] = {
523 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700524 .start = MSM_SDC3_BASE,
525 .end = MSM_SDC3_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530526 .flags = IORESOURCE_MEM,
527 },
528 {
529 .start = INT_SDC3_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530530 .end = INT_SDC3_1,
531 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530532 },
533 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700534 .name = "sdcc_dma_chnl",
535 .start = DMOV_SDC3_CHAN,
536 .end = DMOV_SDC3_CHAN,
537 .flags = IORESOURCE_DMA,
538 },
539 {
540 .name = "sdcc_dma_crci",
541 .start = DMOV_SDC3_CRCI,
542 .end = DMOV_SDC3_CRCI,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530543 .flags = IORESOURCE_DMA,
544 },
545};
546
547static struct resource resources_sdc4[] = {
548 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700549 .start = MSM_SDC4_BASE,
550 .end = MSM_SDC4_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530551 .flags = IORESOURCE_MEM,
552 },
553 {
554 .start = INT_SDC4_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530555 .end = INT_SDC4_1,
556 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530557 },
558 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700559 .name = "sdcc_dma_chnl",
560 .start = DMOV_SDC4_CHAN,
561 .end = DMOV_SDC4_CHAN,
562 .flags = IORESOURCE_DMA,
563 },
564 {
565 .name = "sdcc_dma_crci",
566 .start = DMOV_SDC4_CRCI,
567 .end = DMOV_SDC4_CRCI,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530568 .flags = IORESOURCE_DMA,
569 },
570};
571
572struct platform_device msm_device_sdc1 = {
573 .name = "msm_sdcc",
574 .id = 1,
575 .num_resources = ARRAY_SIZE(resources_sdc1),
576 .resource = resources_sdc1,
577 .dev = {
578 .coherent_dma_mask = 0xffffffff,
579 },
580};
581
582struct platform_device msm_device_sdc2 = {
583 .name = "msm_sdcc",
584 .id = 2,
585 .num_resources = ARRAY_SIZE(resources_sdc2),
586 .resource = resources_sdc2,
587 .dev = {
588 .coherent_dma_mask = 0xffffffff,
589 },
590};
591
592struct platform_device msm_device_sdc3 = {
593 .name = "msm_sdcc",
594 .id = 3,
595 .num_resources = ARRAY_SIZE(resources_sdc3),
596 .resource = resources_sdc3,
597 .dev = {
598 .coherent_dma_mask = 0xffffffff,
599 },
600};
601
602struct platform_device msm_device_sdc4 = {
603 .name = "msm_sdcc",
604 .id = 4,
605 .num_resources = ARRAY_SIZE(resources_sdc4),
606 .resource = resources_sdc4,
607 .dev = {
608 .coherent_dma_mask = 0xffffffff,
609 },
610};
611
612static struct platform_device *msm_sdcc_devices[] __initdata = {
613 &msm_device_sdc1,
614 &msm_device_sdc2,
615 &msm_device_sdc3,
616 &msm_device_sdc4,
617};
618
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700619int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530620{
621 struct platform_device *pdev;
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530622
623 if (controller < 1 || controller > 4)
624 return -EINVAL;
625
626 pdev = msm_sdcc_devices[controller-1];
627 pdev->dev.platform_data = plat;
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530628 return platform_device_register(pdev);
629}
630
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700631#if defined(CONFIG_FB_MSM_MDP40)
632#define MDP_BASE 0xA3F00000
633#define PMDH_BASE 0xAD600000
634#define EMDH_BASE 0xAD700000
635#define TVENC_BASE 0xAD400000
636#else
637#define MDP_BASE 0xAA200000
638#define PMDH_BASE 0xAA600000
639#define EMDH_BASE 0xAA700000
640#define TVENC_BASE 0xAA400000
641#endif
642
643static struct resource msm_mdp_resources[] = {
644 {
645 .name = "mdp",
646 .start = MDP_BASE,
647 .end = MDP_BASE + 0x000F0000 - 1,
648 .flags = IORESOURCE_MEM,
649 },
650 {
651 .start = INT_MDP,
652 .end = INT_MDP,
653 .flags = IORESOURCE_IRQ,
654 },
Daniel Walker62a6cc52010-05-05 07:27:16 -0700655};
656
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700657static struct resource msm_mddi_resources[] = {
658 {
659 .name = "pmdh",
660 .start = PMDH_BASE,
661 .end = PMDH_BASE + PAGE_SIZE - 1,
662 .flags = IORESOURCE_MEM,
663 }
664};
665
666static struct resource msm_mddi_ext_resources[] = {
667 {
668 .name = "emdh",
669 .start = EMDH_BASE,
670 .end = EMDH_BASE + PAGE_SIZE - 1,
671 .flags = IORESOURCE_MEM,
672 }
673};
674
675static struct resource msm_ebi2_lcd_resources[] = {
676 {
677 .name = "base",
678 .start = 0xa0d00000,
679 .end = 0xa0d00000 + PAGE_SIZE - 1,
680 .flags = IORESOURCE_MEM,
681 },
682 {
683 .name = "lcd01",
684 .start = 0x98000000,
685 .end = 0x98000000 + 0x80000 - 1,
686 .flags = IORESOURCE_MEM,
687 },
688 {
689 .name = "lcd02",
690 .start = 0x9c000000,
691 .end = 0x9c000000 + 0x80000 - 1,
692 .flags = IORESOURCE_MEM,
693 },
694};
695
696static struct resource msm_tvenc_resources[] = {
697 {
698 .name = "tvenc",
699 .start = TVENC_BASE,
700 .end = TVENC_BASE + PAGE_SIZE - 1,
701 .flags = IORESOURCE_MEM,
702 }
703};
704
705static struct platform_device msm_mdp_device = {
706 .name = "mdp",
707 .id = 0,
708 .num_resources = ARRAY_SIZE(msm_mdp_resources),
709 .resource = msm_mdp_resources,
710};
711
712static struct platform_device msm_mddi_device = {
713 .name = "mddi",
714 .id = 0,
715 .num_resources = ARRAY_SIZE(msm_mddi_resources),
716 .resource = msm_mddi_resources,
717};
718
719static struct platform_device msm_mddi_ext_device = {
720 .name = "mddi_ext",
721 .id = 0,
722 .num_resources = ARRAY_SIZE(msm_mddi_ext_resources),
723 .resource = msm_mddi_ext_resources,
724};
725
726static struct platform_device msm_ebi2_lcd_device = {
727 .name = "ebi2_lcd",
728 .id = 0,
729 .num_resources = ARRAY_SIZE(msm_ebi2_lcd_resources),
730 .resource = msm_ebi2_lcd_resources,
731};
732
733static struct platform_device msm_lcdc_device = {
734 .name = "lcdc",
735 .id = 0,
736};
737
738static struct platform_device msm_tvenc_device = {
739 .name = "tvenc",
740 .id = 0,
741 .num_resources = ARRAY_SIZE(msm_tvenc_resources),
742 .resource = msm_tvenc_resources,
743};
744
745#if defined(CONFIG_MSM_SOC_REV_A)
746#define MSM_QUP_PHYS 0xA1680000
747#define MSM_GSBI_QUP_I2C_PHYS 0xA1600000
748#define INT_PWB_QUP_ERR INT_GSBI_QUP
749#else
750#define MSM_QUP_PHYS 0xA9900000
751#define MSM_GSBI_QUP_I2C_PHYS 0xA9900000
752#define INT_PWB_QUP_ERR INT_PWB_I2C
753#endif
754#define MSM_QUP_SIZE SZ_4K
755static struct resource resources_qup[] = {
756 {
757 .name = "qup_phys_addr",
758 .start = MSM_QUP_PHYS,
759 .end = MSM_QUP_PHYS + MSM_QUP_SIZE - 1,
760 .flags = IORESOURCE_MEM,
761 },
762 {
763 .name = "gsbi_qup_i2c_addr",
764 .start = MSM_GSBI_QUP_I2C_PHYS,
765 .end = MSM_GSBI_QUP_I2C_PHYS + 4 - 1,
766 .flags = IORESOURCE_MEM,
767 },
768 {
769 .name = "qup_err_intr",
770 .start = INT_PWB_QUP_ERR,
771 .end = INT_PWB_QUP_ERR,
772 .flags = IORESOURCE_IRQ,
773 },
774};
775
776struct platform_device qup_device_i2c = {
777 .name = "qup_i2c",
778 .id = 4,
779 .num_resources = ARRAY_SIZE(resources_qup),
780 .resource = resources_qup,
781};
782
783/* TSIF begin */
784#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
785
786#define MSM_TSIF_PHYS (0xa0100000)
787#define MSM_TSIF_SIZE (0x200)
788
789static struct resource tsif_resources[] = {
790 [0] = {
791 .flags = IORESOURCE_IRQ,
792 .start = INT_TSIF_IRQ,
793 .end = INT_TSIF_IRQ,
794 },
795 [1] = {
796 .flags = IORESOURCE_MEM,
797 .start = MSM_TSIF_PHYS,
798 .end = MSM_TSIF_PHYS + MSM_TSIF_SIZE - 1,
799 },
800 [2] = {
801 .flags = IORESOURCE_DMA,
802 .start = DMOV_TSIF_CHAN,
803 .end = DMOV_TSIF_CRCI,
804 },
805};
806
807static void tsif_release(struct device *dev)
808{
809 dev_info(dev, "release\n");
810}
811
812struct platform_device msm_device_tsif = {
813 .name = "msm_tsif",
814 .id = 0,
815 .num_resources = ARRAY_SIZE(tsif_resources),
816 .resource = tsif_resources,
817 .dev = {
818 .release = tsif_release,
819 },
820};
821#endif /* defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) */
822/* TSIF end */
823
824#define MSM_TSSC_PHYS 0xAA300000
825static struct resource resources_tssc[] = {
826 {
827 .start = MSM_TSSC_PHYS,
828 .end = MSM_TSSC_PHYS + SZ_4K - 1,
829 .name = "tssc",
830 .flags = IORESOURCE_MEM,
831 },
832 {
833 .start = INT_TCHSCRN1,
834 .end = INT_TCHSCRN1,
835 .name = "tssc1",
836 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
837 },
838 {
839 .start = INT_TCHSCRN2,
840 .end = INT_TCHSCRN2,
841 .name = "tssc2",
842 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
843 },
844};
845
846struct platform_device msm_device_tssc = {
847 .name = "msm_touchscreen",
848 .id = 0,
849 .num_resources = ARRAY_SIZE(resources_tssc),
850 .resource = resources_tssc,
851};
852
853static void __init msm_register_device(struct platform_device *pdev, void *data)
854{
855 int ret;
856
857 pdev->dev.platform_data = data;
858
859 ret = platform_device_register(pdev);
860 if (ret)
861 dev_err(&pdev->dev,
862 "%s: platform_device_register() failed = %d\n",
863 __func__, ret);
864}
865
866void __init msm_fb_register_device(char *name, void *data)
867{
868 if (!strncmp(name, "mdp", 3))
869 msm_register_device(&msm_mdp_device, data);
870 else if (!strncmp(name, "pmdh", 4))
871 msm_register_device(&msm_mddi_device, data);
872 else if (!strncmp(name, "emdh", 4))
873 msm_register_device(&msm_mddi_ext_device, data);
874 else if (!strncmp(name, "ebi2", 4))
875 msm_register_device(&msm_ebi2_lcd_device, data);
876 else if (!strncmp(name, "tvenc", 5))
877 msm_register_device(&msm_tvenc_device, data);
878 else if (!strncmp(name, "lcdc", 4))
879 msm_register_device(&msm_lcdc_device, data);
880 else
881 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
882}
883
884static struct platform_device msm_camera_device = {
885 .name = "msm_camera",
886 .id = 0,
887};
888
889void __init msm_camera_register_device(void *res, uint32_t num,
890 void *data)
891{
892 msm_camera_device.num_resources = num;
893 msm_camera_device.resource = res;
894
895 msm_register_device(&msm_camera_device, data);
896}
897
898static struct resource kgsl_3d0_resources[] = {
899 {
900 .name = KGSL_3D0_REG_MEMORY,
901 .start = 0xA0000000,
902 .end = 0xA001ffff,
903 .flags = IORESOURCE_MEM,
904 },
905 {
906 .name = KGSL_3D0_IRQ,
907 .start = INT_GRAPHICS,
908 .end = INT_GRAPHICS,
909 .flags = IORESOURCE_IRQ,
910 },
911};
912
913static struct kgsl_device_platform_data kgsl_3d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600914 .pwrlevel = {
915 {
916 .gpu_freq = 0,
917 .bus_freq = 128000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700918 },
919 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600920 .init_level = 0,
921 .num_levels = 1,
922 .set_grp_async = NULL,
923 .idle_timeout = HZ/5,
924 .clk_map = KGSL_CLK_CORE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700925};
926
927struct platform_device msm_kgsl_3d0 = {
928 .name = "kgsl-3d0",
929 .id = 0,
930 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
931 .resource = kgsl_3d0_resources,
932 .dev = {
933 .platform_data = &kgsl_3d0_pdata,
934 },
935};
Daniel Walker62a6cc52010-05-05 07:27:16 -0700936