blob: c0caf7039614a7bf107a57625b2a43121fc45b6e [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
441struct resource msm_dmov_resource[] = {
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530442 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700443 .start = INT_ADM_AARM,
444 .end = (resource_size_t)MSM_DMOV_BASE,
445 .flags = IORESOURCE_IRQ,
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530446 },
447};
448
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700449struct platform_device msm_device_dmov = {
450 .name = "msm_dmov",
451 .id = -1,
452 .resource = msm_dmov_resource,
453 .num_resources = ARRAY_SIZE(msm_dmov_resource),
Pavankumar Kondeti7032d512010-12-08 13:37:07 +0530454};
455
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700456#define MSM_SDC1_BASE 0xA0300000
457#define MSM_SDC2_BASE 0xA0400000
458#define MSM_SDC3_BASE 0xA0500000
459#define MSM_SDC4_BASE 0xA0600000
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530460static struct resource resources_sdc1[] = {
461 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700462 .start = MSM_SDC1_BASE,
463 .end = MSM_SDC1_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530464 .flags = IORESOURCE_MEM,
465 },
466 {
467 .start = INT_SDC1_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530468 .end = INT_SDC1_1,
469 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530470 },
471 {
472 .start = 8,
473 .end = 8,
474 .flags = IORESOURCE_DMA,
475 },
476};
477
478static struct resource resources_sdc2[] = {
479 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700480 .start = MSM_SDC2_BASE,
481 .end = MSM_SDC2_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530482 .flags = IORESOURCE_MEM,
483 },
484 {
485 .start = INT_SDC2_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530486 .end = INT_SDC2_1,
487 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530488 },
489 {
490 .start = 8,
491 .end = 8,
492 .flags = IORESOURCE_DMA,
493 },
494};
495
496static struct resource resources_sdc3[] = {
497 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700498 .start = MSM_SDC3_BASE,
499 .end = MSM_SDC3_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530500 .flags = IORESOURCE_MEM,
501 },
502 {
503 .start = INT_SDC3_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530504 .end = INT_SDC3_1,
505 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530506 },
507 {
508 .start = 8,
509 .end = 8,
510 .flags = IORESOURCE_DMA,
511 },
512};
513
514static struct resource resources_sdc4[] = {
515 {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700516 .start = MSM_SDC4_BASE,
517 .end = MSM_SDC4_BASE + SZ_4K - 1,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530518 .flags = IORESOURCE_MEM,
519 },
520 {
521 .start = INT_SDC4_0,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530522 .end = INT_SDC4_1,
523 .flags = IORESOURCE_IRQ,
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530524 },
525 {
526 .start = 8,
527 .end = 8,
528 .flags = IORESOURCE_DMA,
529 },
530};
531
532struct platform_device msm_device_sdc1 = {
533 .name = "msm_sdcc",
534 .id = 1,
535 .num_resources = ARRAY_SIZE(resources_sdc1),
536 .resource = resources_sdc1,
537 .dev = {
538 .coherent_dma_mask = 0xffffffff,
539 },
540};
541
542struct platform_device msm_device_sdc2 = {
543 .name = "msm_sdcc",
544 .id = 2,
545 .num_resources = ARRAY_SIZE(resources_sdc2),
546 .resource = resources_sdc2,
547 .dev = {
548 .coherent_dma_mask = 0xffffffff,
549 },
550};
551
552struct platform_device msm_device_sdc3 = {
553 .name = "msm_sdcc",
554 .id = 3,
555 .num_resources = ARRAY_SIZE(resources_sdc3),
556 .resource = resources_sdc3,
557 .dev = {
558 .coherent_dma_mask = 0xffffffff,
559 },
560};
561
562struct platform_device msm_device_sdc4 = {
563 .name = "msm_sdcc",
564 .id = 4,
565 .num_resources = ARRAY_SIZE(resources_sdc4),
566 .resource = resources_sdc4,
567 .dev = {
568 .coherent_dma_mask = 0xffffffff,
569 },
570};
571
572static struct platform_device *msm_sdcc_devices[] __initdata = {
573 &msm_device_sdc1,
574 &msm_device_sdc2,
575 &msm_device_sdc3,
576 &msm_device_sdc4,
577};
578
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700579int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530580{
581 struct platform_device *pdev;
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530582
583 if (controller < 1 || controller > 4)
584 return -EINVAL;
585
586 pdev = msm_sdcc_devices[controller-1];
587 pdev->dev.platform_data = plat;
Sahitya Tummala8b4d95f2011-01-18 11:22:50 +0530588 return platform_device_register(pdev);
589}
590
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700591#if defined(CONFIG_FB_MSM_MDP40)
592#define MDP_BASE 0xA3F00000
593#define PMDH_BASE 0xAD600000
594#define EMDH_BASE 0xAD700000
595#define TVENC_BASE 0xAD400000
596#else
597#define MDP_BASE 0xAA200000
598#define PMDH_BASE 0xAA600000
599#define EMDH_BASE 0xAA700000
600#define TVENC_BASE 0xAA400000
601#endif
602
603static struct resource msm_mdp_resources[] = {
604 {
605 .name = "mdp",
606 .start = MDP_BASE,
607 .end = MDP_BASE + 0x000F0000 - 1,
608 .flags = IORESOURCE_MEM,
609 },
610 {
611 .start = INT_MDP,
612 .end = INT_MDP,
613 .flags = IORESOURCE_IRQ,
614 },
Daniel Walker62a6cc52010-05-05 07:27:16 -0700615};
616
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700617static struct resource msm_mddi_resources[] = {
618 {
619 .name = "pmdh",
620 .start = PMDH_BASE,
621 .end = PMDH_BASE + PAGE_SIZE - 1,
622 .flags = IORESOURCE_MEM,
623 }
624};
625
626static struct resource msm_mddi_ext_resources[] = {
627 {
628 .name = "emdh",
629 .start = EMDH_BASE,
630 .end = EMDH_BASE + PAGE_SIZE - 1,
631 .flags = IORESOURCE_MEM,
632 }
633};
634
635static struct resource msm_ebi2_lcd_resources[] = {
636 {
637 .name = "base",
638 .start = 0xa0d00000,
639 .end = 0xa0d00000 + PAGE_SIZE - 1,
640 .flags = IORESOURCE_MEM,
641 },
642 {
643 .name = "lcd01",
644 .start = 0x98000000,
645 .end = 0x98000000 + 0x80000 - 1,
646 .flags = IORESOURCE_MEM,
647 },
648 {
649 .name = "lcd02",
650 .start = 0x9c000000,
651 .end = 0x9c000000 + 0x80000 - 1,
652 .flags = IORESOURCE_MEM,
653 },
654};
655
656static struct resource msm_tvenc_resources[] = {
657 {
658 .name = "tvenc",
659 .start = TVENC_BASE,
660 .end = TVENC_BASE + PAGE_SIZE - 1,
661 .flags = IORESOURCE_MEM,
662 }
663};
664
665static struct platform_device msm_mdp_device = {
666 .name = "mdp",
667 .id = 0,
668 .num_resources = ARRAY_SIZE(msm_mdp_resources),
669 .resource = msm_mdp_resources,
670};
671
672static struct platform_device msm_mddi_device = {
673 .name = "mddi",
674 .id = 0,
675 .num_resources = ARRAY_SIZE(msm_mddi_resources),
676 .resource = msm_mddi_resources,
677};
678
679static struct platform_device msm_mddi_ext_device = {
680 .name = "mddi_ext",
681 .id = 0,
682 .num_resources = ARRAY_SIZE(msm_mddi_ext_resources),
683 .resource = msm_mddi_ext_resources,
684};
685
686static struct platform_device msm_ebi2_lcd_device = {
687 .name = "ebi2_lcd",
688 .id = 0,
689 .num_resources = ARRAY_SIZE(msm_ebi2_lcd_resources),
690 .resource = msm_ebi2_lcd_resources,
691};
692
693static struct platform_device msm_lcdc_device = {
694 .name = "lcdc",
695 .id = 0,
696};
697
698static struct platform_device msm_tvenc_device = {
699 .name = "tvenc",
700 .id = 0,
701 .num_resources = ARRAY_SIZE(msm_tvenc_resources),
702 .resource = msm_tvenc_resources,
703};
704
705#if defined(CONFIG_MSM_SOC_REV_A)
706#define MSM_QUP_PHYS 0xA1680000
707#define MSM_GSBI_QUP_I2C_PHYS 0xA1600000
708#define INT_PWB_QUP_ERR INT_GSBI_QUP
709#else
710#define MSM_QUP_PHYS 0xA9900000
711#define MSM_GSBI_QUP_I2C_PHYS 0xA9900000
712#define INT_PWB_QUP_ERR INT_PWB_I2C
713#endif
714#define MSM_QUP_SIZE SZ_4K
715static struct resource resources_qup[] = {
716 {
717 .name = "qup_phys_addr",
718 .start = MSM_QUP_PHYS,
719 .end = MSM_QUP_PHYS + MSM_QUP_SIZE - 1,
720 .flags = IORESOURCE_MEM,
721 },
722 {
723 .name = "gsbi_qup_i2c_addr",
724 .start = MSM_GSBI_QUP_I2C_PHYS,
725 .end = MSM_GSBI_QUP_I2C_PHYS + 4 - 1,
726 .flags = IORESOURCE_MEM,
727 },
728 {
729 .name = "qup_err_intr",
730 .start = INT_PWB_QUP_ERR,
731 .end = INT_PWB_QUP_ERR,
732 .flags = IORESOURCE_IRQ,
733 },
734};
735
736struct platform_device qup_device_i2c = {
737 .name = "qup_i2c",
738 .id = 4,
739 .num_resources = ARRAY_SIZE(resources_qup),
740 .resource = resources_qup,
741};
742
743/* TSIF begin */
744#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
745
746#define MSM_TSIF_PHYS (0xa0100000)
747#define MSM_TSIF_SIZE (0x200)
748
749static struct resource tsif_resources[] = {
750 [0] = {
751 .flags = IORESOURCE_IRQ,
752 .start = INT_TSIF_IRQ,
753 .end = INT_TSIF_IRQ,
754 },
755 [1] = {
756 .flags = IORESOURCE_MEM,
757 .start = MSM_TSIF_PHYS,
758 .end = MSM_TSIF_PHYS + MSM_TSIF_SIZE - 1,
759 },
760 [2] = {
761 .flags = IORESOURCE_DMA,
762 .start = DMOV_TSIF_CHAN,
763 .end = DMOV_TSIF_CRCI,
764 },
765};
766
767static void tsif_release(struct device *dev)
768{
769 dev_info(dev, "release\n");
770}
771
772struct platform_device msm_device_tsif = {
773 .name = "msm_tsif",
774 .id = 0,
775 .num_resources = ARRAY_SIZE(tsif_resources),
776 .resource = tsif_resources,
777 .dev = {
778 .release = tsif_release,
779 },
780};
781#endif /* defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) */
782/* TSIF end */
783
784#define MSM_TSSC_PHYS 0xAA300000
785static struct resource resources_tssc[] = {
786 {
787 .start = MSM_TSSC_PHYS,
788 .end = MSM_TSSC_PHYS + SZ_4K - 1,
789 .name = "tssc",
790 .flags = IORESOURCE_MEM,
791 },
792 {
793 .start = INT_TCHSCRN1,
794 .end = INT_TCHSCRN1,
795 .name = "tssc1",
796 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
797 },
798 {
799 .start = INT_TCHSCRN2,
800 .end = INT_TCHSCRN2,
801 .name = "tssc2",
802 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
803 },
804};
805
806struct platform_device msm_device_tssc = {
807 .name = "msm_touchscreen",
808 .id = 0,
809 .num_resources = ARRAY_SIZE(resources_tssc),
810 .resource = resources_tssc,
811};
812
813static void __init msm_register_device(struct platform_device *pdev, void *data)
814{
815 int ret;
816
817 pdev->dev.platform_data = data;
818
819 ret = platform_device_register(pdev);
820 if (ret)
821 dev_err(&pdev->dev,
822 "%s: platform_device_register() failed = %d\n",
823 __func__, ret);
824}
825
826void __init msm_fb_register_device(char *name, void *data)
827{
828 if (!strncmp(name, "mdp", 3))
829 msm_register_device(&msm_mdp_device, data);
830 else if (!strncmp(name, "pmdh", 4))
831 msm_register_device(&msm_mddi_device, data);
832 else if (!strncmp(name, "emdh", 4))
833 msm_register_device(&msm_mddi_ext_device, data);
834 else if (!strncmp(name, "ebi2", 4))
835 msm_register_device(&msm_ebi2_lcd_device, data);
836 else if (!strncmp(name, "tvenc", 5))
837 msm_register_device(&msm_tvenc_device, data);
838 else if (!strncmp(name, "lcdc", 4))
839 msm_register_device(&msm_lcdc_device, data);
840 else
841 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
842}
843
844static struct platform_device msm_camera_device = {
845 .name = "msm_camera",
846 .id = 0,
847};
848
849void __init msm_camera_register_device(void *res, uint32_t num,
850 void *data)
851{
852 msm_camera_device.num_resources = num;
853 msm_camera_device.resource = res;
854
855 msm_register_device(&msm_camera_device, data);
856}
857
858static struct resource kgsl_3d0_resources[] = {
859 {
860 .name = KGSL_3D0_REG_MEMORY,
861 .start = 0xA0000000,
862 .end = 0xA001ffff,
863 .flags = IORESOURCE_MEM,
864 },
865 {
866 .name = KGSL_3D0_IRQ,
867 .start = INT_GRAPHICS,
868 .end = INT_GRAPHICS,
869 .flags = IORESOURCE_IRQ,
870 },
871};
872
873static struct kgsl_device_platform_data kgsl_3d0_pdata = {
874 .pwr_data = {
875 .pwrlevel = {
876 {
877 .gpu_freq = 0,
878 .bus_freq = 128000000,
879 },
880 },
881 .init_level = 0,
882 .num_levels = 1,
883 .set_grp_async = NULL,
884 .idle_timeout = HZ/5,
885 },
886 .clk = {
887 .name = {
888 .clk = "grp_clk",
889 },
890 },
891 .imem_clk_name = {
892 .clk = "imem_clk",
893 },
894};
895
896struct platform_device msm_kgsl_3d0 = {
897 .name = "kgsl-3d0",
898 .id = 0,
899 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
900 .resource = kgsl_3d0_resources,
901 .dev = {
902 .platform_data = &kgsl_3d0_pdata,
903 },
904};
Daniel Walker62a6cc52010-05-05 07:27:16 -0700905