blob: d36b8d9991eb1abcf729f7916b098c15e6266462 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/*
2 * Copyright (C) 2008 Google, Inc.
Taniya Das2e948192011-12-20 11:15:13 +05303 * Copyright (c) 2008-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -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>
18#include <linux/msm_kgsl.h>
19#include <linux/regulator/machine.h>
20#include <linux/dma-mapping.h>
Taniya Das2e948192011-12-20 11:15:13 +053021#include <linux/init.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070022#include <asm/clkdev.h>
23#include <mach/irqs.h>
24#include <mach/msm_iomap.h>
25#include <mach/dma.h>
26#include <mach/board.h>
27
28#include "devices.h"
29#include "gpio_hw.h"
30#include "footswitch.h"
31
32#include <asm/mach/flash.h>
33
34#include <asm/mach/mmc.h>
35#include <mach/msm_hsusb.h>
36#include <mach/usbdiag.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037#include <mach/rpc_hsusb.h>
Murali Nalajala2a0bbda2012-03-28 12:12:54 +053038#include "irq.h"
39#include "pm.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070040
41static struct resource resources_uart1[] = {
42 {
43 .start = INT_UART1,
44 .end = INT_UART1,
45 .flags = IORESOURCE_IRQ,
46 },
47 {
Taniya Das13b811a2011-12-09 18:33:45 +053048 .start = MSM7XXX_UART1_PHYS,
49 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070050 .flags = IORESOURCE_MEM,
51 },
52};
53
54static struct resource resources_uart2[] = {
55 {
56 .start = INT_UART2,
57 .end = INT_UART2,
58 .flags = IORESOURCE_IRQ,
59 },
60 {
Taniya Das13b811a2011-12-09 18:33:45 +053061 .start = MSM7XXX_UART2_PHYS,
62 .end = MSM7XXX_UART2_PHYS + MSM7XXX_UART2_SIZE - 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070063 .flags = IORESOURCE_MEM,
64 },
65};
66
67struct platform_device msm_device_uart1 = {
68 .name = "msm_serial",
69 .id = 0,
70 .num_resources = ARRAY_SIZE(resources_uart1),
71 .resource = resources_uart1,
72};
73
74struct platform_device msm_device_uart2 = {
75 .name = "msm_serial",
76 .id = 1,
77 .num_resources = ARRAY_SIZE(resources_uart2),
78 .resource = resources_uart2,
79};
80
Laxminath Kasam1f2cd2a2012-02-15 12:12:44 +053081static struct resource resources_adsp[] = {
82 {
83 .start = INT_ADSP_A9_A11,
84 .end = INT_ADSP_A9_A11,
85 .flags = IORESOURCE_IRQ,
86 },
87};
88
89struct platform_device msm_adsp_device = {
90 .name = "msm_adsp",
91 .id = -1,
92 .num_resources = ARRAY_SIZE(resources_adsp),
93 .resource = resources_adsp,
94};
95
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070096#define MSM_UART1DM_PHYS 0xA0200000
97#define MSM_UART2DM_PHYS 0xA0300000
98static struct resource msm_uart1_dm_resources[] = {
99 {
100 .start = MSM_UART1DM_PHYS,
101 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
102 .flags = IORESOURCE_MEM,
103 },
104 {
105 .start = INT_UART1DM_IRQ,
106 .end = INT_UART1DM_IRQ,
107 .flags = IORESOURCE_IRQ,
108 },
109 {
110 .start = INT_UART1DM_RX,
111 .end = INT_UART1DM_RX,
112 .flags = IORESOURCE_IRQ,
113 },
114 {
115 .start = DMOV_HSUART1_TX_CHAN,
116 .end = DMOV_HSUART1_RX_CHAN,
117 .name = "uartdm_channels",
118 .flags = IORESOURCE_DMA,
119 },
120 {
121 .start = DMOV_HSUART1_TX_CRCI,
122 .end = DMOV_HSUART1_RX_CRCI,
123 .name = "uartdm_crci",
124 .flags = IORESOURCE_DMA,
125 },
126};
127
128static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32);
129
130struct platform_device msm_device_uart_dm1 = {
131 .name = "msm_serial_hs",
132 .id = 0,
133 .num_resources = ARRAY_SIZE(msm_uart1_dm_resources),
134 .resource = msm_uart1_dm_resources,
135 .dev = {
136 .dma_mask = &msm_uart_dm1_dma_mask,
137 .coherent_dma_mask = DMA_BIT_MASK(32),
138 },
139};
140
141static struct resource msm_uart2_dm_resources[] = {
142 {
143 .start = MSM_UART2DM_PHYS,
144 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
145 .flags = IORESOURCE_MEM,
146 },
147 {
148 .start = INT_UART2DM_IRQ,
149 .end = INT_UART2DM_IRQ,
150 .flags = IORESOURCE_IRQ,
151 },
152 {
153 .start = INT_UART2DM_RX,
154 .end = INT_UART2DM_RX,
155 .flags = IORESOURCE_IRQ,
156 },
157 {
158 .start = DMOV_HSUART2_TX_CHAN,
159 .end = DMOV_HSUART2_RX_CHAN,
160 .name = "uartdm_channels",
161 .flags = IORESOURCE_DMA,
162 },
163 {
164 .start = DMOV_HSUART2_TX_CRCI,
165 .end = DMOV_HSUART2_RX_CRCI,
166 .name = "uartdm_crci",
167 .flags = IORESOURCE_DMA,
168 },
169};
170
171static u64 msm_uart_dm2_dma_mask = DMA_BIT_MASK(32);
172
173struct platform_device msm_device_uart_dm2 = {
174 .name = "msm_serial_hs",
175 .id = 1,
176 .num_resources = ARRAY_SIZE(msm_uart2_dm_resources),
177 .resource = msm_uart2_dm_resources,
178 .dev = {
179 .dma_mask = &msm_uart_dm2_dma_mask,
180 .coherent_dma_mask = DMA_BIT_MASK(32),
181 },
182};
183
184#define MSM_I2C_SIZE SZ_4K
185#define MSM_I2C_PHYS 0xA9900000
186static struct resource resources_i2c[] = {
187 {
188 .start = MSM_I2C_PHYS,
189 .end = MSM_I2C_PHYS + MSM_I2C_SIZE - 1,
190 .flags = IORESOURCE_MEM,
191 },
192 {
193 .start = INT_PWB_I2C,
194 .end = INT_PWB_I2C,
195 .flags = IORESOURCE_IRQ,
196 },
197};
198
199struct platform_device msm_device_i2c = {
200 .name = "msm_i2c",
201 .id = 0,
202 .num_resources = ARRAY_SIZE(resources_i2c),
203 .resource = resources_i2c,
204};
205
206#define MSM_HSUSB_PHYS 0xA0800000
207static struct resource resources_hsusb_otg[] = {
208 {
209 .start = MSM_HSUSB_PHYS,
210 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
211 .flags = IORESOURCE_MEM,
212 },
213 {
214 .start = INT_USB_HS,
215 .end = INT_USB_HS,
216 .flags = IORESOURCE_IRQ,
217 },
218};
219
220static u64 dma_mask = 0xffffffffULL;
221struct platform_device msm_device_hsusb_otg = {
222 .name = "msm_hsusb_otg",
223 .id = -1,
224 .num_resources = ARRAY_SIZE(resources_hsusb_otg),
225 .resource = resources_hsusb_otg,
226 .dev = {
227 .dma_mask = &dma_mask,
228 .coherent_dma_mask = 0xffffffffULL,
229 },
230};
231
232static struct resource resources_hsusb_peripheral[] = {
233 {
234 .start = MSM_HSUSB_PHYS,
235 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
236 .flags = IORESOURCE_MEM,
237 },
238 {
239 .start = INT_USB_HS,
240 .end = INT_USB_HS,
241 .flags = IORESOURCE_IRQ,
242 },
243};
244
245static struct resource resources_gadget_peripheral[] = {
246 {
247 .start = MSM_HSUSB_PHYS,
248 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
249 .flags = IORESOURCE_MEM,
250 },
251 {
252 .start = INT_USB_HS,
253 .end = INT_USB_HS,
254 .flags = IORESOURCE_IRQ,
255 },
256};
257
258struct platform_device msm_device_hsusb_peripheral = {
259 .name = "msm_hsusb_peripheral",
260 .id = -1,
261 .num_resources = ARRAY_SIZE(resources_hsusb_peripheral),
262 .resource = resources_hsusb_peripheral,
263 .dev = {
264 .dma_mask = &dma_mask,
265 .coherent_dma_mask = 0xffffffffULL,
266 },
267};
268
269struct platform_device msm_device_gadget_peripheral = {
270 .name = "msm_hsusb",
271 .id = -1,
272 .num_resources = ARRAY_SIZE(resources_gadget_peripheral),
273 .resource = resources_gadget_peripheral,
274 .dev = {
275 .dma_mask = &dma_mask,
276 .coherent_dma_mask = 0xffffffffULL,
277 },
278};
279
280static struct resource resources_hsusb_host[] = {
281 {
282 .start = MSM_HSUSB_PHYS,
283 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
284 .flags = IORESOURCE_MEM,
285 },
286 {
287 .start = INT_USB_HS,
288 .end = INT_USB_HS,
289 .flags = IORESOURCE_IRQ,
290 },
291};
292
293struct platform_device msm_device_hsusb_host = {
294 .name = "msm_hsusb_host",
295 .id = 0,
296 .num_resources = ARRAY_SIZE(resources_hsusb_host),
297 .resource = resources_hsusb_host,
298 .dev = {
299 .dma_mask = &dma_mask,
300 .coherent_dma_mask = 0xffffffffULL,
301 },
302};
303
304static struct platform_device *msm_host_devices[] = {
305 &msm_device_hsusb_host,
306};
307
308int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
309{
310 struct platform_device *pdev;
311
312 pdev = msm_host_devices[host];
313 if (!pdev)
314 return -ENODEV;
315 pdev->dev.platform_data = plat;
316 return platform_device_register(pdev);
317}
318
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700319struct platform_device asoc_msm_pcm = {
320 .name = "msm-dsp-audio",
321 .id = 0,
322};
323
324struct platform_device asoc_msm_dai0 = {
325 .name = "msm-codec-dai",
326 .id = 0,
327};
328
329struct platform_device asoc_msm_dai1 = {
330 .name = "msm-cpu-dai",
331 .id = 0,
332};
333
334#define MSM_NAND_PHYS 0xA0A00000
335static struct resource resources_nand[] = {
336 [0] = {
337 .name = "msm_nand_dmac",
338 .start = DMOV_NAND_CHAN,
339 .end = DMOV_NAND_CHAN,
340 .flags = IORESOURCE_DMA,
341 },
342 [1] = {
343 .name = "msm_nand_phys",
344 .start = MSM_NAND_PHYS,
345 .end = MSM_NAND_PHYS + 0x7FF,
346 .flags = IORESOURCE_MEM,
347 },
348};
349
350static struct resource resources_otg[] = {
351 {
352 .start = MSM_HSUSB_PHYS,
353 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
354 .flags = IORESOURCE_MEM,
355 },
356 {
357 .start = INT_USB_HS,
358 .end = INT_USB_HS,
359 .flags = IORESOURCE_IRQ,
360 },
361};
362
363struct platform_device msm_device_otg = {
364 .name = "msm_otg",
365 .id = -1,
366 .num_resources = ARRAY_SIZE(resources_otg),
367 .resource = resources_otg,
368 .dev = {
369 .coherent_dma_mask = 0xffffffffULL,
370 },
371};
372
373struct flash_platform_data msm_nand_data = {
374 .parts = NULL,
375 .nr_parts = 0,
376};
377
378struct platform_device msm_device_nand = {
379 .name = "msm_nand",
380 .id = -1,
381 .num_resources = ARRAY_SIZE(resources_nand),
382 .resource = resources_nand,
383 .dev = {
384 .platform_data = &msm_nand_data,
385 },
386};
387
388struct platform_device msm_device_smd = {
389 .name = "msm_smd",
390 .id = -1,
391};
392
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700393static struct resource msm_dmov_resource[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700394 {
395 .start = INT_ADM_AARM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700396 .flags = IORESOURCE_IRQ,
397 },
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700398 {
399 .start = 0xA9700000,
400 .end = 0xA9700000 + SZ_4K - 1,
401 .flags = IORESOURCE_MEM,
402 },
403};
404
405static struct msm_dmov_pdata msm_dmov_pdata = {
406 .sd = 3,
407 .sd_size = 0x400,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700408};
409
410struct platform_device msm_device_dmov = {
411 .name = "msm_dmov",
412 .id = -1,
413 .resource = msm_dmov_resource,
414 .num_resources = ARRAY_SIZE(msm_dmov_resource),
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700415 .dev = {
416 .platform_data = &msm_dmov_pdata,
417 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700418};
419
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530420static struct msm_pm_irq_calls msm7x27_pm_irq_calls = {
421 .irq_pending = msm_irq_pending,
422 .idle_sleep_allowed = msm_irq_idle_sleep_allowed,
423 .enter_sleep1 = msm_irq_enter_sleep1,
424 .enter_sleep2 = msm_irq_enter_sleep2,
425 .exit_sleep1 = msm_irq_exit_sleep1,
426 .exit_sleep2 = msm_irq_exit_sleep2,
427 .exit_sleep3 = msm_irq_exit_sleep3,
428};
429
Stephen Boyd986c9632012-04-24 16:31:45 -0700430void __init msm_pm_register_irqs(void)
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530431{
432 msm_pm_set_irq_extns(&msm7x27_pm_irq_calls);
433}
434
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700435#define MSM_SDC1_BASE 0xA0400000
436#define MSM_SDC2_BASE 0xA0500000
437#define MSM_SDC3_BASE 0xA0600000
438#define MSM_SDC4_BASE 0xA0700000
439static struct resource resources_sdc1[] = {
440 {
441 .start = MSM_SDC1_BASE,
442 .end = MSM_SDC1_BASE + SZ_4K - 1,
443 .flags = IORESOURCE_MEM,
444 },
445 {
446 .start = INT_SDC1_0,
447 .end = INT_SDC1_1,
448 .flags = IORESOURCE_IRQ,
449 },
450 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700451 .name = "sdcc_dma_chnl",
452 .start = DMOV_SDC1_CHAN,
453 .end = DMOV_SDC1_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700454 .flags = IORESOURCE_DMA,
455 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700456 {
457 .name = "sdcc_dma_crci",
458 .start = DMOV_SDC1_CRCI,
459 .end = DMOV_SDC1_CRCI,
460 .flags = IORESOURCE_DMA,
461 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700462};
463
464static struct resource resources_sdc2[] = {
465 {
466 .start = MSM_SDC2_BASE,
467 .end = MSM_SDC2_BASE + SZ_4K - 1,
468 .flags = IORESOURCE_MEM,
469 },
470 {
471 .start = INT_SDC2_0,
472 .end = INT_SDC2_1,
473 .flags = IORESOURCE_IRQ,
474 },
475 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700476 .name = "sdcc_dma_chnl",
477 .start = DMOV_SDC2_CHAN,
478 .end = DMOV_SDC2_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700479 .flags = IORESOURCE_DMA,
480 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700481 {
482 .name = "sdcc_dma_crci",
483 .start = DMOV_SDC2_CRCI,
484 .end = DMOV_SDC2_CRCI,
485 .flags = IORESOURCE_DMA,
486 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700487};
488
489static struct resource resources_sdc3[] = {
490 {
491 .start = MSM_SDC3_BASE,
492 .end = MSM_SDC3_BASE + SZ_4K - 1,
493 .flags = IORESOURCE_MEM,
494 },
495 {
496 .start = INT_SDC3_0,
497 .end = INT_SDC3_1,
498 .flags = IORESOURCE_IRQ,
499 },
500 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700501 .name = "sdcc_dma_chnl",
502 .start = DMOV_SDC3_CHAN,
503 .end = DMOV_SDC3_CHAN,
504 .flags = IORESOURCE_DMA,
505 },
506 {
507 .name = "sdcc_dma_crci",
508 .start = DMOV_SDC3_CRCI,
509 .end = DMOV_SDC3_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700510 .flags = IORESOURCE_DMA,
511 },
512};
513
514static struct resource resources_sdc4[] = {
515 {
516 .start = MSM_SDC4_BASE,
517 .end = MSM_SDC4_BASE + SZ_4K - 1,
518 .flags = IORESOURCE_MEM,
519 },
520 {
521 .start = INT_SDC4_0,
522 .end = INT_SDC4_1,
523 .flags = IORESOURCE_IRQ,
524 },
525 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700526 .name = "sdcc_dma_chnl",
527 .start = DMOV_SDC4_CHAN,
528 .end = DMOV_SDC4_CHAN,
529 .flags = IORESOURCE_DMA,
530 },
531 {
532 .name = "sdcc_dma_crci",
533 .start = DMOV_SDC4_CRCI,
534 .end = DMOV_SDC4_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700535 .flags = IORESOURCE_DMA,
536 },
537};
538
539struct platform_device msm_device_sdc1 = {
540 .name = "msm_sdcc",
541 .id = 1,
542 .num_resources = ARRAY_SIZE(resources_sdc1),
543 .resource = resources_sdc1,
544 .dev = {
545 .coherent_dma_mask = 0xffffffff,
546 },
547};
548
549struct platform_device msm_device_sdc2 = {
550 .name = "msm_sdcc",
551 .id = 2,
552 .num_resources = ARRAY_SIZE(resources_sdc2),
553 .resource = resources_sdc2,
554 .dev = {
555 .coherent_dma_mask = 0xffffffff,
556 },
557};
558
559struct platform_device msm_device_sdc3 = {
560 .name = "msm_sdcc",
561 .id = 3,
562 .num_resources = ARRAY_SIZE(resources_sdc3),
563 .resource = resources_sdc3,
564 .dev = {
565 .coherent_dma_mask = 0xffffffff,
566 },
567};
568
569struct platform_device msm_device_sdc4 = {
570 .name = "msm_sdcc",
571 .id = 4,
572 .num_resources = ARRAY_SIZE(resources_sdc4),
573 .resource = resources_sdc4,
574 .dev = {
575 .coherent_dma_mask = 0xffffffff,
576 },
577};
578
579static struct platform_device *msm_sdcc_devices[] __initdata = {
580 &msm_device_sdc1,
581 &msm_device_sdc2,
582 &msm_device_sdc3,
583 &msm_device_sdc4,
584};
585
586int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
587{
588 struct platform_device *pdev;
589
590 if (controller < 1 || controller > 4)
591 return -EINVAL;
592
593 pdev = msm_sdcc_devices[controller-1];
594 pdev->dev.platform_data = plat;
595 return platform_device_register(pdev);
596}
597
598#if defined(CONFIG_FB_MSM_MDP40)
599#define MDP_BASE 0xA3F00000
600#define PMDH_BASE 0xAD600000
601#define EMDH_BASE 0xAD700000
602#define TVENC_BASE 0xAD400000
603#else
604#define MDP_BASE 0xAA200000
605#define PMDH_BASE 0xAA600000
606#define EMDH_BASE 0xAA700000
607#define TVENC_BASE 0xAA400000
608#endif
609
610static struct resource msm_mdp_resources[] = {
611 {
612 .name = "mdp",
613 .start = MDP_BASE,
614 .end = MDP_BASE + 0x000F0000 - 1,
615 .flags = IORESOURCE_MEM,
616 },
617 {
618 .start = INT_MDP,
619 .end = INT_MDP,
620 .flags = IORESOURCE_IRQ,
621 },
622};
623
624static struct resource msm_mddi_resources[] = {
625 {
626 .name = "pmdh",
627 .start = PMDH_BASE,
628 .end = PMDH_BASE + PAGE_SIZE - 1,
629 .flags = IORESOURCE_MEM,
630 }
631};
632
633static struct resource msm_mddi_ext_resources[] = {
634 {
635 .name = "emdh",
636 .start = EMDH_BASE,
637 .end = EMDH_BASE + PAGE_SIZE - 1,
638 .flags = IORESOURCE_MEM,
639 }
640};
641
642static struct resource msm_ebi2_lcd_resources[] = {
643 {
644 .name = "base",
645 .start = 0xa0d00000,
646 .end = 0xa0d00000 + PAGE_SIZE - 1,
647 .flags = IORESOURCE_MEM,
648 },
649 {
650 .name = "lcd01",
651 .start = 0x98000000,
652 .end = 0x98000000 + 0x80000 - 1,
653 .flags = IORESOURCE_MEM,
654 },
655 {
656 .name = "lcd02",
657 .start = 0x9c000000,
658 .end = 0x9c000000 + 0x80000 - 1,
659 .flags = IORESOURCE_MEM,
660 },
661};
662
663static struct resource msm_tvenc_resources[] = {
664 {
665 .name = "tvenc",
666 .start = TVENC_BASE,
667 .end = TVENC_BASE + PAGE_SIZE - 1,
668 .flags = IORESOURCE_MEM,
669 }
670};
671
672static struct platform_device msm_mdp_device = {
673 .name = "mdp",
674 .id = 0,
675 .num_resources = ARRAY_SIZE(msm_mdp_resources),
676 .resource = msm_mdp_resources,
677};
678
679static struct platform_device msm_mddi_device = {
680 .name = "mddi",
681 .id = 0,
682 .num_resources = ARRAY_SIZE(msm_mddi_resources),
683 .resource = msm_mddi_resources,
684};
685
686static struct platform_device msm_mddi_ext_device = {
687 .name = "mddi_ext",
688 .id = 0,
689 .num_resources = ARRAY_SIZE(msm_mddi_ext_resources),
690 .resource = msm_mddi_ext_resources,
691};
692
693static struct platform_device msm_ebi2_lcd_device = {
694 .name = "ebi2_lcd",
695 .id = 0,
696 .num_resources = ARRAY_SIZE(msm_ebi2_lcd_resources),
697 .resource = msm_ebi2_lcd_resources,
698};
699
700static struct platform_device msm_lcdc_device = {
701 .name = "lcdc",
702 .id = 0,
703};
704
705static struct platform_device msm_tvenc_device = {
706 .name = "tvenc",
707 .id = 0,
708 .num_resources = ARRAY_SIZE(msm_tvenc_resources),
709 .resource = msm_tvenc_resources,
710};
711
712/* TSIF begin */
713#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
714
715#define MSM_TSIF_PHYS (0xa0100000)
716#define MSM_TSIF_SIZE (0x200)
717
718static struct resource tsif_resources[] = {
719 [0] = {
720 .flags = IORESOURCE_IRQ,
721 .start = INT_TSIF_IRQ,
722 .end = INT_TSIF_IRQ,
723 },
724 [1] = {
725 .flags = IORESOURCE_MEM,
726 .start = MSM_TSIF_PHYS,
727 .end = MSM_TSIF_PHYS + MSM_TSIF_SIZE - 1,
728 },
729 [2] = {
730 .flags = IORESOURCE_DMA,
731 .start = DMOV_TSIF_CHAN,
732 .end = DMOV_TSIF_CRCI,
733 },
734};
735
736static void tsif_release(struct device *dev)
737{
738 dev_info(dev, "release\n");
739}
740
741struct platform_device msm_device_tsif = {
742 .name = "msm_tsif",
743 .id = 0,
744 .num_resources = ARRAY_SIZE(tsif_resources),
745 .resource = tsif_resources,
746 .dev = {
747 .release = tsif_release,
748 },
749};
750#endif /* defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) */
751/* TSIF end */
752
753#define MSM_TSSC_PHYS 0xAA300000
754static struct resource resources_tssc[] = {
755 {
756 .start = MSM_TSSC_PHYS,
757 .end = MSM_TSSC_PHYS + SZ_4K - 1,
758 .name = "tssc",
759 .flags = IORESOURCE_MEM,
760 },
761 {
762 .start = INT_TCHSCRN1,
763 .end = INT_TCHSCRN1,
764 .name = "tssc1",
765 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
766 },
767 {
768 .start = INT_TCHSCRN2,
769 .end = INT_TCHSCRN2,
770 .name = "tssc2",
771 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
772 },
773};
774
775struct platform_device msm_device_tssc = {
776 .name = "msm_touchscreen",
777 .id = 0,
778 .num_resources = ARRAY_SIZE(resources_tssc),
779 .resource = resources_tssc,
780};
781
782static void __init msm_register_device(struct platform_device *pdev, void *data)
783{
784 int ret;
785
786 pdev->dev.platform_data = data;
787
788 ret = platform_device_register(pdev);
789 if (ret)
790 dev_err(&pdev->dev,
791 "%s: platform_device_register() failed = %d\n",
792 __func__, ret);
793}
794
795void __init msm_fb_register_device(char *name, void *data)
796{
797 if (!strncmp(name, "mdp", 3))
798 msm_register_device(&msm_mdp_device, data);
799 else if (!strncmp(name, "pmdh", 4))
800 msm_register_device(&msm_mddi_device, data);
801 else if (!strncmp(name, "emdh", 4))
802 msm_register_device(&msm_mddi_ext_device, data);
803 else if (!strncmp(name, "ebi2", 4))
804 msm_register_device(&msm_ebi2_lcd_device, data);
805 else if (!strncmp(name, "tvenc", 5))
806 msm_register_device(&msm_tvenc_device, data);
807 else if (!strncmp(name, "lcdc", 4))
808 msm_register_device(&msm_lcdc_device, data);
809 else
810 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
811}
812
813static struct platform_device msm_camera_device = {
814 .name = "msm_camera",
815 .id = 0,
816};
817
818void __init msm_camera_register_device(void *res, uint32_t num,
819 void *data)
820{
821 msm_camera_device.num_resources = num;
822 msm_camera_device.resource = res;
823
824 msm_register_device(&msm_camera_device, data);
825}
826
827static struct resource kgsl_3d0_resources[] = {
828 {
829 .name = KGSL_3D0_REG_MEMORY,
830 .start = 0xA0000000,
831 .end = 0xA001ffff,
832 .flags = IORESOURCE_MEM,
833 },
834 {
835 .name = KGSL_3D0_IRQ,
836 .start = INT_GRAPHICS,
837 .end = INT_GRAPHICS,
838 .flags = IORESOURCE_IRQ,
839 },
840};
841
842static struct kgsl_device_platform_data kgsl_3d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600843 /* bus_freq has been set to 160000 for power savings.
844 * OEMs may modify the value at their discretion for performance
845 * The appropriate maximum replacement for 160000 is:
846 * msm7x2x_clock_data.max_axi_khz
847 */
848 .pwrlevel = {
849 {
850 .gpu_freq = 0,
851 .bus_freq = 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700852 },
853 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600854 .init_level = 0,
855 .num_levels = 1,
856 .set_grp_async = NULL,
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700857 .idle_timeout = HZ,
Lynus Vazfe4bede2012-04-06 11:53:30 -0700858 .strtstp_sleepwake = true,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600859 .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700860};
861
862struct platform_device msm_kgsl_3d0 = {
863 .name = "kgsl-3d0",
864 .id = 0,
865 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
866 .resource = kgsl_3d0_resources,
867 .dev = {
868 .platform_data = &kgsl_3d0_pdata,
869 },
870};
871
872struct platform_device *msm_footswitch_devices[] = {
873 FS_PCOM(FS_GFX3D, "fs_gfx3d"),
874};
875unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);
Taniya Das2e948192011-12-20 11:15:13 +0530876
877static struct resource gpio_resources[] = {
878 {
879 .start = INT_GPIO_GROUP1,
880 .flags = IORESOURCE_IRQ,
881 },
882 {
883 .start = INT_GPIO_GROUP2,
884 .flags = IORESOURCE_IRQ,
885 },
886};
887
888static struct platform_device msm_device_gpio = {
889 .name = "msmgpio",
890 .id = -1,
891 .resource = gpio_resources,
892 .num_resources = ARRAY_SIZE(gpio_resources),
893};
894
895static int __init msm7627_init_gpio(void)
896{
897 platform_device_register(&msm_device_gpio);
898 return 0;
899}
900
901postcore_initcall(msm7627_init_gpio);