blob: 05efcdf78ea3fc2c746e7ba71752e609349eed7b [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>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070035#include <mach/rpc_hsusb.h>
36
37static struct resource resources_uart1[] = {
38 {
39 .start = INT_UART1,
40 .end = INT_UART1,
41 .flags = IORESOURCE_IRQ,
42 },
43 {
44 .start = MSM_UART1_PHYS,
45 .end = MSM_UART1_PHYS + MSM_UART1_SIZE - 1,
46 .flags = IORESOURCE_MEM,
47 },
48};
49
50static struct resource resources_uart2[] = {
51 {
52 .start = INT_UART2,
53 .end = INT_UART2,
54 .flags = IORESOURCE_IRQ,
55 },
56 {
57 .start = MSM_UART2_PHYS,
58 .end = MSM_UART2_PHYS + MSM_UART2_SIZE - 1,
59 .flags = IORESOURCE_MEM,
60 },
61};
Daniel Walker62a6cc52010-05-05 07:27:16 -070062
63static struct resource resources_uart3[] = {
64 {
65 .start = INT_UART3,
66 .end = INT_UART3,
67 .flags = IORESOURCE_IRQ,
68 },
69 {
70 .start = MSM_UART3_PHYS,
71 .end = MSM_UART3_PHYS + MSM_UART3_SIZE - 1,
72 .flags = IORESOURCE_MEM,
Stepan Moskovchenkod41cb8c2011-01-17 20:33:32 -080073 .name = "uart_resource"
Daniel Walker62a6cc52010-05-05 07:27:16 -070074 },
75};
76
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070077struct platform_device msm_device_uart1 = {
78 .name = "msm_serial",
79 .id = 0,
80 .num_resources = ARRAY_SIZE(resources_uart1),
81 .resource = resources_uart1,
82};
83
84struct platform_device msm_device_uart2 = {
85 .name = "msm_serial",
86 .id = 1,
87 .num_resources = ARRAY_SIZE(resources_uart2),
88 .resource = resources_uart2,
89};
90
Daniel Walker62a6cc52010-05-05 07:27:16 -070091struct platform_device msm_device_uart3 = {
92 .name = "msm_serial",
93 .id = 2,
94 .num_resources = ARRAY_SIZE(resources_uart3),
95 .resource = resources_uart3,
96};
97
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070098#define MSM_UART1DM_PHYS 0xA0200000
99#define MSM_UART2DM_PHYS 0xA0900000
100static struct resource msm_uart1_dm_resources[] = {
101 {
102 .start = MSM_UART1DM_PHYS,
103 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
104 .flags = IORESOURCE_MEM,
105 },
106 {
107 .start = INT_UART1DM_IRQ,
108 .end = INT_UART1DM_IRQ,
109 .flags = IORESOURCE_IRQ,
110 },
111 {
112 .start = INT_UART1DM_RX,
113 .end = INT_UART1DM_RX,
114 .flags = IORESOURCE_IRQ,
115 },
116 {
117 .start = DMOV_HSUART1_TX_CHAN,
118 .end = DMOV_HSUART1_RX_CHAN,
119 .name = "uartdm_channels",
120 .flags = IORESOURCE_DMA,
121 },
122 {
123 .start = DMOV_HSUART1_TX_CRCI,
124 .end = DMOV_HSUART1_RX_CRCI,
125 .name = "uartdm_crci",
126 .flags = IORESOURCE_DMA,
127 },
128};
129
130static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32);
131
132struct platform_device msm_device_uart_dm1 = {
133 .name = "msm_serial_hs",
134 .id = 0,
135 .num_resources = ARRAY_SIZE(msm_uart1_dm_resources),
136 .resource = msm_uart1_dm_resources,
137 .dev = {
138 .dma_mask = &msm_uart_dm1_dma_mask,
139 .coherent_dma_mask = DMA_BIT_MASK(32),
140 },
141};
142
143static struct resource msm_uart2_dm_resources[] = {
144 {
145 .start = MSM_UART2DM_PHYS,
146 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
147 .flags = IORESOURCE_MEM,
148 },
149 {
150 .start = INT_UART2DM_IRQ,
151 .end = INT_UART2DM_IRQ,
152 .flags = IORESOURCE_IRQ,
153 },
154 {
155 .start = INT_UART2DM_RX,
156 .end = INT_UART2DM_RX,
157 .flags = IORESOURCE_IRQ,
158 },
159 {
160 .start = DMOV_HSUART2_TX_CHAN,
161 .end = DMOV_HSUART2_RX_CHAN,
162 .name = "uartdm_channels",
163 .flags = IORESOURCE_DMA,
164 },
165 {
166 .start = DMOV_HSUART2_TX_CRCI,
167 .end = DMOV_HSUART2_RX_CRCI,
168 .name = "uartdm_crci",
169 .flags = IORESOURCE_DMA,
170 },
171};
172
173static u64 msm_uart_dm2_dma_mask = DMA_BIT_MASK(32);
174
175struct platform_device msm_device_uart_dm2 = {
176 .name = "msm_serial_hs",
177 .id = 1,
178 .num_resources = ARRAY_SIZE(msm_uart2_dm_resources),
179 .resource = msm_uart2_dm_resources,
180 .dev = {
181 .dma_mask = &msm_uart_dm2_dma_mask,
182 .coherent_dma_mask = DMA_BIT_MASK(32),
183 },
184};
185
186#define MSM_I2C_SIZE SZ_4K
187#define MSM_I2C_PHYS 0xA9900000
188
189static struct resource resources_i2c[] = {
190 {
191 .start = MSM_I2C_PHYS,
192 .end = MSM_I2C_PHYS + MSM_I2C_SIZE - 1,
193 .flags = IORESOURCE_MEM,
194 },
195 {
196 .start = INT_PWB_I2C,
197 .end = INT_PWB_I2C,
198 .flags = IORESOURCE_IRQ,
199 },
200};
201
202struct platform_device msm_device_i2c = {
203 .name = "msm_i2c",
204 .id = 0,
205 .num_resources = ARRAY_SIZE(resources_i2c),
206 .resource = resources_i2c,
207};
208
209#define MSM_HSUSB_PHYS 0xA0800000
210static struct resource resources_hsusb_otg[] = {
211 {
212 .start = MSM_HSUSB_PHYS,
213 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
214 .flags = IORESOURCE_MEM,
215 },
216 {
217 .start = INT_USB_HS,
218 .end = INT_USB_HS,
219 .flags = IORESOURCE_IRQ,
220 },
221};
222
223static u64 dma_mask = 0xffffffffULL;
224struct platform_device msm_device_hsusb_otg = {
225 .name = "msm_hsusb_otg",
226 .id = -1,
227 .num_resources = ARRAY_SIZE(resources_hsusb_otg),
228 .resource = resources_hsusb_otg,
229 .dev = {
230 .dma_mask = &dma_mask,
231 .coherent_dma_mask = 0xffffffffULL,
232 },
233};
234
235static struct resource resources_hsusb_peripheral[] = {
236 {
237 .start = MSM_HSUSB_PHYS,
238 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
239 .flags = IORESOURCE_MEM,
240 },
241 {
242 .start = INT_USB_HS,
243 .end = INT_USB_HS,
244 .flags = IORESOURCE_IRQ,
245 },
246};
247
248static struct resource resources_gadget_peripheral[] = {
249 {
250 .start = MSM_HSUSB_PHYS,
251 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
252 .flags = IORESOURCE_MEM,
253 },
254 {
255 .start = INT_USB_HS,
256 .end = INT_USB_HS,
257 .flags = IORESOURCE_IRQ,
258 },
259};
260
261struct platform_device msm_device_hsusb_peripheral = {
262 .name = "msm_hsusb_peripheral",
263 .id = -1,
264 .num_resources = ARRAY_SIZE(resources_hsusb_peripheral),
265 .resource = resources_hsusb_peripheral,
266 .dev = {
267 .dma_mask = &dma_mask,
268 .coherent_dma_mask = 0xffffffffULL,
269 },
270};
271
272struct platform_device msm_device_gadget_peripheral = {
273 .name = "msm_hsusb",
274 .id = -1,
275 .num_resources = ARRAY_SIZE(resources_gadget_peripheral),
276 .resource = resources_gadget_peripheral,
277 .dev = {
278 .dma_mask = &dma_mask,
279 .coherent_dma_mask = 0xffffffffULL,
280 },
281};
282
283#ifdef CONFIG_USB_FS_HOST
284#define MSM_HS2USB_PHYS 0xA0800400
285static struct resource resources_hsusb_host2[] = {
286 {
287 .start = MSM_HS2USB_PHYS,
288 .end = MSM_HS2USB_PHYS + SZ_1K - 1,
289 .flags = IORESOURCE_MEM,
290 },
291 {
292 .start = INT_USB_OTG,
293 .end = INT_USB_OTG,
294 .flags = IORESOURCE_IRQ,
295 },
296};
297
298struct platform_device msm_device_hsusb_host2 = {
299 .name = "msm_hsusb_host",
300 .id = 1,
301 .num_resources = ARRAY_SIZE(resources_hsusb_host2),
302 .resource = resources_hsusb_host2,
303 .dev = {
304 .dma_mask = &dma_mask,
305 .coherent_dma_mask = 0xffffffffULL,
306 },
307};
308#endif
309
310static struct resource resources_hsusb_host[] = {
311 {
312 .start = MSM_HSUSB_PHYS,
313 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
314 .flags = IORESOURCE_MEM,
315 },
316 {
317 .start = INT_USB_HS,
318 .end = INT_USB_HS,
319 .flags = IORESOURCE_IRQ,
320 },
321};
322
323struct platform_device msm_device_hsusb_host = {
324 .name = "msm_hsusb_host",
325 .id = 0,
326 .num_resources = ARRAY_SIZE(resources_hsusb_host),
327 .resource = resources_hsusb_host,
328 .dev = {
329 .dma_mask = &dma_mask,
330 .coherent_dma_mask = 0xffffffffULL,
331 },
332};
333
334static struct platform_device *msm_host_devices[] = {
335 &msm_device_hsusb_host,
336#ifdef CONFIG_USB_FS_HOST
337 &msm_device_hsusb_host2,
338#endif
339};
340
341int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
342{
343 struct platform_device *pdev;
344
345 pdev = msm_host_devices[host];
346 if (!pdev)
347 return -ENODEV;
348 pdev->dev.platform_data = plat;
349 return platform_device_register(pdev);
350}
351
352#ifdef CONFIG_USB_ANDROID
353struct usb_diag_platform_data usb_diag_pdata = {
354 .ch_name = DIAG_LEGACY,
355 .update_pid_and_serial_num = usb_diag_update_pid_and_serial_num,
356};
357
358struct platform_device usb_diag_device = {
359 .name = "usb_diag",
360 .id = -1,
361 .dev = {
362 .platform_data = &usb_diag_pdata,
363 },
364};
365#endif
366
367#ifdef CONFIG_USB_F_SERIAL
368static struct usb_gadget_fserial_platform_data fserial_pdata = {
369 .no_ports = 2,
370};
371
372struct platform_device usb_gadget_fserial_device = {
373 .name = "usb_fserial",
374 .id = -1,
375 .dev = {
376 .platform_data = &fserial_pdata,
377 },
378};
379#endif
380
381#define MSM_NAND_PHYS 0xA0A00000
382static struct resource resources_nand[] = {
383 [0] = {
384 .name = "msm_nand_dmac",
385 .start = DMOV_NAND_CHAN,
386 .end = DMOV_NAND_CHAN,
387 .flags = IORESOURCE_DMA,
388 },
389 [1] = {
390 .name = "msm_nand_phys",
391 .start = MSM_NAND_PHYS,
392 .end = MSM_NAND_PHYS + 0x7FF,
393 .flags = IORESOURCE_MEM,
394 },
Niranjana Vishwanathapura88b52272010-10-06 13:52:11 -0700395};
396
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530397static struct resource resources_otg[] = {
398 {
399 .start = MSM_HSUSB_PHYS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700400 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530401 .flags = IORESOURCE_MEM,
402 },
403 {
404 .start = INT_USB_HS,
405 .end = INT_USB_HS,
406 .flags = IORESOURCE_IRQ,
407 },
408};
409
410struct platform_device msm_device_otg = {
411 .name = "msm_otg",
412 .id = -1,
413 .num_resources = ARRAY_SIZE(resources_otg),
414 .resource = resources_otg,
415 .dev = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700416 .coherent_dma_mask = 0xffffffffULL,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530417 },
418};
419
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700420struct flash_platform_data msm_nand_data = {
421 .parts = NULL,
422 .nr_parts = 0,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530423};
424
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700425struct platform_device msm_device_nand = {
426 .name = "msm_nand",
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530427 .id = -1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700428 .num_resources = ARRAY_SIZE(resources_nand),
429 .resource = resources_nand,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530430 .dev = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700431 .platform_data = &msm_nand_data,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530432 },
433};
434
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700435struct platform_device msm_device_smd = {
436 .name = "msm_smd",
437 .id = -1,
438};
439
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700440static struct resource msm_dmov_resource[] = {
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530441 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700442 .start = INT_ADM_AARM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700443 .flags = IORESOURCE_IRQ,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530444 },
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700445 {
446 .start = 0xA9700000,
447 .end = 0xA9700000 + SZ_4K - 1,
448 .flags = IORESOURCE_MEM,
449 },
450};
451
452static struct msm_dmov_pdata msm_dmov_pdata = {
453 .sd = 3,
454 .sd_size = 0x400,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530455};
456
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700457struct platform_device msm_device_dmov = {
458 .name = "msm_dmov",
459 .id = -1,
460 .resource = msm_dmov_resource,
461 .num_resources = ARRAY_SIZE(msm_dmov_resource),
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700462 .dev = {
463 .platform_data = &msm_dmov_pdata,
464 },
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530465};
466
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700467#define MSM_SDC1_BASE 0xA0300000
468#define MSM_SDC2_BASE 0xA0400000
469#define MSM_SDC3_BASE 0xA0500000
470#define MSM_SDC4_BASE 0xA0600000
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530471static struct resource resources_sdc1[] = {
472 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700473 .start = MSM_SDC1_BASE,
474 .end = MSM_SDC1_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530475 .flags = IORESOURCE_MEM,
476 },
477 {
478 .start = INT_SDC1_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530479 .end = INT_SDC1_1,
480 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530481 },
482 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700483 .name = "sdcc_dma_chnl",
484 .start = DMOV_SDC1_CHAN,
485 .end = DMOV_SDC1_CHAN,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530486 .flags = IORESOURCE_DMA,
487 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700488 {
489 .name = "sdcc_dma_crci",
490 .start = DMOV_SDC1_CRCI,
491 .end = DMOV_SDC1_CRCI,
492 .flags = IORESOURCE_DMA,
493 }
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530494};
495
496static struct resource resources_sdc2[] = {
497 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700498 .start = MSM_SDC2_BASE,
499 .end = MSM_SDC2_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530500 .flags = IORESOURCE_MEM,
501 },
502 {
503 .start = INT_SDC2_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530504 .end = INT_SDC2_1,
505 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530506 },
507 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700508 .name = "sdcc_dma_chnl",
509 .start = DMOV_SDC2_CHAN,
510 .end = DMOV_SDC2_CHAN,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530511 .flags = IORESOURCE_DMA,
512 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700513 {
514 .name = "sdcc_dma_crci",
515 .start = DMOV_SDC2_CRCI,
516 .end = DMOV_SDC2_CRCI,
517 .flags = IORESOURCE_DMA,
518 }
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530519};
520
521static struct resource resources_sdc3[] = {
522 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700523 .start = MSM_SDC3_BASE,
524 .end = MSM_SDC3_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530525 .flags = IORESOURCE_MEM,
526 },
527 {
528 .start = INT_SDC3_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530529 .end = INT_SDC3_1,
530 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530531 },
532 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700533 .name = "sdcc_dma_chnl",
534 .start = DMOV_SDC3_CHAN,
535 .end = DMOV_SDC3_CHAN,
536 .flags = IORESOURCE_DMA,
537 },
538 {
539 .name = "sdcc_dma_crci",
540 .start = DMOV_SDC3_CRCI,
541 .end = DMOV_SDC3_CRCI,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530542 .flags = IORESOURCE_DMA,
543 },
544};
545
546static struct resource resources_sdc4[] = {
547 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700548 .start = MSM_SDC4_BASE,
549 .end = MSM_SDC4_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530550 .flags = IORESOURCE_MEM,
551 },
552 {
553 .start = INT_SDC4_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530554 .end = INT_SDC4_1,
555 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530556 },
557 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700558 .name = "sdcc_dma_chnl",
559 .start = DMOV_SDC4_CHAN,
560 .end = DMOV_SDC4_CHAN,
561 .flags = IORESOURCE_DMA,
562 },
563 {
564 .name = "sdcc_dma_crci",
565 .start = DMOV_SDC4_CRCI,
566 .end = DMOV_SDC4_CRCI,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530567 .flags = IORESOURCE_DMA,
568 },
569};
570
571struct platform_device msm_device_sdc1 = {
572 .name = "msm_sdcc",
573 .id = 1,
574 .num_resources = ARRAY_SIZE(resources_sdc1),
575 .resource = resources_sdc1,
576 .dev = {
577 .coherent_dma_mask = 0xffffffff,
578 },
579};
580
581struct platform_device msm_device_sdc2 = {
582 .name = "msm_sdcc",
583 .id = 2,
584 .num_resources = ARRAY_SIZE(resources_sdc2),
585 .resource = resources_sdc2,
586 .dev = {
587 .coherent_dma_mask = 0xffffffff,
588 },
589};
590
591struct platform_device msm_device_sdc3 = {
592 .name = "msm_sdcc",
593 .id = 3,
594 .num_resources = ARRAY_SIZE(resources_sdc3),
595 .resource = resources_sdc3,
596 .dev = {
597 .coherent_dma_mask = 0xffffffff,
598 },
599};
600
601struct platform_device msm_device_sdc4 = {
602 .name = "msm_sdcc",
603 .id = 4,
604 .num_resources = ARRAY_SIZE(resources_sdc4),
605 .resource = resources_sdc4,
606 .dev = {
607 .coherent_dma_mask = 0xffffffff,
608 },
609};
610
611static struct platform_device *msm_sdcc_devices[] __initdata = {
612 &msm_device_sdc1,
613 &msm_device_sdc2,
614 &msm_device_sdc3,
615 &msm_device_sdc4,
616};
617
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700618int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530619{
620 struct platform_device *pdev;
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530621
622 if (controller < 1 || controller > 4)
623 return -EINVAL;
624
625 pdev = msm_sdcc_devices[controller-1];
626 pdev->dev.platform_data = plat;
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530627 return platform_device_register(pdev);
628}
629
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700630#if defined(CONFIG_FB_MSM_MDP40)
631#define MDP_BASE 0xA3F00000
632#define PMDH_BASE 0xAD600000
633#define EMDH_BASE 0xAD700000
634#define TVENC_BASE 0xAD400000
635#else
636#define MDP_BASE 0xAA200000
637#define PMDH_BASE 0xAA600000
638#define EMDH_BASE 0xAA700000
639#define TVENC_BASE 0xAA400000
640#endif
641
642static struct resource msm_mdp_resources[] = {
643 {
644 .name = "mdp",
645 .start = MDP_BASE,
646 .end = MDP_BASE + 0x000F0000 - 1,
647 .flags = IORESOURCE_MEM,
648 },
649 {
650 .start = INT_MDP,
651 .end = INT_MDP,
652 .flags = IORESOURCE_IRQ,
653 },
Daniel Walker62a6cc52010-05-05 07:27:16 -0700654};
655
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700656static struct resource msm_mddi_resources[] = {
657 {
658 .name = "pmdh",
659 .start = PMDH_BASE,
660 .end = PMDH_BASE + PAGE_SIZE - 1,
661 .flags = IORESOURCE_MEM,
662 }
663};
664
665static struct resource msm_mddi_ext_resources[] = {
666 {
667 .name = "emdh",
668 .start = EMDH_BASE,
669 .end = EMDH_BASE + PAGE_SIZE - 1,
670 .flags = IORESOURCE_MEM,
671 }
672};
673
674static struct resource msm_ebi2_lcd_resources[] = {
675 {
676 .name = "base",
677 .start = 0xa0d00000,
678 .end = 0xa0d00000 + PAGE_SIZE - 1,
679 .flags = IORESOURCE_MEM,
680 },
681 {
682 .name = "lcd01",
683 .start = 0x98000000,
684 .end = 0x98000000 + 0x80000 - 1,
685 .flags = IORESOURCE_MEM,
686 },
687 {
688 .name = "lcd02",
689 .start = 0x9c000000,
690 .end = 0x9c000000 + 0x80000 - 1,
691 .flags = IORESOURCE_MEM,
692 },
693};
694
695static struct resource msm_tvenc_resources[] = {
696 {
697 .name = "tvenc",
698 .start = TVENC_BASE,
699 .end = TVENC_BASE + PAGE_SIZE - 1,
700 .flags = IORESOURCE_MEM,
701 }
702};
703
704static struct platform_device msm_mdp_device = {
705 .name = "mdp",
706 .id = 0,
707 .num_resources = ARRAY_SIZE(msm_mdp_resources),
708 .resource = msm_mdp_resources,
709};
710
711static struct platform_device msm_mddi_device = {
712 .name = "mddi",
713 .id = 0,
714 .num_resources = ARRAY_SIZE(msm_mddi_resources),
715 .resource = msm_mddi_resources,
716};
717
718static struct platform_device msm_mddi_ext_device = {
719 .name = "mddi_ext",
720 .id = 0,
721 .num_resources = ARRAY_SIZE(msm_mddi_ext_resources),
722 .resource = msm_mddi_ext_resources,
723};
724
725static struct platform_device msm_ebi2_lcd_device = {
726 .name = "ebi2_lcd",
727 .id = 0,
728 .num_resources = ARRAY_SIZE(msm_ebi2_lcd_resources),
729 .resource = msm_ebi2_lcd_resources,
730};
731
732static struct platform_device msm_lcdc_device = {
733 .name = "lcdc",
734 .id = 0,
735};
736
737static struct platform_device msm_tvenc_device = {
738 .name = "tvenc",
739 .id = 0,
740 .num_resources = ARRAY_SIZE(msm_tvenc_resources),
741 .resource = msm_tvenc_resources,
742};
743
744#if defined(CONFIG_MSM_SOC_REV_A)
745#define MSM_QUP_PHYS 0xA1680000
746#define MSM_GSBI_QUP_I2C_PHYS 0xA1600000
747#define INT_PWB_QUP_ERR INT_GSBI_QUP
748#else
749#define MSM_QUP_PHYS 0xA9900000
750#define MSM_GSBI_QUP_I2C_PHYS 0xA9900000
751#define INT_PWB_QUP_ERR INT_PWB_I2C
752#endif
753#define MSM_QUP_SIZE SZ_4K
754static struct resource resources_qup[] = {
755 {
756 .name = "qup_phys_addr",
757 .start = MSM_QUP_PHYS,
758 .end = MSM_QUP_PHYS + MSM_QUP_SIZE - 1,
759 .flags = IORESOURCE_MEM,
760 },
761 {
762 .name = "gsbi_qup_i2c_addr",
763 .start = MSM_GSBI_QUP_I2C_PHYS,
764 .end = MSM_GSBI_QUP_I2C_PHYS + 4 - 1,
765 .flags = IORESOURCE_MEM,
766 },
767 {
768 .name = "qup_err_intr",
769 .start = INT_PWB_QUP_ERR,
770 .end = INT_PWB_QUP_ERR,
771 .flags = IORESOURCE_IRQ,
772 },
773};
774
775struct platform_device qup_device_i2c = {
776 .name = "qup_i2c",
777 .id = 4,
778 .num_resources = ARRAY_SIZE(resources_qup),
779 .resource = resources_qup,
780};
781
782/* TSIF begin */
783#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
784
785#define MSM_TSIF_PHYS (0xa0100000)
786#define MSM_TSIF_SIZE (0x200)
787
788static struct resource tsif_resources[] = {
789 [0] = {
790 .flags = IORESOURCE_IRQ,
791 .start = INT_TSIF_IRQ,
792 .end = INT_TSIF_IRQ,
793 },
794 [1] = {
795 .flags = IORESOURCE_MEM,
796 .start = MSM_TSIF_PHYS,
797 .end = MSM_TSIF_PHYS + MSM_TSIF_SIZE - 1,
798 },
799 [2] = {
800 .flags = IORESOURCE_DMA,
801 .start = DMOV_TSIF_CHAN,
802 .end = DMOV_TSIF_CRCI,
803 },
804};
805
806static void tsif_release(struct device *dev)
807{
808 dev_info(dev, "release\n");
809}
810
811struct platform_device msm_device_tsif = {
812 .name = "msm_tsif",
813 .id = 0,
814 .num_resources = ARRAY_SIZE(tsif_resources),
815 .resource = tsif_resources,
816 .dev = {
817 .release = tsif_release,
818 },
819};
820#endif /* defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) */
821/* TSIF end */
822
823#define MSM_TSSC_PHYS 0xAA300000
824static struct resource resources_tssc[] = {
825 {
826 .start = MSM_TSSC_PHYS,
827 .end = MSM_TSSC_PHYS + SZ_4K - 1,
828 .name = "tssc",
829 .flags = IORESOURCE_MEM,
830 },
831 {
832 .start = INT_TCHSCRN1,
833 .end = INT_TCHSCRN1,
834 .name = "tssc1",
835 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
836 },
837 {
838 .start = INT_TCHSCRN2,
839 .end = INT_TCHSCRN2,
840 .name = "tssc2",
841 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
842 },
843};
844
845struct platform_device msm_device_tssc = {
846 .name = "msm_touchscreen",
847 .id = 0,
848 .num_resources = ARRAY_SIZE(resources_tssc),
849 .resource = resources_tssc,
850};
851
852static void __init msm_register_device(struct platform_device *pdev, void *data)
853{
854 int ret;
855
856 pdev->dev.platform_data = data;
857
858 ret = platform_device_register(pdev);
859 if (ret)
860 dev_err(&pdev->dev,
861 "%s: platform_device_register() failed = %d\n",
862 __func__, ret);
863}
864
865void __init msm_fb_register_device(char *name, void *data)
866{
867 if (!strncmp(name, "mdp", 3))
868 msm_register_device(&msm_mdp_device, data);
869 else if (!strncmp(name, "pmdh", 4))
870 msm_register_device(&msm_mddi_device, data);
871 else if (!strncmp(name, "emdh", 4))
872 msm_register_device(&msm_mddi_ext_device, data);
873 else if (!strncmp(name, "ebi2", 4))
874 msm_register_device(&msm_ebi2_lcd_device, data);
875 else if (!strncmp(name, "tvenc", 5))
876 msm_register_device(&msm_tvenc_device, data);
877 else if (!strncmp(name, "lcdc", 4))
878 msm_register_device(&msm_lcdc_device, data);
879 else
880 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
881}
882
883static struct platform_device msm_camera_device = {
884 .name = "msm_camera",
885 .id = 0,
886};
887
888void __init msm_camera_register_device(void *res, uint32_t num,
889 void *data)
890{
891 msm_camera_device.num_resources = num;
892 msm_camera_device.resource = res;
893
894 msm_register_device(&msm_camera_device, data);
895}
896
897static struct resource kgsl_3d0_resources[] = {
898 {
899 .name = KGSL_3D0_REG_MEMORY,
900 .start = 0xA0000000,
901 .end = 0xA001ffff,
902 .flags = IORESOURCE_MEM,
903 },
904 {
905 .name = KGSL_3D0_IRQ,
906 .start = INT_GRAPHICS,
907 .end = INT_GRAPHICS,
908 .flags = IORESOURCE_IRQ,
909 },
910};
911
912static struct kgsl_device_platform_data kgsl_3d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600913 .pwrlevel = {
914 {
915 .gpu_freq = 0,
916 .bus_freq = 128000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700917 },
918 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600919 .init_level = 0,
920 .num_levels = 1,
921 .set_grp_async = NULL,
922 .idle_timeout = HZ/5,
923 .clk_map = KGSL_CLK_CORE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700924};
925
926struct platform_device msm_kgsl_3d0 = {
927 .name = "kgsl-3d0",
928 .id = 0,
929 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
930 .resource = kgsl_3d0_resources,
931 .dev = {
932 .platform_data = &kgsl_3d0_pdata,
933 },
934};
Daniel Walker62a6cc52010-05-05 07:27:16 -0700935