blob: 5152918001693726ff75e95db66ccd8fa13cdde2 [file] [log] [blame]
Daniel Walker10932762010-05-12 12:02:25 -07001/*
2 * Copyright (C) 2008 Google, Inc.
Duy Truong790f06d2013-02-13 16:38:12 -08003 * Copyright (c) 2008-2012, The Linux Foundation. All rights reserved.
Daniel Walker10932762010-05-12 12:02:25 -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_rotator.h>
Daniel Walker10932762010-05-12 12:02:25 -070019#include <linux/dma-mapping.h>
Jordan Crouse914de9b2012-07-09 13:49:46 -060020#include <mach/kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070021#include <linux/android_pmem.h>
22#include <linux/regulator/machine.h>
Taniya Das2e948192011-12-20 11:15:13 +053023#include <linux/init.h>
Daniel Walker10932762010-05-12 12:02:25 -070024#include <mach/irqs.h>
25#include <mach/msm_iomap.h>
26#include <mach/dma.h>
27#include <mach/board.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070028#include <asm/clkdev.h>
Mitchel Humpherysb2cdd3a2012-09-06 11:36:21 -070029#include <linux/msm_ion.h>
Daniel Walker10932762010-05-12 12:02:25 -070030#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070031#include "footswitch.h"
Daniel Walker10932762010-05-12 12:02:25 -070032
33#include <asm/mach/flash.h>
34
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070035#include <asm/mach/mmc.h>
36#include <mach/msm_hsusb.h>
37#ifdef CONFIG_PMIC8058
38#include <linux/mfd/pmic8058.h>
39#endif
40#include <mach/dal_axi.h>
41#include <mach/msm_memtypes.h>
Murali Nalajala2a0bbda2012-03-28 12:12:54 +053042#include "pm.h"
43#include "irq.h"
Daniel Walker10932762010-05-12 12:02:25 -070044
Matt Wagantallbf430eb2012-03-22 11:45:49 -070045struct platform_device msm7x30_device_acpuclk = {
46 .name = "acpuclk-7x30",
47 .id = -1,
48};
49
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070050/* EBI THERMAL DRIVER */
51static struct resource msm_ebi0_thermal_resources[] = {
52 {
53 .start = 0xA8600000,
54 .end = 0xA86005FF,
55 .name = "physbase",
56 .flags = IORESOURCE_MEM
57 }
58};
59
60struct platform_device msm_ebi0_thermal = {
61 .name = "msm_popmem-tm",
62 .id = 0,
63 .num_resources = 1,
64 .resource = msm_ebi0_thermal_resources
65};
66
67static struct resource msm_ebi1_thermal_resources[] = {
68 {
69 .start = 0xA8700000,
70 .end = 0xA87005FF,
71 .name = "physbase",
72 .flags = IORESOURCE_MEM
73 }
74};
75
76struct platform_device msm_ebi1_thermal = {
77 .name = "msm_popmem-tm",
78 .id = 1,
79 .num_resources = 1,
80 .resource = msm_ebi1_thermal_resources
81};
82
Laxminath Kasam1d8255d2012-02-15 13:10:19 +053083static struct resource resources_adsp[] = {
84{
85 .start = INT_ADSP_A9_A11,
86 .end = INT_ADSP_A9_A11,
87 .flags = IORESOURCE_IRQ,
88},
89};
90
91struct platform_device msm_adsp_device = {
92 .name = "msm_adsp",
93 .id = -1,
94 .num_resources = ARRAY_SIZE(resources_adsp),
95 .resource = resources_adsp,
96};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070097
98static struct resource resources_uart1[] = {
99 {
100 .start = INT_UART1,
101 .end = INT_UART1,
102 .flags = IORESOURCE_IRQ,
103 },
104 {
Taniya Das298de8c2012-02-16 11:45:31 +0530105 .start = MSM7X30_UART1_PHYS,
106 .end = MSM7X30_UART1_PHYS + MSM7X30_UART1_SIZE - 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700107 .flags = IORESOURCE_MEM,
108 },
109};
Daniel Walker10932762010-05-12 12:02:25 -0700110
111static struct resource resources_uart2[] = {
112 {
113 .start = INT_UART2,
114 .end = INT_UART2,
115 .flags = IORESOURCE_IRQ,
116 },
117 {
Taniya Das298de8c2012-02-16 11:45:31 +0530118 .start = MSM7X30_UART2_PHYS,
119 .end = MSM7X30_UART2_PHYS + MSM7X30_UART2_SIZE - 1,
Daniel Walker10932762010-05-12 12:02:25 -0700120 .flags = IORESOURCE_MEM,
Stepan Moskovchenkod41cb8c2011-01-17 20:33:32 -0800121 .name = "uart_resource"
Daniel Walker10932762010-05-12 12:02:25 -0700122 },
123};
124
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700125static struct resource resources_uart3[] = {
126 {
127 .start = INT_UART3,
128 .end = INT_UART3,
129 .flags = IORESOURCE_IRQ,
130 },
131 {
Taniya Das298de8c2012-02-16 11:45:31 +0530132 .start = MSM7X30_UART3_PHYS,
133 .end = MSM7X30_UART3_PHYS + MSM7X30_UART3_SIZE - 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700134 .flags = IORESOURCE_MEM,
135 },
136};
137
138struct platform_device msm_device_uart1 = {
139 .name = "msm_serial",
140 .id = 0,
141 .num_resources = ARRAY_SIZE(resources_uart1),
142 .resource = resources_uart1,
143};
144
Daniel Walker10932762010-05-12 12:02:25 -0700145struct platform_device msm_device_uart2 = {
146 .name = "msm_serial",
147 .id = 1,
148 .num_resources = ARRAY_SIZE(resources_uart2),
149 .resource = resources_uart2,
150};
151
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700152struct platform_device msm_device_uart3 = {
153 .name = "msm_serial",
154 .id = 2,
155 .num_resources = ARRAY_SIZE(resources_uart3),
156 .resource = resources_uart3,
Niranjana Vishwanathapuraa8855e92010-10-06 13:52:10 -0700157};
158
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700159#define MSM_UART1DM_PHYS 0xA3300000
160#define MSM_UART2DM_PHYS 0xA3200000
161static struct resource msm_uart1_dm_resources[] = {
162 {
163 .start = MSM_UART1DM_PHYS,
164 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
165 .flags = IORESOURCE_MEM,
166 },
167 {
168 .start = INT_UART1DM_IRQ,
169 .end = INT_UART1DM_IRQ,
170 .flags = IORESOURCE_IRQ,
171 },
172 {
173 .start = INT_UART1DM_RX,
174 .end = INT_UART1DM_RX,
175 .flags = IORESOURCE_IRQ,
176 },
177 {
178 .start = DMOV_HSUART1_TX_CHAN,
179 .end = DMOV_HSUART1_RX_CHAN,
180 .name = "uartdm_channels",
181 .flags = IORESOURCE_DMA,
182 },
183 {
184 .start = DMOV_HSUART1_TX_CRCI,
185 .end = DMOV_HSUART1_RX_CRCI,
186 .name = "uartdm_crci",
187 .flags = IORESOURCE_DMA,
188 },
189};
190
191static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32);
192
193struct platform_device msm_device_uart_dm1 = {
194 .name = "msm_serial_hs",
195 .id = 0,
196 .num_resources = ARRAY_SIZE(msm_uart1_dm_resources),
197 .resource = msm_uart1_dm_resources,
198 .dev = {
199 .dma_mask = &msm_uart_dm1_dma_mask,
200 .coherent_dma_mask = DMA_BIT_MASK(32),
201 },
202};
203
204static struct resource msm_uart2_dm_resources[] = {
205 {
206 .start = MSM_UART2DM_PHYS,
207 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
208 .flags = IORESOURCE_MEM,
209 },
210 {
211 .start = INT_UART2DM_IRQ,
212 .end = INT_UART2DM_IRQ,
213 .flags = IORESOURCE_IRQ,
214 },
215 {
216 .start = INT_UART2DM_RX,
217 .end = INT_UART2DM_RX,
218 .flags = IORESOURCE_IRQ,
219 },
220 {
221 .start = DMOV_HSUART2_TX_CHAN,
222 .end = DMOV_HSUART2_RX_CHAN,
223 .name = "uartdm_channels",
224 .flags = IORESOURCE_DMA,
225 },
226 {
227 .start = DMOV_HSUART2_TX_CRCI,
228 .end = DMOV_HSUART2_RX_CRCI,
229 .name = "uartdm_crci",
230 .flags = IORESOURCE_DMA,
231 },
232};
233
234static u64 msm_uart_dm2_dma_mask = DMA_BIT_MASK(32);
235
236struct platform_device msm_device_uart_dm2 = {
237 .name = "msm_serial_hs",
238 .id = 1,
239 .num_resources = ARRAY_SIZE(msm_uart2_dm_resources),
240 .resource = msm_uart2_dm_resources,
241 .dev = {
242 .dma_mask = &msm_uart_dm2_dma_mask,
243 .coherent_dma_mask = DMA_BIT_MASK(32),
244 },
245};
246
247#define MSM_I2C_SIZE SZ_4K
248#define MSM_I2C_PHYS 0xACD00000
249#define MSM_I2C_2_PHYS 0xACF00000
250static struct resource resources_i2c_2[] = {
251 {
252 .start = MSM_I2C_2_PHYS,
253 .end = MSM_I2C_2_PHYS + MSM_I2C_SIZE - 1,
254 .flags = IORESOURCE_MEM,
255 },
256 {
257 .start = INT_PWB_I2C_2,
258 .end = INT_PWB_I2C_2,
259 .flags = IORESOURCE_IRQ,
260 },
261};
262
263struct platform_device msm_device_i2c_2 = {
264 .name = "msm_i2c",
265 .id = 2,
266 .num_resources = ARRAY_SIZE(resources_i2c_2),
267 .resource = resources_i2c_2,
268};
269
270static struct resource resources_i2c[] = {
271 {
272 .start = MSM_I2C_PHYS,
273 .end = MSM_I2C_PHYS + MSM_I2C_SIZE - 1,
274 .flags = IORESOURCE_MEM,
275 },
276 {
277 .start = INT_PWB_I2C,
278 .end = INT_PWB_I2C,
279 .flags = IORESOURCE_IRQ,
280 },
281};
282
283struct platform_device msm_device_i2c = {
284 .name = "msm_i2c",
285 .id = 0,
286 .num_resources = ARRAY_SIZE(resources_i2c),
287 .resource = resources_i2c,
288};
289
Kiran Kumar H N305c53b2012-03-24 14:14:13 -0700290#ifdef CONFIG_MSM_CAMERA_V4L2
291static struct resource msm_csic_resources[] = {
292 {
293 .name = "csic",
294 .start = 0xA6100000,
295 .end = 0xA6100000 + 0x00000400 - 1,
296 .flags = IORESOURCE_MEM,
297 },
298 {
299 .name = "csic",
300 .start = INT_CSI,
301 .end = INT_CSI,
302 .flags = IORESOURCE_IRQ,
303 },
304};
305
306struct resource msm_vfe_resources[] = {
307 {
308 .name = "msm_vfe",
309 .start = 0xA6000000,
310 .end = 0xA6000000 + SZ_1M - 1,
311 .flags = IORESOURCE_MEM,
312 },
313 {
314 .name = "msm_vfe",
315 .start = INT_VFE,
316 .end = INT_VFE,
317 .flags = IORESOURCE_IRQ,
318 },
319 {
320 .name = "msm_camif",
321 .start = 0xAB000000,
322 .end = 0xAB000000 + SZ_1K - 1,
323 .flags = IORESOURCE_MEM,
324 },
325};
326
327static struct resource msm_vpe_resources[] = {
328 {
329 .name = "vpe",
330 .start = 0xAD200000,
331 .end = 0xAD200000 + SZ_1M - 1,
332 .flags = IORESOURCE_MEM,
333 },
334 {
335 .name = "vpe",
336 .start = INT_VPE,
337 .end = INT_VPE,
338 .flags = IORESOURCE_IRQ,
339 },
340};
341
342struct platform_device msm_device_csic0 = {
343 .name = "msm_csic",
344 .id = 0,
345 .resource = msm_csic_resources,
346 .num_resources = ARRAY_SIZE(msm_csic_resources),
347};
348
349struct platform_device msm_device_vfe = {
350 .name = "msm_vfe",
351 .id = 0,
352 .resource = msm_vfe_resources,
353 .num_resources = ARRAY_SIZE(msm_vfe_resources),
354};
355
356struct platform_device msm_device_vpe = {
357 .name = "msm_vpe",
358 .id = 0,
359 .resource = msm_vpe_resources,
360 .num_resources = ARRAY_SIZE(msm_vpe_resources),
361};
362#endif
363
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700364#define MSM_QUP_PHYS 0xA8301000
365#define MSM_GSBI_QUP_I2C_PHYS 0xA8300000
366#define MSM_QUP_SIZE SZ_4K
367static struct resource resources_qup[] = {
368 {
369 .name = "qup_phys_addr",
370 .start = MSM_QUP_PHYS,
371 .end = MSM_QUP_PHYS + MSM_QUP_SIZE - 1,
372 .flags = IORESOURCE_MEM,
373 },
374 {
375 .name = "gsbi_qup_i2c_addr",
376 .start = MSM_GSBI_QUP_I2C_PHYS,
377 .end = MSM_GSBI_QUP_I2C_PHYS + 4 - 1,
378 .flags = IORESOURCE_MEM,
379 },
380 {
381 .name = "qup_in_intr",
382 .start = INT_PWB_QUP_IN,
383 .end = INT_PWB_QUP_IN,
384 .flags = IORESOURCE_IRQ,
385 },
386 {
387 .name = "qup_out_intr",
388 .start = INT_PWB_QUP_OUT,
389 .end = INT_PWB_QUP_OUT,
390 .flags = IORESOURCE_IRQ,
391 },
392 {
393 .name = "qup_err_intr",
394 .start = INT_PWB_QUP_ERR,
395 .end = INT_PWB_QUP_ERR,
396 .flags = IORESOURCE_IRQ,
397 },
398};
399
400struct platform_device qup_device_i2c = {
401 .name = "qup_i2c",
402 .id = 4,
403 .num_resources = ARRAY_SIZE(resources_qup),
404 .resource = resources_qup,
405};
406
Anirudh Ghayal9d9cdc22011-10-10 17:17:07 +0530407#ifdef CONFIG_MSM_SSBI
408#define MSM_SSBI_PMIC1_PHYS 0xAD900000
409static struct resource msm_ssbi_pmic1_resources[] = {
410 {
411 .start = MSM_SSBI_PMIC1_PHYS,
412 .end = MSM_SSBI_PMIC1_PHYS + SZ_4K - 1,
413 .flags = IORESOURCE_MEM,
414 },
415};
416
417struct platform_device msm_device_ssbi_pmic1 = {
418 .name = "msm_ssbi",
419 .id = 0,
420 .resource = msm_ssbi_pmic1_resources,
421 .num_resources = ARRAY_SIZE(msm_ssbi_pmic1_resources),
422};
423#endif
424
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700425#ifdef CONFIG_I2C_SSBI
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700426#define MSM_SSBI7_PHYS 0xAC800000
427static struct resource msm_ssbi7_resources[] = {
428 {
429 .name = "ssbi_base",
430 .start = MSM_SSBI7_PHYS,
431 .end = MSM_SSBI7_PHYS + SZ_4K - 1,
432 .flags = IORESOURCE_MEM,
433 },
434};
435
436struct platform_device msm_device_ssbi7 = {
437 .name = "i2c_ssbi",
438 .id = 7,
439 .num_resources = ARRAY_SIZE(msm_ssbi7_resources),
440 .resource = msm_ssbi7_resources,
441};
442#endif /* CONFIG_I2C_SSBI */
443
444#define MSM_HSUSB_PHYS 0xA3600000
445static struct resource resources_hsusb_otg[] = {
Pavankumar Kondeti5155e2c2010-12-08 13:37:08 +0530446 {
447 .start = MSM_HSUSB_PHYS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700448 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
Pavankumar Kondeti5155e2c2010-12-08 13:37:08 +0530449 .flags = IORESOURCE_MEM,
450 },
451 {
452 .start = INT_USB_HS,
453 .end = INT_USB_HS,
454 .flags = IORESOURCE_IRQ,
455 },
456};
457
Pavankumar Kondeti5155e2c2010-12-08 13:37:08 +0530458static u64 dma_mask = 0xffffffffULL;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700459struct platform_device msm_device_hsusb_otg = {
460 .name = "msm_hsusb_otg",
461 .id = -1,
462 .num_resources = ARRAY_SIZE(resources_hsusb_otg),
463 .resource = resources_hsusb_otg,
464 .dev = {
465 .dma_mask = &dma_mask,
466 .coherent_dma_mask = 0xffffffffULL,
467 },
468};
469
470static struct resource resources_hsusb_peripheral[] = {
471 {
472 .start = MSM_HSUSB_PHYS,
473 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
474 .flags = IORESOURCE_MEM,
475 },
476 {
477 .start = INT_USB_HS,
478 .end = INT_USB_HS,
479 .flags = IORESOURCE_IRQ,
480 },
481};
482
483static struct resource resources_gadget_peripheral[] = {
484 {
485 .start = MSM_HSUSB_PHYS,
486 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
487 .flags = IORESOURCE_MEM,
488 },
489 {
490 .start = INT_USB_HS,
491 .end = INT_USB_HS,
492 .flags = IORESOURCE_IRQ,
493 },
494};
495
496struct platform_device msm_device_hsusb_peripheral = {
497 .name = "msm_hsusb_peripheral",
498 .id = -1,
499 .num_resources = ARRAY_SIZE(resources_hsusb_peripheral),
500 .resource = resources_hsusb_peripheral,
501 .dev = {
502 .dma_mask = &dma_mask,
503 .coherent_dma_mask = 0xffffffffULL,
504 },
505};
506
507struct platform_device msm_device_gadget_peripheral = {
508 .name = "msm_hsusb",
509 .id = -1,
510 .num_resources = ARRAY_SIZE(resources_gadget_peripheral),
511 .resource = resources_gadget_peripheral,
512 .dev = {
513 .dma_mask = &dma_mask,
514 .coherent_dma_mask = 0xffffffffULL,
515 },
516};
517
Pavankumar Kondeti5155e2c2010-12-08 13:37:08 +0530518static struct resource resources_hsusb_host[] = {
519 {
520 .start = MSM_HSUSB_PHYS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700521 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
Pavankumar Kondeti5155e2c2010-12-08 13:37:08 +0530522 .flags = IORESOURCE_MEM,
523 },
524 {
525 .start = INT_USB_HS,
526 .end = INT_USB_HS,
527 .flags = IORESOURCE_IRQ,
528 },
529};
530
531struct platform_device msm_device_hsusb_host = {
532 .name = "msm_hsusb_host",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700533 .id = 0,
Pavankumar Kondeti5155e2c2010-12-08 13:37:08 +0530534 .num_resources = ARRAY_SIZE(resources_hsusb_host),
535 .resource = resources_hsusb_host,
536 .dev = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700537 .dma_mask = &dma_mask,
538 .coherent_dma_mask = 0xffffffffULL,
Pavankumar Kondeti5155e2c2010-12-08 13:37:08 +0530539 },
540};
541
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700542static struct platform_device *msm_host_devices[] = {
543 &msm_device_hsusb_host,
Daniel Walker10932762010-05-12 12:02:25 -0700544};
545
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700546int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
547{
548 struct platform_device *pdev;
Daniel Walker10932762010-05-12 12:02:25 -0700549
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700550 pdev = msm_host_devices[host];
551 if (!pdev)
552 return -ENODEV;
553 pdev->dev.platform_data = plat;
554 return platform_device_register(pdev);
555}
556
557struct platform_device asoc_msm_pcm = {
558 .name = "msm-dsp-audio",
559 .id = 0,
560};
561
562struct platform_device asoc_msm_dai0 = {
563 .name = "msm-codec-dai",
564 .id = 0,
565};
566
567struct platform_device asoc_msm_dai1 = {
568 .name = "msm-cpu-dai",
569 .id = 0,
570};
571
572#if defined (CONFIG_SND_MSM_MVS_DAI_SOC)
573struct platform_device asoc_msm_mvs = {
574 .name = "msm-mvs-audio",
575 .id = 0,
576};
577
578struct platform_device asoc_mvs_dai0 = {
579 .name = "mvs-codec-dai",
580 .id = 0,
581};
582
583struct platform_device asoc_mvs_dai1 = {
584 .name = "mvs-cpu-dai",
585 .id = 0,
586};
587#endif
588
589#define MSM_NAND_PHYS 0xA0200000
590#define MSM_NANDC01_PHYS 0xA0240000
591#define MSM_NANDC10_PHYS 0xA0280000
592#define MSM_NANDC11_PHYS 0xA02C0000
593#define EBI2_REG_BASE 0xA0000000
594static struct resource resources_nand[] = {
595 [0] = {
596 .name = "msm_nand_dmac",
597 .start = DMOV_NAND_CHAN,
598 .end = DMOV_NAND_CHAN,
599 .flags = IORESOURCE_DMA,
600 },
601 [1] = {
602 .name = "msm_nand_phys",
603 .start = MSM_NAND_PHYS,
604 .end = MSM_NAND_PHYS + 0x7FF,
605 .flags = IORESOURCE_MEM,
606 },
607 [2] = {
608 .name = "msm_nandc01_phys",
609 .start = MSM_NANDC01_PHYS,
610 .end = MSM_NANDC01_PHYS + 0x7FF,
611 .flags = IORESOURCE_MEM,
612 },
613 [3] = {
614 .name = "msm_nandc10_phys",
615 .start = MSM_NANDC10_PHYS,
616 .end = MSM_NANDC10_PHYS + 0x7FF,
617 .flags = IORESOURCE_MEM,
618 },
619 [4] = {
620 .name = "msm_nandc11_phys",
621 .start = MSM_NANDC11_PHYS,
622 .end = MSM_NANDC11_PHYS + 0x7FF,
623 .flags = IORESOURCE_MEM,
624 },
625 [5] = {
626 .name = "ebi2_reg_base",
627 .start = EBI2_REG_BASE,
628 .end = EBI2_REG_BASE + 0x60,
629 .flags = IORESOURCE_MEM,
630 },
631};
632
633static struct resource resources_otg[] = {
634 {
635 .start = MSM_HSUSB_PHYS,
636 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
637 .flags = IORESOURCE_MEM,
638 },
639 {
640 .start = INT_USB_HS,
641 .end = INT_USB_HS,
642 .flags = IORESOURCE_IRQ,
643 },
644 {
645 .name = "vbus_on",
Anirudh Ghayalc2019332011-11-12 06:29:10 +0530646 .start = PMIC8058_IRQ_BASE + PM8058_CHGVAL_IRQ,
647 .end = PMIC8058_IRQ_BASE + PM8058_CHGVAL_IRQ,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700648 .flags = IORESOURCE_IRQ,
649 },
650};
651
652struct platform_device msm_device_otg = {
653 .name = "msm_otg",
654 .id = -1,
655 .num_resources = ARRAY_SIZE(resources_otg),
656 .resource = resources_otg,
657 .dev = {
658 .coherent_dma_mask = 0xffffffffULL,
659 },
660};
661
662struct flash_platform_data msm_nand_data = {
Sujit Reddy Thummaec9b3252012-04-23 15:53:45 +0530663 .version = VERSION_2,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700664};
665
666struct platform_device msm_device_nand = {
667 .name = "msm_nand",
668 .id = -1,
669 .num_resources = ARRAY_SIZE(resources_nand),
670 .resource = resources_nand,
671 .dev = {
672 .platform_data = &msm_nand_data,
673 },
674};
675
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530676static struct msm_pm_irq_calls msm7x30_pm_irq_calls = {
677 .irq_pending = msm_irq_pending,
678 .idle_sleep_allowed = msm_irq_idle_sleep_allowed,
679 .enter_sleep1 = msm_irq_enter_sleep1,
680 .enter_sleep2 = msm_irq_enter_sleep2,
681 .exit_sleep1 = msm_irq_exit_sleep1,
682 .exit_sleep2 = msm_irq_exit_sleep2,
683 .exit_sleep3 = msm_irq_exit_sleep3,
684};
685
Stephen Boyd986c9632012-04-24 16:31:45 -0700686void __init msm_pm_register_irqs(void)
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530687{
688 msm_pm_set_irq_extns(&msm7x30_pm_irq_calls);
689}
690
Angshuman Sarkarbad32df2012-02-01 19:52:52 +0530691static struct resource smd_resource[] = {
692 {
693 .name = "a9_m2a_0",
694 .start = INT_A9_M2A_0,
695 .flags = IORESOURCE_IRQ,
696 },
697 {
698 .name = "a9_m2a_5",
699 .start = INT_A9_M2A_5,
700 .flags = IORESOURCE_IRQ,
701 },
702 {
703 .name = "adsp_a11_smsm",
704 .start = INT_ADSP_A11,
705 .flags = IORESOURCE_IRQ,
706 },
707};
708
709static struct smd_subsystem_config smd_config_list[] = {
710 {
711 .irq_config_id = SMD_MODEM,
712 .subsys_name = "modem",
713 .edge = SMD_APPS_MODEM,
714
715 .smd_int.irq_name = "a9_m2a_0",
716 .smd_int.flags = IRQF_TRIGGER_RISING,
717 .smd_int.irq_id = -1,
718 .smd_int.device_name = "smd_dev",
719 .smd_int.dev_id = 0,
720
721 .smd_int.out_bit_pos = 1 << 0,
Taniya Das298de8c2012-02-16 11:45:31 +0530722 .smd_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE,
Angshuman Sarkarbad32df2012-02-01 19:52:52 +0530723 .smd_int.out_offset = 0x8,
724
725 .smsm_int.irq_name = "a9_m2a_5",
726 .smsm_int.flags = IRQF_TRIGGER_RISING,
727 .smsm_int.irq_id = -1,
728 .smsm_int.device_name = "smd_dev",
729 .smsm_int.dev_id = 0,
730
731 .smsm_int.out_bit_pos = 1 << 5,
Taniya Das298de8c2012-02-16 11:45:31 +0530732 .smsm_int.out_base = (void __iomem *)MSM_APCS_GCC_BASE,
Angshuman Sarkarbad32df2012-02-01 19:52:52 +0530733 .smsm_int.out_offset = 0x8,
734
735 }
736};
737
738static struct smd_platform smd_platform_data = {
739 .num_ss_configs = ARRAY_SIZE(smd_config_list),
740 .smd_ss_configs = smd_config_list,
741};
742
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700743struct platform_device msm_device_smd = {
744 .name = "msm_smd",
745 .id = -1,
Angshuman Sarkarbad32df2012-02-01 19:52:52 +0530746 .resource = smd_resource,
747 .num_resources = ARRAY_SIZE(smd_resource),
748 .dev = {
749 .platform_data = &smd_platform_data,
750 }
751
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700752};
753
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700754static struct resource msm_dmov_resource[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700755 {
756 .start = INT_ADM_AARM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700757 .flags = IORESOURCE_IRQ,
758 },
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700759 {
760 .start = 0xAC400000,
761 .end = 0xAC400000 + SZ_4K - 1,
762 .flags = IORESOURCE_MEM,
763 },
764};
765
766static struct msm_dmov_pdata msm_dmov_pdata = {
767 .sd = 2,
768 .sd_size = 0x400,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700769};
770
771struct platform_device msm_device_dmov = {
772 .name = "msm_dmov",
773 .id = -1,
774 .resource = msm_dmov_resource,
775 .num_resources = ARRAY_SIZE(msm_dmov_resource),
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700776 .dev = {
777 .platform_data = &msm_dmov_pdata,
778 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700779};
780
781#define MSM_SDC1_BASE 0xA0400000
782#define MSM_SDC2_BASE 0xA0500000
783#define MSM_SDC3_BASE 0xA3000000
784#define MSM_SDC4_BASE 0xA3100000
785static struct resource resources_sdc1[] = {
786 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530787 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700788 .start = MSM_SDC1_BASE,
789 .end = MSM_SDC1_BASE + SZ_4K - 1,
790 .flags = IORESOURCE_MEM,
791 },
792 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530793 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700794 .start = INT_SDC1_0,
795 .end = INT_SDC1_1,
796 .flags = IORESOURCE_IRQ,
797 },
798 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530799 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700800 .start = DMOV_SDC1_CHAN,
801 .end = DMOV_SDC1_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700802 .flags = IORESOURCE_DMA,
803 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700804 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530805 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700806 .start = DMOV_SDC1_CRCI,
807 .end = DMOV_SDC1_CRCI,
808 .flags = IORESOURCE_DMA,
809 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700810};
811
812static struct resource resources_sdc2[] = {
813 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530814 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700815 .start = MSM_SDC2_BASE,
816 .end = MSM_SDC2_BASE + SZ_4K - 1,
817 .flags = IORESOURCE_MEM,
818 },
819 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530820 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700821 .start = INT_SDC2_0,
822 .end = INT_SDC2_1,
823 .flags = IORESOURCE_IRQ,
824 },
825 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530826 .name = "dma_chnl",
Subhash Jadavanif29aefd2012-06-21 00:43:15 +0530827 .start = DMOV_NAND_CHAN,
828 .end = DMOV_NAND_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700829 .flags = IORESOURCE_DMA,
830 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700831 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530832 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700833 .start = DMOV_SDC2_CRCI,
834 .end = DMOV_SDC2_CRCI,
835 .flags = IORESOURCE_DMA,
836 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700837};
838
839static struct resource resources_sdc3[] = {
840 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530841 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700842 .start = MSM_SDC3_BASE,
843 .end = MSM_SDC3_BASE + SZ_4K - 1,
844 .flags = IORESOURCE_MEM,
845 },
846 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530847 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700848 .start = INT_SDC3_0,
849 .end = INT_SDC3_1,
850 .flags = IORESOURCE_IRQ,
851 },
852 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530853 .name = "dma_chnl",
Pankaj Kumare657b9f2011-10-12 20:11:12 +0530854 .start = DMOV_SDC3_CHAN,
855 .end = DMOV_SDC3_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700856 .flags = IORESOURCE_DMA,
857 },
858 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530859 .name = "dma_crci",
Pankaj Kumare657b9f2011-10-12 20:11:12 +0530860 .start = DMOV_SDC3_CRCI,
861 .end = DMOV_SDC3_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700862 .flags = IORESOURCE_DMA,
863 },
864};
865
866static struct resource resources_sdc4[] = {
867 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530868 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700869 .start = MSM_SDC4_BASE,
870 .end = MSM_SDC4_BASE + SZ_4K - 1,
871 .flags = IORESOURCE_MEM,
872 },
873 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530874 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700875 .start = INT_SDC4_0,
876 .end = INT_SDC4_1,
877 .flags = IORESOURCE_IRQ,
878 },
879 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530880 .name = "dma_chnl",
Pankaj Kumare657b9f2011-10-12 20:11:12 +0530881 .start = DMOV_SDC4_CHAN,
882 .end = DMOV_SDC4_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700883 .flags = IORESOURCE_DMA,
884 },
885 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530886 .name = "dma_crci",
Pankaj Kumare657b9f2011-10-12 20:11:12 +0530887 .start = DMOV_SDC4_CRCI,
888 .end = DMOV_SDC4_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700889 .flags = IORESOURCE_DMA,
890 },
891};
892
893struct platform_device msm_device_sdc1 = {
894 .name = "msm_sdcc",
895 .id = 1,
896 .num_resources = ARRAY_SIZE(resources_sdc1),
897 .resource = resources_sdc1,
898 .dev = {
899 .coherent_dma_mask = 0xffffffff,
900 },
901};
902
903struct platform_device msm_device_sdc2 = {
904 .name = "msm_sdcc",
905 .id = 2,
906 .num_resources = ARRAY_SIZE(resources_sdc2),
907 .resource = resources_sdc2,
908 .dev = {
909 .coherent_dma_mask = 0xffffffff,
910 },
911};
912
913struct platform_device msm_device_sdc3 = {
914 .name = "msm_sdcc",
915 .id = 3,
916 .num_resources = ARRAY_SIZE(resources_sdc3),
917 .resource = resources_sdc3,
918 .dev = {
919 .coherent_dma_mask = 0xffffffff,
920 },
921};
922
923struct platform_device msm_device_sdc4 = {
924 .name = "msm_sdcc",
925 .id = 4,
926 .num_resources = ARRAY_SIZE(resources_sdc4),
927 .resource = resources_sdc4,
928 .dev = {
929 .coherent_dma_mask = 0xffffffff,
930 },
931};
932
933static struct platform_device *msm_sdcc_devices[] __initdata = {
934 &msm_device_sdc1,
935 &msm_device_sdc2,
936 &msm_device_sdc3,
937 &msm_device_sdc4,
938};
939
940int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
941{
942 struct platform_device *pdev;
943
944 if (controller < 1 || controller > 4)
945 return -EINVAL;
946
947 pdev = msm_sdcc_devices[controller-1];
948 pdev->dev.platform_data = plat;
949 return platform_device_register(pdev);
950}
951
952static struct resource msm_vidc_720p_resources[] = {
953 {
954 .start = 0xA3B00000,
955 .end = 0xA3B00000 + SZ_4K - 1,
956 .flags = IORESOURCE_MEM,
957 },
958 {
959 .start = INT_MFC720,
960 .end = INT_MFC720,
961 .flags = IORESOURCE_IRQ,
962 },
963};
964
965struct msm_vidc_platform_data vidc_platform_data = {
Maheshwar Ajja22d1abd2012-07-27 19:15:01 +0530966 .memtype = ION_CAMERA_HEAP_ID,
967 .enable_ion = 1,
Mohan Kumar Gubbihalli Lachma Naiked9dc912012-03-01 19:11:14 -0800968 .disable_dmx = 0,
969 .cont_mode_dpb_count = 8
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700970};
971
972struct platform_device msm_device_vidc_720p = {
973 .name = "msm_vidc",
974 .id = 0,
975 .num_resources = ARRAY_SIZE(msm_vidc_720p_resources),
976 .resource = msm_vidc_720p_resources,
977 .dev = {
978 .platform_data = &vidc_platform_data,
979 },
980};
981
982#if defined(CONFIG_FB_MSM_MDP40)
983#define MDP_BASE 0xA3F00000
984#define PMDH_BASE 0xAD600000
985#define EMDH_BASE 0xAD700000
986#define TVENC_BASE 0xAD400000
987#else
988#define MDP_BASE 0xAA200000
989#define PMDH_BASE 0xAA600000
990#define EMDH_BASE 0xAA700000
991#define TVENC_BASE 0xAA400000
992#endif
993
994static struct resource msm_mdp_resources[] = {
995 {
996 .name = "mdp",
997 .start = MDP_BASE,
998 .end = MDP_BASE + 0x000F0000 - 1,
999 .flags = IORESOURCE_MEM,
1000 },
1001 {
1002 .start = INT_MDP,
1003 .end = INT_MDP,
1004 .flags = IORESOURCE_IRQ,
1005 },
1006};
1007
1008static struct resource msm_mddi_resources[] = {
1009 {
1010 .name = "pmdh",
1011 .start = PMDH_BASE,
1012 .end = PMDH_BASE + PAGE_SIZE - 1,
1013 .flags = IORESOURCE_MEM,
1014 }
1015};
1016
1017static struct resource msm_mddi_ext_resources[] = {
1018 {
1019 .name = "emdh",
1020 .start = EMDH_BASE,
1021 .end = EMDH_BASE + PAGE_SIZE - 1,
1022 .flags = IORESOURCE_MEM,
1023 }
1024};
1025
1026static struct resource msm_ebi2_lcd_resources[] = {
1027 {
1028 .name = "base",
1029 .start = 0xa0d00000,
1030 .end = 0xa0d00000 + PAGE_SIZE - 1,
1031 .flags = IORESOURCE_MEM,
1032 },
1033 {
1034 .name = "lcd01",
1035 .start = 0x98000000,
1036 .end = 0x98000000 + 0x80000 - 1,
1037 .flags = IORESOURCE_MEM,
1038 },
1039 {
1040 .name = "lcd02",
1041 .start = 0x9c000000,
1042 .end = 0x9c000000 + 0x80000 - 1,
1043 .flags = IORESOURCE_MEM,
1044 },
1045};
1046
1047static struct resource msm_tvenc_resources[] = {
1048 {
1049 .name = "tvenc",
1050 .start = TVENC_BASE,
1051 .end = TVENC_BASE + PAGE_SIZE - 1,
1052 .flags = IORESOURCE_MEM,
1053 }
1054};
1055
1056#ifdef CONFIG_FB_MSM_TVOUT
1057static struct resource tvout_device_resources[] = {
1058 {
1059 .name = "tvout_device_irq",
1060 .start = INT_TV_ENC,
1061 .end = INT_TV_ENC,
1062 .flags = IORESOURCE_IRQ,
1063 },
1064};
1065#endif
1066
1067static struct platform_device msm_mdp_device = {
1068 .name = "mdp",
1069 .id = 0,
1070 .num_resources = ARRAY_SIZE(msm_mdp_resources),
1071 .resource = msm_mdp_resources,
1072};
1073
1074static struct platform_device msm_mddi_device = {
1075 .name = "mddi",
1076 .id = 0,
1077 .num_resources = ARRAY_SIZE(msm_mddi_resources),
1078 .resource = msm_mddi_resources,
1079};
1080
1081static struct platform_device msm_mddi_ext_device = {
1082 .name = "mddi_ext",
1083 .id = 0,
1084 .num_resources = ARRAY_SIZE(msm_mddi_ext_resources),
1085 .resource = msm_mddi_ext_resources,
1086};
1087
1088static struct platform_device msm_ebi2_lcd_device = {
1089 .name = "ebi2_lcd",
1090 .id = 0,
1091 .num_resources = ARRAY_SIZE(msm_ebi2_lcd_resources),
1092 .resource = msm_ebi2_lcd_resources,
1093};
1094
Padmanabhan Komandurue77bcf52012-07-26 12:43:39 +05301095struct platform_device msm_lcdc_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001096 .name = "lcdc",
1097 .id = 0,
1098};
1099
1100static struct platform_device msm_dtv_device = {
1101 .name = "dtv",
1102 .id = 0,
1103};
1104
1105static struct platform_device msm_tvenc_device = {
1106 .name = "tvenc",
1107 .id = 0,
1108 .num_resources = ARRAY_SIZE(msm_tvenc_resources),
1109 .resource = msm_tvenc_resources,
1110};
1111
1112#ifdef CONFIG_FB_MSM_TVOUT
1113static struct platform_device tvout_msm_device = {
1114 .name = "tvout_device",
1115 .id = 0,
1116 .num_resources = ARRAY_SIZE(tvout_device_resources),
1117 .resource = tvout_device_resources,
1118};
1119#endif
1120
1121/* TSIF begin */
1122#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
1123
1124#define MSM_TSIF_PHYS (0xa3400000)
1125#define MSM_TSIF_SIZE (0x200)
1126
1127static struct resource tsif_resources[] = {
1128 [0] = {
1129 .flags = IORESOURCE_IRQ,
1130 .start = INT_TSIF,
1131 .end = INT_TSIF,
1132 },
1133 [1] = {
1134 .flags = IORESOURCE_MEM,
1135 .start = MSM_TSIF_PHYS,
1136 .end = MSM_TSIF_PHYS + MSM_TSIF_SIZE - 1,
1137 },
1138 [2] = {
1139 .flags = IORESOURCE_DMA,
1140 .start = DMOV_TSIF_CHAN,
1141 .end = DMOV_TSIF_CRCI,
1142 },
1143};
1144
1145static void tsif_release(struct device *dev)
1146{
1147 dev_info(dev, "release\n");
1148}
1149
1150struct platform_device msm_device_tsif = {
1151 .name = "msm_tsif",
1152 .id = 0,
1153 .num_resources = ARRAY_SIZE(tsif_resources),
1154 .resource = tsif_resources,
1155 .dev = {
1156 .release = tsif_release,
1157 },
1158};
1159#endif /* defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) */
1160/* TSIF end */
1161
1162
1163
1164#ifdef CONFIG_MSM_ROTATOR
1165static struct resource resources_msm_rotator[] = {
1166 {
1167 .start = 0xA3E00000,
1168 .end = 0xA3F00000 - 1,
1169 .flags = IORESOURCE_MEM,
1170 },
1171 {
1172 .start = INT_ROTATOR,
1173 .end = INT_ROTATOR,
1174 .flags = IORESOURCE_IRQ,
1175 },
1176};
1177
1178static struct msm_rot_clocks rotator_clocks[] = {
1179 {
Matt Wagantallbb90da92011-10-25 15:07:52 -07001180 .clk_name = "core_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001181 .clk_type = ROTATOR_CORE_CLK,
1182 .clk_rate = 0,
1183 },
1184 {
Matt Wagantallbb90da92011-10-25 15:07:52 -07001185 .clk_name = "iface_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001186 .clk_type = ROTATOR_PCLK,
1187 .clk_rate = 0,
1188 },
1189 {
Matt Wagantallbb90da92011-10-25 15:07:52 -07001190 .clk_name = "mem_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001191 .clk_type = ROTATOR_IMEM_CLK,
1192 .clk_rate = 0,
1193 },
1194};
1195
1196static struct msm_rotator_platform_data rotator_pdata = {
1197 .number_of_clocks = ARRAY_SIZE(rotator_clocks),
1198 .hardware_version_number = 0x1000303,
1199 .rotator_clks = rotator_clocks,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001200};
1201
1202struct platform_device msm_rotator_device = {
1203 .name = "msm_rotator",
1204 .id = 0,
1205 .num_resources = ARRAY_SIZE(resources_msm_rotator),
1206 .resource = resources_msm_rotator,
1207 .dev = {
1208 .platform_data = &rotator_pdata,
1209 },
1210};
1211#endif
1212
1213static void __init msm_register_device(struct platform_device *pdev, void *data)
1214{
1215 int ret;
1216
1217 pdev->dev.platform_data = data;
1218
1219 ret = platform_device_register(pdev);
1220 if (ret)
1221 dev_err(&pdev->dev,
1222 "%s: platform_device_register() failed = %d\n",
1223 __func__, ret);
1224}
1225
1226void __init msm_fb_register_device(char *name, void *data)
1227{
1228 if (!strncmp(name, "mdp", 3))
1229 msm_register_device(&msm_mdp_device, data);
1230 else if (!strncmp(name, "pmdh", 4))
1231 msm_register_device(&msm_mddi_device, data);
1232 else if (!strncmp(name, "emdh", 4))
1233 msm_register_device(&msm_mddi_ext_device, data);
1234 else if (!strncmp(name, "ebi2", 4))
1235 msm_register_device(&msm_ebi2_lcd_device, data);
1236 else if (!strncmp(name, "tvenc", 5))
1237 msm_register_device(&msm_tvenc_device, data);
1238 else if (!strncmp(name, "lcdc", 4))
1239 msm_register_device(&msm_lcdc_device, data);
1240 else if (!strncmp(name, "dtv", 3))
1241 msm_register_device(&msm_dtv_device, data);
1242#ifdef CONFIG_FB_MSM_TVOUT
1243 else if (!strncmp(name, "tvout_device", 12))
1244 msm_register_device(&tvout_msm_device, data);
1245#endif
1246 else
1247 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
1248}
1249
1250static struct platform_device msm_camera_device = {
1251 .name = "msm_camera",
1252 .id = 0,
1253};
1254
1255void __init msm_camera_register_device(void *res, uint32_t num,
1256 void *data)
1257{
1258 msm_camera_device.num_resources = num;
1259 msm_camera_device.resource = res;
1260
1261 msm_register_device(&msm_camera_device, data);
1262}
1263
1264struct resource kgsl_3d0_resources[] = {
1265 {
1266 .name = KGSL_3D0_REG_MEMORY,
1267 .start = 0xA3500000, /* 3D GRP address */
1268 .end = 0xA351ffff,
1269 .flags = IORESOURCE_MEM,
1270 },
1271 {
1272 .name = KGSL_3D0_IRQ,
1273 .start = INT_GRP_3D,
1274 .end = INT_GRP_3D,
1275 .flags = IORESOURCE_IRQ,
1276 },
1277};
1278
1279static struct kgsl_device_platform_data kgsl_3d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001280 .pwrlevel = {
1281 {
1282 .gpu_freq = 245760000,
1283 .bus_freq = 192000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001284 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001285 {
1286 .gpu_freq = 192000000,
1287 .bus_freq = 152000000,
1288 },
1289 {
1290 .gpu_freq = 192000000,
1291 .bus_freq = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001292 },
1293 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001294 .init_level = 0,
1295 .num_levels = 3,
1296 .set_grp_async = set_grp3d_async,
1297 .idle_timeout = HZ/20,
1298 .nap_allowed = true,
Kedar Joshic11d0982012-02-07 10:59:49 +05301299 .idle_needed = true,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001300 .clk_map = KGSL_CLK_SRC | KGSL_CLK_CORE |
1301 KGSL_CLK_IFACE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001302};
1303
1304struct platform_device msm_kgsl_3d0 = {
1305 .name = "kgsl-3d0",
1306 .id = 0,
1307 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
1308 .resource = kgsl_3d0_resources,
1309 .dev = {
1310 .platform_data = &kgsl_3d0_pdata,
1311 },
1312};
1313
1314static struct resource kgsl_2d0_resources[] = {
1315 {
1316 .name = KGSL_2D0_REG_MEMORY,
1317 .start = 0xA3900000, /* Z180 base address */
1318 .end = 0xA3900FFF,
1319 .flags = IORESOURCE_MEM,
1320 },
1321 {
1322 .name = KGSL_2D0_IRQ,
1323 .start = INT_GRP_2D,
1324 .end = INT_GRP_2D,
1325 .flags = IORESOURCE_IRQ,
1326 },
1327};
1328
1329static struct kgsl_device_platform_data kgsl_2d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001330 .pwrlevel = {
1331 {
Ranjhith Kalisamy9c4d95c2012-08-10 16:40:36 +05301332 .gpu_freq = 0,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001333 .bus_freq = 192000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001334 },
1335 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001336 .init_level = 0,
1337 .num_levels = 1,
1338 /* HW workaround, run Z180 SYNC @ 192 MHZ */
1339 .set_grp_async = NULL,
1340 .idle_timeout = HZ/10,
1341 .nap_allowed = true,
Kedar Joshic11d0982012-02-07 10:59:49 +05301342 .idle_needed = true,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001343 .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001344};
1345
1346struct platform_device msm_kgsl_2d0 = {
1347 .name = "kgsl-2d0",
1348 .id = 0,
1349 .num_resources = ARRAY_SIZE(kgsl_2d0_resources),
1350 .resource = kgsl_2d0_resources,
1351 .dev = {
1352 .platform_data = &kgsl_2d0_pdata,
1353 },
1354};
1355
1356struct platform_device *msm_footswitch_devices[] = {
Matt Wagantalld6fbf232012-05-03 20:09:28 -07001357 FS_PCOM(FS_GFX2D0, "vdd", "kgsl-2d0.0"),
1358 FS_PCOM(FS_GFX3D, "vdd", "kgsl-3d0.0"),
Matt Wagantalld4aab1e2012-05-03 20:26:56 -07001359 FS_PCOM(FS_MDP, "vdd", "mdp.0"),
Matt Wagantall5c922112012-05-03 19:25:28 -07001360 FS_PCOM(FS_MFC, "fs_mfc", NULL),
Matt Wagantall316f2fc2012-05-03 20:41:42 -07001361 FS_PCOM(FS_ROT, "vdd", "msm_rotator.0"),
Matt Wagantall5c922112012-05-03 19:25:28 -07001362 FS_PCOM(FS_VFE, "fs_vfe", NULL),
1363 FS_PCOM(FS_VPE, "fs_vpe", NULL),
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001364};
1365unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);
Taniya Das2e948192011-12-20 11:15:13 +05301366
1367static struct resource gpio_resources[] = {
1368 {
1369 .start = INT_GPIO_GROUP1,
1370 .flags = IORESOURCE_IRQ,
1371 },
1372 {
1373 .start = INT_GPIO_GROUP2,
1374 .flags = IORESOURCE_IRQ,
1375 },
1376};
1377
1378static struct platform_device msm_device_gpio = {
1379 .name = "msmgpio",
1380 .id = -1,
1381 .resource = gpio_resources,
1382 .num_resources = ARRAY_SIZE(gpio_resources),
1383};
1384
1385static int __init msm7630_init_gpio(void)
1386{
1387 platform_device_register(&msm_device_gpio);
1388 return 0;
1389}
1390
1391postcore_initcall(msm7630_init_gpio);