blob: 4619ccab66e397d903b2399527e6a8d143bb3a9a [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"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070029#include "footswitch.h"
Matt Wagantallbf430eb2012-03-22 11:45:49 -070030#include "acpuclock.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070031
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
Matt Wagantallbf430eb2012-03-22 11:45:49 -0700435static struct acpuclk_pdata msm7x27_acpuclk_pdata = {
436 .max_speed_delta_khz = 400000,
437};
438
439struct platform_device msm7x27_device_acpuclk = {
440 .name = "acpuclk-7627",
441 .id = -1,
442 .dev.platform_data = &msm7x27_acpuclk_pdata,
443};
444
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700445#define MSM_SDC1_BASE 0xA0400000
446#define MSM_SDC2_BASE 0xA0500000
447#define MSM_SDC3_BASE 0xA0600000
448#define MSM_SDC4_BASE 0xA0700000
449static struct resource resources_sdc1[] = {
450 {
451 .start = MSM_SDC1_BASE,
452 .end = MSM_SDC1_BASE + SZ_4K - 1,
453 .flags = IORESOURCE_MEM,
454 },
455 {
456 .start = INT_SDC1_0,
457 .end = INT_SDC1_1,
458 .flags = IORESOURCE_IRQ,
459 },
460 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700461 .name = "sdcc_dma_chnl",
462 .start = DMOV_SDC1_CHAN,
463 .end = DMOV_SDC1_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700464 .flags = IORESOURCE_DMA,
465 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700466 {
467 .name = "sdcc_dma_crci",
468 .start = DMOV_SDC1_CRCI,
469 .end = DMOV_SDC1_CRCI,
470 .flags = IORESOURCE_DMA,
471 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700472};
473
474static struct resource resources_sdc2[] = {
475 {
476 .start = MSM_SDC2_BASE,
477 .end = MSM_SDC2_BASE + SZ_4K - 1,
478 .flags = IORESOURCE_MEM,
479 },
480 {
481 .start = INT_SDC2_0,
482 .end = INT_SDC2_1,
483 .flags = IORESOURCE_IRQ,
484 },
485 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700486 .name = "sdcc_dma_chnl",
487 .start = DMOV_SDC2_CHAN,
488 .end = DMOV_SDC2_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700489 .flags = IORESOURCE_DMA,
490 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700491 {
492 .name = "sdcc_dma_crci",
493 .start = DMOV_SDC2_CRCI,
494 .end = DMOV_SDC2_CRCI,
495 .flags = IORESOURCE_DMA,
496 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700497};
498
499static struct resource resources_sdc3[] = {
500 {
501 .start = MSM_SDC3_BASE,
502 .end = MSM_SDC3_BASE + SZ_4K - 1,
503 .flags = IORESOURCE_MEM,
504 },
505 {
506 .start = INT_SDC3_0,
507 .end = INT_SDC3_1,
508 .flags = IORESOURCE_IRQ,
509 },
510 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700511 .name = "sdcc_dma_chnl",
512 .start = DMOV_SDC3_CHAN,
513 .end = DMOV_SDC3_CHAN,
514 .flags = IORESOURCE_DMA,
515 },
516 {
517 .name = "sdcc_dma_crci",
518 .start = DMOV_SDC3_CRCI,
519 .end = DMOV_SDC3_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700520 .flags = IORESOURCE_DMA,
521 },
522};
523
524static struct resource resources_sdc4[] = {
525 {
526 .start = MSM_SDC4_BASE,
527 .end = MSM_SDC4_BASE + SZ_4K - 1,
528 .flags = IORESOURCE_MEM,
529 },
530 {
531 .start = INT_SDC4_0,
532 .end = INT_SDC4_1,
533 .flags = IORESOURCE_IRQ,
534 },
535 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700536 .name = "sdcc_dma_chnl",
537 .start = DMOV_SDC4_CHAN,
538 .end = DMOV_SDC4_CHAN,
539 .flags = IORESOURCE_DMA,
540 },
541 {
542 .name = "sdcc_dma_crci",
543 .start = DMOV_SDC4_CRCI,
544 .end = DMOV_SDC4_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700545 .flags = IORESOURCE_DMA,
546 },
547};
548
549struct platform_device msm_device_sdc1 = {
550 .name = "msm_sdcc",
551 .id = 1,
552 .num_resources = ARRAY_SIZE(resources_sdc1),
553 .resource = resources_sdc1,
554 .dev = {
555 .coherent_dma_mask = 0xffffffff,
556 },
557};
558
559struct platform_device msm_device_sdc2 = {
560 .name = "msm_sdcc",
561 .id = 2,
562 .num_resources = ARRAY_SIZE(resources_sdc2),
563 .resource = resources_sdc2,
564 .dev = {
565 .coherent_dma_mask = 0xffffffff,
566 },
567};
568
569struct platform_device msm_device_sdc3 = {
570 .name = "msm_sdcc",
571 .id = 3,
572 .num_resources = ARRAY_SIZE(resources_sdc3),
573 .resource = resources_sdc3,
574 .dev = {
575 .coherent_dma_mask = 0xffffffff,
576 },
577};
578
579struct platform_device msm_device_sdc4 = {
580 .name = "msm_sdcc",
581 .id = 4,
582 .num_resources = ARRAY_SIZE(resources_sdc4),
583 .resource = resources_sdc4,
584 .dev = {
585 .coherent_dma_mask = 0xffffffff,
586 },
587};
588
589static struct platform_device *msm_sdcc_devices[] __initdata = {
590 &msm_device_sdc1,
591 &msm_device_sdc2,
592 &msm_device_sdc3,
593 &msm_device_sdc4,
594};
595
596int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
597{
598 struct platform_device *pdev;
599
600 if (controller < 1 || controller > 4)
601 return -EINVAL;
602
603 pdev = msm_sdcc_devices[controller-1];
604 pdev->dev.platform_data = plat;
605 return platform_device_register(pdev);
606}
607
608#if defined(CONFIG_FB_MSM_MDP40)
609#define MDP_BASE 0xA3F00000
610#define PMDH_BASE 0xAD600000
611#define EMDH_BASE 0xAD700000
612#define TVENC_BASE 0xAD400000
613#else
614#define MDP_BASE 0xAA200000
615#define PMDH_BASE 0xAA600000
616#define EMDH_BASE 0xAA700000
617#define TVENC_BASE 0xAA400000
618#endif
619
620static struct resource msm_mdp_resources[] = {
621 {
622 .name = "mdp",
623 .start = MDP_BASE,
624 .end = MDP_BASE + 0x000F0000 - 1,
625 .flags = IORESOURCE_MEM,
626 },
627 {
628 .start = INT_MDP,
629 .end = INT_MDP,
630 .flags = IORESOURCE_IRQ,
631 },
632};
633
634static struct resource msm_mddi_resources[] = {
635 {
636 .name = "pmdh",
637 .start = PMDH_BASE,
638 .end = PMDH_BASE + PAGE_SIZE - 1,
639 .flags = IORESOURCE_MEM,
640 }
641};
642
643static struct resource msm_mddi_ext_resources[] = {
644 {
645 .name = "emdh",
646 .start = EMDH_BASE,
647 .end = EMDH_BASE + PAGE_SIZE - 1,
648 .flags = IORESOURCE_MEM,
649 }
650};
651
652static struct resource msm_ebi2_lcd_resources[] = {
653 {
654 .name = "base",
655 .start = 0xa0d00000,
656 .end = 0xa0d00000 + PAGE_SIZE - 1,
657 .flags = IORESOURCE_MEM,
658 },
659 {
660 .name = "lcd01",
661 .start = 0x98000000,
662 .end = 0x98000000 + 0x80000 - 1,
663 .flags = IORESOURCE_MEM,
664 },
665 {
666 .name = "lcd02",
667 .start = 0x9c000000,
668 .end = 0x9c000000 + 0x80000 - 1,
669 .flags = IORESOURCE_MEM,
670 },
671};
672
673static struct resource msm_tvenc_resources[] = {
674 {
675 .name = "tvenc",
676 .start = TVENC_BASE,
677 .end = TVENC_BASE + PAGE_SIZE - 1,
678 .flags = IORESOURCE_MEM,
679 }
680};
681
682static struct platform_device msm_mdp_device = {
683 .name = "mdp",
684 .id = 0,
685 .num_resources = ARRAY_SIZE(msm_mdp_resources),
686 .resource = msm_mdp_resources,
687};
688
689static struct platform_device msm_mddi_device = {
690 .name = "mddi",
691 .id = 0,
692 .num_resources = ARRAY_SIZE(msm_mddi_resources),
693 .resource = msm_mddi_resources,
694};
695
696static struct platform_device msm_mddi_ext_device = {
697 .name = "mddi_ext",
698 .id = 0,
699 .num_resources = ARRAY_SIZE(msm_mddi_ext_resources),
700 .resource = msm_mddi_ext_resources,
701};
702
703static struct platform_device msm_ebi2_lcd_device = {
704 .name = "ebi2_lcd",
705 .id = 0,
706 .num_resources = ARRAY_SIZE(msm_ebi2_lcd_resources),
707 .resource = msm_ebi2_lcd_resources,
708};
709
710static struct platform_device msm_lcdc_device = {
711 .name = "lcdc",
712 .id = 0,
713};
714
715static struct platform_device msm_tvenc_device = {
716 .name = "tvenc",
717 .id = 0,
718 .num_resources = ARRAY_SIZE(msm_tvenc_resources),
719 .resource = msm_tvenc_resources,
720};
721
722/* TSIF begin */
723#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
724
725#define MSM_TSIF_PHYS (0xa0100000)
726#define MSM_TSIF_SIZE (0x200)
727
728static struct resource tsif_resources[] = {
729 [0] = {
730 .flags = IORESOURCE_IRQ,
731 .start = INT_TSIF_IRQ,
732 .end = INT_TSIF_IRQ,
733 },
734 [1] = {
735 .flags = IORESOURCE_MEM,
736 .start = MSM_TSIF_PHYS,
737 .end = MSM_TSIF_PHYS + MSM_TSIF_SIZE - 1,
738 },
739 [2] = {
740 .flags = IORESOURCE_DMA,
741 .start = DMOV_TSIF_CHAN,
742 .end = DMOV_TSIF_CRCI,
743 },
744};
745
746static void tsif_release(struct device *dev)
747{
748 dev_info(dev, "release\n");
749}
750
751struct platform_device msm_device_tsif = {
752 .name = "msm_tsif",
753 .id = 0,
754 .num_resources = ARRAY_SIZE(tsif_resources),
755 .resource = tsif_resources,
756 .dev = {
757 .release = tsif_release,
758 },
759};
760#endif /* defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) */
761/* TSIF end */
762
763#define MSM_TSSC_PHYS 0xAA300000
764static struct resource resources_tssc[] = {
765 {
766 .start = MSM_TSSC_PHYS,
767 .end = MSM_TSSC_PHYS + SZ_4K - 1,
768 .name = "tssc",
769 .flags = IORESOURCE_MEM,
770 },
771 {
772 .start = INT_TCHSCRN1,
773 .end = INT_TCHSCRN1,
774 .name = "tssc1",
775 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
776 },
777 {
778 .start = INT_TCHSCRN2,
779 .end = INT_TCHSCRN2,
780 .name = "tssc2",
781 .flags = IORESOURCE_IRQ | IRQF_TRIGGER_RISING,
782 },
783};
784
785struct platform_device msm_device_tssc = {
786 .name = "msm_touchscreen",
787 .id = 0,
788 .num_resources = ARRAY_SIZE(resources_tssc),
789 .resource = resources_tssc,
790};
791
792static void __init msm_register_device(struct platform_device *pdev, void *data)
793{
794 int ret;
795
796 pdev->dev.platform_data = data;
797
798 ret = platform_device_register(pdev);
799 if (ret)
800 dev_err(&pdev->dev,
801 "%s: platform_device_register() failed = %d\n",
802 __func__, ret);
803}
804
805void __init msm_fb_register_device(char *name, void *data)
806{
807 if (!strncmp(name, "mdp", 3))
808 msm_register_device(&msm_mdp_device, data);
809 else if (!strncmp(name, "pmdh", 4))
810 msm_register_device(&msm_mddi_device, data);
811 else if (!strncmp(name, "emdh", 4))
812 msm_register_device(&msm_mddi_ext_device, data);
813 else if (!strncmp(name, "ebi2", 4))
814 msm_register_device(&msm_ebi2_lcd_device, data);
815 else if (!strncmp(name, "tvenc", 5))
816 msm_register_device(&msm_tvenc_device, data);
817 else if (!strncmp(name, "lcdc", 4))
818 msm_register_device(&msm_lcdc_device, data);
819 else
820 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
821}
822
823static struct platform_device msm_camera_device = {
824 .name = "msm_camera",
825 .id = 0,
826};
827
828void __init msm_camera_register_device(void *res, uint32_t num,
829 void *data)
830{
831 msm_camera_device.num_resources = num;
832 msm_camera_device.resource = res;
833
834 msm_register_device(&msm_camera_device, data);
835}
836
837static struct resource kgsl_3d0_resources[] = {
838 {
839 .name = KGSL_3D0_REG_MEMORY,
840 .start = 0xA0000000,
841 .end = 0xA001ffff,
842 .flags = IORESOURCE_MEM,
843 },
844 {
845 .name = KGSL_3D0_IRQ,
846 .start = INT_GRAPHICS,
847 .end = INT_GRAPHICS,
848 .flags = IORESOURCE_IRQ,
849 },
850};
851
852static struct kgsl_device_platform_data kgsl_3d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600853 /* bus_freq has been set to 160000 for power savings.
854 * OEMs may modify the value at their discretion for performance
855 * The appropriate maximum replacement for 160000 is:
856 * msm7x2x_clock_data.max_axi_khz
857 */
858 .pwrlevel = {
859 {
860 .gpu_freq = 0,
861 .bus_freq = 160000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700862 },
863 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600864 .init_level = 0,
865 .num_levels = 1,
866 .set_grp_async = NULL,
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700867 .idle_timeout = HZ,
Lynus Vazfe4bede2012-04-06 11:53:30 -0700868 .strtstp_sleepwake = true,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600869 .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700870};
871
872struct platform_device msm_kgsl_3d0 = {
873 .name = "kgsl-3d0",
874 .id = 0,
875 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
876 .resource = kgsl_3d0_resources,
877 .dev = {
878 .platform_data = &kgsl_3d0_pdata,
879 },
880};
881
882struct platform_device *msm_footswitch_devices[] = {
Matt Wagantalld6fbf232012-05-03 20:09:28 -0700883 FS_PCOM(FS_GFX3D, "vdd", "kgsl-3d0.0"),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700884};
885unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);
Taniya Das2e948192011-12-20 11:15:13 +0530886
887static struct resource gpio_resources[] = {
888 {
889 .start = INT_GPIO_GROUP1,
890 .flags = IORESOURCE_IRQ,
891 },
892 {
893 .start = INT_GPIO_GROUP2,
894 .flags = IORESOURCE_IRQ,
895 },
896};
897
898static struct platform_device msm_device_gpio = {
899 .name = "msmgpio",
900 .id = -1,
901 .resource = gpio_resources,
902 .num_resources = ARRAY_SIZE(gpio_resources),
903};
904
905static int __init msm7627_init_gpio(void)
906{
907 platform_device_register(&msm_device_gpio);
908 return 0;
909}
910
911postcore_initcall(msm7627_init_gpio);