blob: 2c21f57ddc52644737a5a659b6d23c43332c2ef0 [file] [log] [blame]
Daniel Walker10932762010-05-12 12:02:25 -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 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>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <linux/msm_kgsl.h>
21#include <linux/android_pmem.h>
22#include <linux/regulator/machine.h>
Daniel Walker10932762010-05-12 12:02:25 -070023#include <mach/irqs.h>
24#include <mach/msm_iomap.h>
25#include <mach/dma.h>
26#include <mach/board.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070027#include <asm/clkdev.h>
Daniel Walker10932762010-05-12 12:02:25 -070028
29#include "devices.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030#include "gpio_hw.h"
31#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>
Daniel Walker10932762010-05-12 12:02:25 -070042
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070043/* EBI THERMAL DRIVER */
44static struct resource msm_ebi0_thermal_resources[] = {
45 {
46 .start = 0xA8600000,
47 .end = 0xA86005FF,
48 .name = "physbase",
49 .flags = IORESOURCE_MEM
50 }
51};
52
53struct platform_device msm_ebi0_thermal = {
54 .name = "msm_popmem-tm",
55 .id = 0,
56 .num_resources = 1,
57 .resource = msm_ebi0_thermal_resources
58};
59
60static struct resource msm_ebi1_thermal_resources[] = {
61 {
62 .start = 0xA8700000,
63 .end = 0xA87005FF,
64 .name = "physbase",
65 .flags = IORESOURCE_MEM
66 }
67};
68
69struct platform_device msm_ebi1_thermal = {
70 .name = "msm_popmem-tm",
71 .id = 1,
72 .num_resources = 1,
73 .resource = msm_ebi1_thermal_resources
74};
75
76
77static struct resource resources_uart1[] = {
78 {
79 .start = INT_UART1,
80 .end = INT_UART1,
81 .flags = IORESOURCE_IRQ,
82 },
83 {
84 .start = MSM_UART1_PHYS,
85 .end = MSM_UART1_PHYS + MSM_UART1_SIZE - 1,
86 .flags = IORESOURCE_MEM,
87 },
88};
Daniel Walker10932762010-05-12 12:02:25 -070089
90static struct resource resources_uart2[] = {
91 {
92 .start = INT_UART2,
93 .end = INT_UART2,
94 .flags = IORESOURCE_IRQ,
95 },
96 {
97 .start = MSM_UART2_PHYS,
98 .end = MSM_UART2_PHYS + MSM_UART2_SIZE - 1,
99 .flags = IORESOURCE_MEM,
Stepan Moskovchenkod41cb8c2011-01-17 20:33:32 -0800100 .name = "uart_resource"
Daniel Walker10932762010-05-12 12:02:25 -0700101 },
102};
103
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700104static struct resource resources_uart3[] = {
105 {
106 .start = INT_UART3,
107 .end = INT_UART3,
108 .flags = IORESOURCE_IRQ,
109 },
110 {
111 .start = MSM_UART3_PHYS,
112 .end = MSM_UART3_PHYS + MSM_UART3_SIZE - 1,
113 .flags = IORESOURCE_MEM,
114 },
115};
116
117struct platform_device msm_device_uart1 = {
118 .name = "msm_serial",
119 .id = 0,
120 .num_resources = ARRAY_SIZE(resources_uart1),
121 .resource = resources_uart1,
122};
123
Daniel Walker10932762010-05-12 12:02:25 -0700124struct platform_device msm_device_uart2 = {
125 .name = "msm_serial",
126 .id = 1,
127 .num_resources = ARRAY_SIZE(resources_uart2),
128 .resource = resources_uart2,
129};
130
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700131struct platform_device msm_device_uart3 = {
132 .name = "msm_serial",
133 .id = 2,
134 .num_resources = ARRAY_SIZE(resources_uart3),
135 .resource = resources_uart3,
Niranjana Vishwanathapuraa8855e92010-10-06 13:52:10 -0700136};
137
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700138#define MSM_UART1DM_PHYS 0xA3300000
139#define MSM_UART2DM_PHYS 0xA3200000
140static struct resource msm_uart1_dm_resources[] = {
141 {
142 .start = MSM_UART1DM_PHYS,
143 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
144 .flags = IORESOURCE_MEM,
145 },
146 {
147 .start = INT_UART1DM_IRQ,
148 .end = INT_UART1DM_IRQ,
149 .flags = IORESOURCE_IRQ,
150 },
151 {
152 .start = INT_UART1DM_RX,
153 .end = INT_UART1DM_RX,
154 .flags = IORESOURCE_IRQ,
155 },
156 {
157 .start = DMOV_HSUART1_TX_CHAN,
158 .end = DMOV_HSUART1_RX_CHAN,
159 .name = "uartdm_channels",
160 .flags = IORESOURCE_DMA,
161 },
162 {
163 .start = DMOV_HSUART1_TX_CRCI,
164 .end = DMOV_HSUART1_RX_CRCI,
165 .name = "uartdm_crci",
166 .flags = IORESOURCE_DMA,
167 },
168};
169
170static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32);
171
172struct platform_device msm_device_uart_dm1 = {
173 .name = "msm_serial_hs",
174 .id = 0,
175 .num_resources = ARRAY_SIZE(msm_uart1_dm_resources),
176 .resource = msm_uart1_dm_resources,
177 .dev = {
178 .dma_mask = &msm_uart_dm1_dma_mask,
179 .coherent_dma_mask = DMA_BIT_MASK(32),
180 },
181};
182
183static struct resource msm_uart2_dm_resources[] = {
184 {
185 .start = MSM_UART2DM_PHYS,
186 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
187 .flags = IORESOURCE_MEM,
188 },
189 {
190 .start = INT_UART2DM_IRQ,
191 .end = INT_UART2DM_IRQ,
192 .flags = IORESOURCE_IRQ,
193 },
194 {
195 .start = INT_UART2DM_RX,
196 .end = INT_UART2DM_RX,
197 .flags = IORESOURCE_IRQ,
198 },
199 {
200 .start = DMOV_HSUART2_TX_CHAN,
201 .end = DMOV_HSUART2_RX_CHAN,
202 .name = "uartdm_channels",
203 .flags = IORESOURCE_DMA,
204 },
205 {
206 .start = DMOV_HSUART2_TX_CRCI,
207 .end = DMOV_HSUART2_RX_CRCI,
208 .name = "uartdm_crci",
209 .flags = IORESOURCE_DMA,
210 },
211};
212
213static u64 msm_uart_dm2_dma_mask = DMA_BIT_MASK(32);
214
215struct platform_device msm_device_uart_dm2 = {
216 .name = "msm_serial_hs",
217 .id = 1,
218 .num_resources = ARRAY_SIZE(msm_uart2_dm_resources),
219 .resource = msm_uart2_dm_resources,
220 .dev = {
221 .dma_mask = &msm_uart_dm2_dma_mask,
222 .coherent_dma_mask = DMA_BIT_MASK(32),
223 },
224};
225
226#define MSM_I2C_SIZE SZ_4K
227#define MSM_I2C_PHYS 0xACD00000
228#define MSM_I2C_2_PHYS 0xACF00000
229static struct resource resources_i2c_2[] = {
230 {
231 .start = MSM_I2C_2_PHYS,
232 .end = MSM_I2C_2_PHYS + MSM_I2C_SIZE - 1,
233 .flags = IORESOURCE_MEM,
234 },
235 {
236 .start = INT_PWB_I2C_2,
237 .end = INT_PWB_I2C_2,
238 .flags = IORESOURCE_IRQ,
239 },
240};
241
242struct platform_device msm_device_i2c_2 = {
243 .name = "msm_i2c",
244 .id = 2,
245 .num_resources = ARRAY_SIZE(resources_i2c_2),
246 .resource = resources_i2c_2,
247};
248
249static struct resource resources_i2c[] = {
250 {
251 .start = MSM_I2C_PHYS,
252 .end = MSM_I2C_PHYS + MSM_I2C_SIZE - 1,
253 .flags = IORESOURCE_MEM,
254 },
255 {
256 .start = INT_PWB_I2C,
257 .end = INT_PWB_I2C,
258 .flags = IORESOURCE_IRQ,
259 },
260};
261
262struct platform_device msm_device_i2c = {
263 .name = "msm_i2c",
264 .id = 0,
265 .num_resources = ARRAY_SIZE(resources_i2c),
266 .resource = resources_i2c,
267};
268
269#define MSM_QUP_PHYS 0xA8301000
270#define MSM_GSBI_QUP_I2C_PHYS 0xA8300000
271#define MSM_QUP_SIZE SZ_4K
272static struct resource resources_qup[] = {
273 {
274 .name = "qup_phys_addr",
275 .start = MSM_QUP_PHYS,
276 .end = MSM_QUP_PHYS + MSM_QUP_SIZE - 1,
277 .flags = IORESOURCE_MEM,
278 },
279 {
280 .name = "gsbi_qup_i2c_addr",
281 .start = MSM_GSBI_QUP_I2C_PHYS,
282 .end = MSM_GSBI_QUP_I2C_PHYS + 4 - 1,
283 .flags = IORESOURCE_MEM,
284 },
285 {
286 .name = "qup_in_intr",
287 .start = INT_PWB_QUP_IN,
288 .end = INT_PWB_QUP_IN,
289 .flags = IORESOURCE_IRQ,
290 },
291 {
292 .name = "qup_out_intr",
293 .start = INT_PWB_QUP_OUT,
294 .end = INT_PWB_QUP_OUT,
295 .flags = IORESOURCE_IRQ,
296 },
297 {
298 .name = "qup_err_intr",
299 .start = INT_PWB_QUP_ERR,
300 .end = INT_PWB_QUP_ERR,
301 .flags = IORESOURCE_IRQ,
302 },
303};
304
305struct platform_device qup_device_i2c = {
306 .name = "qup_i2c",
307 .id = 4,
308 .num_resources = ARRAY_SIZE(resources_qup),
309 .resource = resources_qup,
310};
311
Anirudh Ghayal9d9cdc22011-10-10 17:17:07 +0530312#ifdef CONFIG_MSM_SSBI
313#define MSM_SSBI_PMIC1_PHYS 0xAD900000
314static struct resource msm_ssbi_pmic1_resources[] = {
315 {
316 .start = MSM_SSBI_PMIC1_PHYS,
317 .end = MSM_SSBI_PMIC1_PHYS + SZ_4K - 1,
318 .flags = IORESOURCE_MEM,
319 },
320};
321
322struct platform_device msm_device_ssbi_pmic1 = {
323 .name = "msm_ssbi",
324 .id = 0,
325 .resource = msm_ssbi_pmic1_resources,
326 .num_resources = ARRAY_SIZE(msm_ssbi_pmic1_resources),
327};
328#endif
329
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700330#ifdef CONFIG_I2C_SSBI
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700331#define MSM_SSBI7_PHYS 0xAC800000
332static struct resource msm_ssbi7_resources[] = {
333 {
334 .name = "ssbi_base",
335 .start = MSM_SSBI7_PHYS,
336 .end = MSM_SSBI7_PHYS + SZ_4K - 1,
337 .flags = IORESOURCE_MEM,
338 },
339};
340
341struct platform_device msm_device_ssbi7 = {
342 .name = "i2c_ssbi",
343 .id = 7,
344 .num_resources = ARRAY_SIZE(msm_ssbi7_resources),
345 .resource = msm_ssbi7_resources,
346};
347#endif /* CONFIG_I2C_SSBI */
348
349#define MSM_HSUSB_PHYS 0xA3600000
350static struct resource resources_hsusb_otg[] = {
Pavankumar Kondeti5155e2c2010-12-08 13:37:08 +0530351 {
352 .start = MSM_HSUSB_PHYS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700353 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
Pavankumar Kondeti5155e2c2010-12-08 13:37:08 +0530354 .flags = IORESOURCE_MEM,
355 },
356 {
357 .start = INT_USB_HS,
358 .end = INT_USB_HS,
359 .flags = IORESOURCE_IRQ,
360 },
361};
362
Pavankumar Kondeti5155e2c2010-12-08 13:37:08 +0530363static u64 dma_mask = 0xffffffffULL;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700364struct platform_device msm_device_hsusb_otg = {
365 .name = "msm_hsusb_otg",
366 .id = -1,
367 .num_resources = ARRAY_SIZE(resources_hsusb_otg),
368 .resource = resources_hsusb_otg,
369 .dev = {
370 .dma_mask = &dma_mask,
371 .coherent_dma_mask = 0xffffffffULL,
372 },
373};
374
375static struct resource resources_hsusb_peripheral[] = {
376 {
377 .start = MSM_HSUSB_PHYS,
378 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
379 .flags = IORESOURCE_MEM,
380 },
381 {
382 .start = INT_USB_HS,
383 .end = INT_USB_HS,
384 .flags = IORESOURCE_IRQ,
385 },
386};
387
388static struct resource resources_gadget_peripheral[] = {
389 {
390 .start = MSM_HSUSB_PHYS,
391 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
392 .flags = IORESOURCE_MEM,
393 },
394 {
395 .start = INT_USB_HS,
396 .end = INT_USB_HS,
397 .flags = IORESOURCE_IRQ,
398 },
399};
400
401struct platform_device msm_device_hsusb_peripheral = {
402 .name = "msm_hsusb_peripheral",
403 .id = -1,
404 .num_resources = ARRAY_SIZE(resources_hsusb_peripheral),
405 .resource = resources_hsusb_peripheral,
406 .dev = {
407 .dma_mask = &dma_mask,
408 .coherent_dma_mask = 0xffffffffULL,
409 },
410};
411
412struct platform_device msm_device_gadget_peripheral = {
413 .name = "msm_hsusb",
414 .id = -1,
415 .num_resources = ARRAY_SIZE(resources_gadget_peripheral),
416 .resource = resources_gadget_peripheral,
417 .dev = {
418 .dma_mask = &dma_mask,
419 .coherent_dma_mask = 0xffffffffULL,
420 },
421};
422
Pavankumar Kondeti5155e2c2010-12-08 13:37:08 +0530423static struct resource resources_hsusb_host[] = {
424 {
425 .start = MSM_HSUSB_PHYS,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700426 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
Pavankumar Kondeti5155e2c2010-12-08 13:37:08 +0530427 .flags = IORESOURCE_MEM,
428 },
429 {
430 .start = INT_USB_HS,
431 .end = INT_USB_HS,
432 .flags = IORESOURCE_IRQ,
433 },
434};
435
436struct platform_device msm_device_hsusb_host = {
437 .name = "msm_hsusb_host",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700438 .id = 0,
Pavankumar Kondeti5155e2c2010-12-08 13:37:08 +0530439 .num_resources = ARRAY_SIZE(resources_hsusb_host),
440 .resource = resources_hsusb_host,
441 .dev = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700442 .dma_mask = &dma_mask,
443 .coherent_dma_mask = 0xffffffffULL,
Pavankumar Kondeti5155e2c2010-12-08 13:37:08 +0530444 },
445};
446
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700447static struct platform_device *msm_host_devices[] = {
448 &msm_device_hsusb_host,
Daniel Walker10932762010-05-12 12:02:25 -0700449};
450
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700451int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
452{
453 struct platform_device *pdev;
Daniel Walker10932762010-05-12 12:02:25 -0700454
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700455 pdev = msm_host_devices[host];
456 if (!pdev)
457 return -ENODEV;
458 pdev->dev.platform_data = plat;
459 return platform_device_register(pdev);
460}
461
462struct platform_device asoc_msm_pcm = {
463 .name = "msm-dsp-audio",
464 .id = 0,
465};
466
467struct platform_device asoc_msm_dai0 = {
468 .name = "msm-codec-dai",
469 .id = 0,
470};
471
472struct platform_device asoc_msm_dai1 = {
473 .name = "msm-cpu-dai",
474 .id = 0,
475};
476
477#if defined (CONFIG_SND_MSM_MVS_DAI_SOC)
478struct platform_device asoc_msm_mvs = {
479 .name = "msm-mvs-audio",
480 .id = 0,
481};
482
483struct platform_device asoc_mvs_dai0 = {
484 .name = "mvs-codec-dai",
485 .id = 0,
486};
487
488struct platform_device asoc_mvs_dai1 = {
489 .name = "mvs-cpu-dai",
490 .id = 0,
491};
492#endif
493
494#define MSM_NAND_PHYS 0xA0200000
495#define MSM_NANDC01_PHYS 0xA0240000
496#define MSM_NANDC10_PHYS 0xA0280000
497#define MSM_NANDC11_PHYS 0xA02C0000
498#define EBI2_REG_BASE 0xA0000000
499static struct resource resources_nand[] = {
500 [0] = {
501 .name = "msm_nand_dmac",
502 .start = DMOV_NAND_CHAN,
503 .end = DMOV_NAND_CHAN,
504 .flags = IORESOURCE_DMA,
505 },
506 [1] = {
507 .name = "msm_nand_phys",
508 .start = MSM_NAND_PHYS,
509 .end = MSM_NAND_PHYS + 0x7FF,
510 .flags = IORESOURCE_MEM,
511 },
512 [2] = {
513 .name = "msm_nandc01_phys",
514 .start = MSM_NANDC01_PHYS,
515 .end = MSM_NANDC01_PHYS + 0x7FF,
516 .flags = IORESOURCE_MEM,
517 },
518 [3] = {
519 .name = "msm_nandc10_phys",
520 .start = MSM_NANDC10_PHYS,
521 .end = MSM_NANDC10_PHYS + 0x7FF,
522 .flags = IORESOURCE_MEM,
523 },
524 [4] = {
525 .name = "msm_nandc11_phys",
526 .start = MSM_NANDC11_PHYS,
527 .end = MSM_NANDC11_PHYS + 0x7FF,
528 .flags = IORESOURCE_MEM,
529 },
530 [5] = {
531 .name = "ebi2_reg_base",
532 .start = EBI2_REG_BASE,
533 .end = EBI2_REG_BASE + 0x60,
534 .flags = IORESOURCE_MEM,
535 },
536};
537
538static struct resource resources_otg[] = {
539 {
540 .start = MSM_HSUSB_PHYS,
541 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
542 .flags = IORESOURCE_MEM,
543 },
544 {
545 .start = INT_USB_HS,
546 .end = INT_USB_HS,
547 .flags = IORESOURCE_IRQ,
548 },
549 {
550 .name = "vbus_on",
Anirudh Ghayalc2019332011-11-12 06:29:10 +0530551 .start = PMIC8058_IRQ_BASE + PM8058_CHGVAL_IRQ,
552 .end = PMIC8058_IRQ_BASE + PM8058_CHGVAL_IRQ,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700553 .flags = IORESOURCE_IRQ,
554 },
555};
556
557struct platform_device msm_device_otg = {
558 .name = "msm_otg",
559 .id = -1,
560 .num_resources = ARRAY_SIZE(resources_otg),
561 .resource = resources_otg,
562 .dev = {
563 .coherent_dma_mask = 0xffffffffULL,
564 },
565};
566
567struct flash_platform_data msm_nand_data = {
568 .parts = NULL,
569 .nr_parts = 0,
570 .interleave = 0,
571};
572
573struct platform_device msm_device_nand = {
574 .name = "msm_nand",
575 .id = -1,
576 .num_resources = ARRAY_SIZE(resources_nand),
577 .resource = resources_nand,
578 .dev = {
579 .platform_data = &msm_nand_data,
580 },
581};
582
583struct platform_device msm_device_smd = {
584 .name = "msm_smd",
585 .id = -1,
586};
587
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700588static struct resource msm_dmov_resource[] = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700589 {
590 .start = INT_ADM_AARM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700591 .flags = IORESOURCE_IRQ,
592 },
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700593 {
594 .start = 0xAC400000,
595 .end = 0xAC400000 + SZ_4K - 1,
596 .flags = IORESOURCE_MEM,
597 },
598};
599
600static struct msm_dmov_pdata msm_dmov_pdata = {
601 .sd = 2,
602 .sd_size = 0x400,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700603};
604
605struct platform_device msm_device_dmov = {
606 .name = "msm_dmov",
607 .id = -1,
608 .resource = msm_dmov_resource,
609 .num_resources = ARRAY_SIZE(msm_dmov_resource),
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700610 .dev = {
611 .platform_data = &msm_dmov_pdata,
612 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700613};
614
615#define MSM_SDC1_BASE 0xA0400000
616#define MSM_SDC2_BASE 0xA0500000
617#define MSM_SDC3_BASE 0xA3000000
618#define MSM_SDC4_BASE 0xA3100000
619static struct resource resources_sdc1[] = {
620 {
621 .start = MSM_SDC1_BASE,
622 .end = MSM_SDC1_BASE + SZ_4K - 1,
623 .flags = IORESOURCE_MEM,
624 },
625 {
626 .start = INT_SDC1_0,
627 .end = INT_SDC1_1,
628 .flags = IORESOURCE_IRQ,
629 },
630 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700631 .name = "sdcc_dma_chnl",
632 .start = DMOV_SDC1_CHAN,
633 .end = DMOV_SDC1_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700634 .flags = IORESOURCE_DMA,
635 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700636 {
637 .name = "sdcc_dma_crci",
638 .start = DMOV_SDC1_CRCI,
639 .end = DMOV_SDC1_CRCI,
640 .flags = IORESOURCE_DMA,
641 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700642};
643
644static struct resource resources_sdc2[] = {
645 {
646 .start = MSM_SDC2_BASE,
647 .end = MSM_SDC2_BASE + SZ_4K - 1,
648 .flags = IORESOURCE_MEM,
649 },
650 {
651 .start = INT_SDC2_0,
652 .end = INT_SDC2_1,
653 .flags = IORESOURCE_IRQ,
654 },
655 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700656 .name = "sdcc_dma_chnl",
657 .start = DMOV_SDC2_CHAN,
658 .end = DMOV_SDC2_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700659 .flags = IORESOURCE_DMA,
660 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700661 {
662 .name = "sdcc_dma_crci",
663 .start = DMOV_SDC2_CRCI,
664 .end = DMOV_SDC2_CRCI,
665 .flags = IORESOURCE_DMA,
666 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700667};
668
669static struct resource resources_sdc3[] = {
670 {
671 .start = MSM_SDC3_BASE,
672 .end = MSM_SDC3_BASE + SZ_4K - 1,
673 .flags = IORESOURCE_MEM,
674 },
675 {
676 .start = INT_SDC3_0,
677 .end = INT_SDC3_1,
678 .flags = IORESOURCE_IRQ,
679 },
680 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700681 .name = "sdcc_dma_chnl",
Pankaj Kumare657b9f2011-10-12 20:11:12 +0530682 .start = DMOV_SDC3_CHAN,
683 .end = DMOV_SDC3_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700684 .flags = IORESOURCE_DMA,
685 },
686 {
687 .name = "sdcc_dma_crci",
Pankaj Kumare657b9f2011-10-12 20:11:12 +0530688 .start = DMOV_SDC3_CRCI,
689 .end = DMOV_SDC3_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700690 .flags = IORESOURCE_DMA,
691 },
692};
693
694static struct resource resources_sdc4[] = {
695 {
696 .start = MSM_SDC4_BASE,
697 .end = MSM_SDC4_BASE + SZ_4K - 1,
698 .flags = IORESOURCE_MEM,
699 },
700 {
701 .start = INT_SDC4_0,
702 .end = INT_SDC4_1,
703 .flags = IORESOURCE_IRQ,
704 },
705 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700706 .name = "sdcc_dma_chnl",
Pankaj Kumare657b9f2011-10-12 20:11:12 +0530707 .start = DMOV_SDC4_CHAN,
708 .end = DMOV_SDC4_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700709 .flags = IORESOURCE_DMA,
710 },
711 {
712 .name = "sdcc_dma_crci",
Pankaj Kumare657b9f2011-10-12 20:11:12 +0530713 .start = DMOV_SDC4_CRCI,
714 .end = DMOV_SDC4_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700715 .flags = IORESOURCE_DMA,
716 },
717};
718
719struct platform_device msm_device_sdc1 = {
720 .name = "msm_sdcc",
721 .id = 1,
722 .num_resources = ARRAY_SIZE(resources_sdc1),
723 .resource = resources_sdc1,
724 .dev = {
725 .coherent_dma_mask = 0xffffffff,
726 },
727};
728
729struct platform_device msm_device_sdc2 = {
730 .name = "msm_sdcc",
731 .id = 2,
732 .num_resources = ARRAY_SIZE(resources_sdc2),
733 .resource = resources_sdc2,
734 .dev = {
735 .coherent_dma_mask = 0xffffffff,
736 },
737};
738
739struct platform_device msm_device_sdc3 = {
740 .name = "msm_sdcc",
741 .id = 3,
742 .num_resources = ARRAY_SIZE(resources_sdc3),
743 .resource = resources_sdc3,
744 .dev = {
745 .coherent_dma_mask = 0xffffffff,
746 },
747};
748
749struct platform_device msm_device_sdc4 = {
750 .name = "msm_sdcc",
751 .id = 4,
752 .num_resources = ARRAY_SIZE(resources_sdc4),
753 .resource = resources_sdc4,
754 .dev = {
755 .coherent_dma_mask = 0xffffffff,
756 },
757};
758
759static struct platform_device *msm_sdcc_devices[] __initdata = {
760 &msm_device_sdc1,
761 &msm_device_sdc2,
762 &msm_device_sdc3,
763 &msm_device_sdc4,
764};
765
766int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
767{
768 struct platform_device *pdev;
769
770 if (controller < 1 || controller > 4)
771 return -EINVAL;
772
773 pdev = msm_sdcc_devices[controller-1];
774 pdev->dev.platform_data = plat;
775 return platform_device_register(pdev);
776}
777
778static struct resource msm_vidc_720p_resources[] = {
779 {
780 .start = 0xA3B00000,
781 .end = 0xA3B00000 + SZ_4K - 1,
782 .flags = IORESOURCE_MEM,
783 },
784 {
785 .start = INT_MFC720,
786 .end = INT_MFC720,
787 .flags = IORESOURCE_IRQ,
788 },
789};
790
791struct msm_vidc_platform_data vidc_platform_data = {
Deepak Koturcb4f6722011-10-31 14:06:57 -0700792 .memtype = MEMTYPE_EBI0,
Deepika Pepakayalabebc7622011-12-01 15:13:43 -0800793 .enable_ion = 0,
794 .disable_dmx = 0
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700795};
796
797struct platform_device msm_device_vidc_720p = {
798 .name = "msm_vidc",
799 .id = 0,
800 .num_resources = ARRAY_SIZE(msm_vidc_720p_resources),
801 .resource = msm_vidc_720p_resources,
802 .dev = {
803 .platform_data = &vidc_platform_data,
804 },
805};
806
807#if defined(CONFIG_FB_MSM_MDP40)
808#define MDP_BASE 0xA3F00000
809#define PMDH_BASE 0xAD600000
810#define EMDH_BASE 0xAD700000
811#define TVENC_BASE 0xAD400000
812#else
813#define MDP_BASE 0xAA200000
814#define PMDH_BASE 0xAA600000
815#define EMDH_BASE 0xAA700000
816#define TVENC_BASE 0xAA400000
817#endif
818
819static struct resource msm_mdp_resources[] = {
820 {
821 .name = "mdp",
822 .start = MDP_BASE,
823 .end = MDP_BASE + 0x000F0000 - 1,
824 .flags = IORESOURCE_MEM,
825 },
826 {
827 .start = INT_MDP,
828 .end = INT_MDP,
829 .flags = IORESOURCE_IRQ,
830 },
831};
832
833static struct resource msm_mddi_resources[] = {
834 {
835 .name = "pmdh",
836 .start = PMDH_BASE,
837 .end = PMDH_BASE + PAGE_SIZE - 1,
838 .flags = IORESOURCE_MEM,
839 }
840};
841
842static struct resource msm_mddi_ext_resources[] = {
843 {
844 .name = "emdh",
845 .start = EMDH_BASE,
846 .end = EMDH_BASE + PAGE_SIZE - 1,
847 .flags = IORESOURCE_MEM,
848 }
849};
850
851static struct resource msm_ebi2_lcd_resources[] = {
852 {
853 .name = "base",
854 .start = 0xa0d00000,
855 .end = 0xa0d00000 + PAGE_SIZE - 1,
856 .flags = IORESOURCE_MEM,
857 },
858 {
859 .name = "lcd01",
860 .start = 0x98000000,
861 .end = 0x98000000 + 0x80000 - 1,
862 .flags = IORESOURCE_MEM,
863 },
864 {
865 .name = "lcd02",
866 .start = 0x9c000000,
867 .end = 0x9c000000 + 0x80000 - 1,
868 .flags = IORESOURCE_MEM,
869 },
870};
871
872static struct resource msm_tvenc_resources[] = {
873 {
874 .name = "tvenc",
875 .start = TVENC_BASE,
876 .end = TVENC_BASE + PAGE_SIZE - 1,
877 .flags = IORESOURCE_MEM,
878 }
879};
880
881#ifdef CONFIG_FB_MSM_TVOUT
882static struct resource tvout_device_resources[] = {
883 {
884 .name = "tvout_device_irq",
885 .start = INT_TV_ENC,
886 .end = INT_TV_ENC,
887 .flags = IORESOURCE_IRQ,
888 },
889};
890#endif
891
892static struct platform_device msm_mdp_device = {
893 .name = "mdp",
894 .id = 0,
895 .num_resources = ARRAY_SIZE(msm_mdp_resources),
896 .resource = msm_mdp_resources,
897};
898
899static struct platform_device msm_mddi_device = {
900 .name = "mddi",
901 .id = 0,
902 .num_resources = ARRAY_SIZE(msm_mddi_resources),
903 .resource = msm_mddi_resources,
904};
905
906static struct platform_device msm_mddi_ext_device = {
907 .name = "mddi_ext",
908 .id = 0,
909 .num_resources = ARRAY_SIZE(msm_mddi_ext_resources),
910 .resource = msm_mddi_ext_resources,
911};
912
913static struct platform_device msm_ebi2_lcd_device = {
914 .name = "ebi2_lcd",
915 .id = 0,
916 .num_resources = ARRAY_SIZE(msm_ebi2_lcd_resources),
917 .resource = msm_ebi2_lcd_resources,
918};
919
920static struct platform_device msm_lcdc_device = {
921 .name = "lcdc",
922 .id = 0,
923};
924
925static struct platform_device msm_dtv_device = {
926 .name = "dtv",
927 .id = 0,
928};
929
930static struct platform_device msm_tvenc_device = {
931 .name = "tvenc",
932 .id = 0,
933 .num_resources = ARRAY_SIZE(msm_tvenc_resources),
934 .resource = msm_tvenc_resources,
935};
936
937#ifdef CONFIG_FB_MSM_TVOUT
938static struct platform_device tvout_msm_device = {
939 .name = "tvout_device",
940 .id = 0,
941 .num_resources = ARRAY_SIZE(tvout_device_resources),
942 .resource = tvout_device_resources,
943};
944#endif
945
946/* TSIF begin */
947#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
948
949#define MSM_TSIF_PHYS (0xa3400000)
950#define MSM_TSIF_SIZE (0x200)
951
952static struct resource tsif_resources[] = {
953 [0] = {
954 .flags = IORESOURCE_IRQ,
955 .start = INT_TSIF,
956 .end = INT_TSIF,
957 },
958 [1] = {
959 .flags = IORESOURCE_MEM,
960 .start = MSM_TSIF_PHYS,
961 .end = MSM_TSIF_PHYS + MSM_TSIF_SIZE - 1,
962 },
963 [2] = {
964 .flags = IORESOURCE_DMA,
965 .start = DMOV_TSIF_CHAN,
966 .end = DMOV_TSIF_CRCI,
967 },
968};
969
970static void tsif_release(struct device *dev)
971{
972 dev_info(dev, "release\n");
973}
974
975struct platform_device msm_device_tsif = {
976 .name = "msm_tsif",
977 .id = 0,
978 .num_resources = ARRAY_SIZE(tsif_resources),
979 .resource = tsif_resources,
980 .dev = {
981 .release = tsif_release,
982 },
983};
984#endif /* defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) */
985/* TSIF end */
986
987
988
989#ifdef CONFIG_MSM_ROTATOR
990static struct resource resources_msm_rotator[] = {
991 {
992 .start = 0xA3E00000,
993 .end = 0xA3F00000 - 1,
994 .flags = IORESOURCE_MEM,
995 },
996 {
997 .start = INT_ROTATOR,
998 .end = INT_ROTATOR,
999 .flags = IORESOURCE_IRQ,
1000 },
1001};
1002
1003static struct msm_rot_clocks rotator_clocks[] = {
1004 {
Matt Wagantallbb90da92011-10-25 15:07:52 -07001005 .clk_name = "core_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001006 .clk_type = ROTATOR_CORE_CLK,
1007 .clk_rate = 0,
1008 },
1009 {
Matt Wagantallbb90da92011-10-25 15:07:52 -07001010 .clk_name = "iface_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001011 .clk_type = ROTATOR_PCLK,
1012 .clk_rate = 0,
1013 },
1014 {
Matt Wagantallbb90da92011-10-25 15:07:52 -07001015 .clk_name = "mem_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001016 .clk_type = ROTATOR_IMEM_CLK,
1017 .clk_rate = 0,
1018 },
1019};
1020
1021static struct msm_rotator_platform_data rotator_pdata = {
1022 .number_of_clocks = ARRAY_SIZE(rotator_clocks),
1023 .hardware_version_number = 0x1000303,
1024 .rotator_clks = rotator_clocks,
1025 .regulator_name = "fs_rot",
1026};
1027
1028struct platform_device msm_rotator_device = {
1029 .name = "msm_rotator",
1030 .id = 0,
1031 .num_resources = ARRAY_SIZE(resources_msm_rotator),
1032 .resource = resources_msm_rotator,
1033 .dev = {
1034 .platform_data = &rotator_pdata,
1035 },
1036};
1037#endif
1038
1039static void __init msm_register_device(struct platform_device *pdev, void *data)
1040{
1041 int ret;
1042
1043 pdev->dev.platform_data = data;
1044
1045 ret = platform_device_register(pdev);
1046 if (ret)
1047 dev_err(&pdev->dev,
1048 "%s: platform_device_register() failed = %d\n",
1049 __func__, ret);
1050}
1051
1052void __init msm_fb_register_device(char *name, void *data)
1053{
1054 if (!strncmp(name, "mdp", 3))
1055 msm_register_device(&msm_mdp_device, data);
1056 else if (!strncmp(name, "pmdh", 4))
1057 msm_register_device(&msm_mddi_device, data);
1058 else if (!strncmp(name, "emdh", 4))
1059 msm_register_device(&msm_mddi_ext_device, data);
1060 else if (!strncmp(name, "ebi2", 4))
1061 msm_register_device(&msm_ebi2_lcd_device, data);
1062 else if (!strncmp(name, "tvenc", 5))
1063 msm_register_device(&msm_tvenc_device, data);
1064 else if (!strncmp(name, "lcdc", 4))
1065 msm_register_device(&msm_lcdc_device, data);
1066 else if (!strncmp(name, "dtv", 3))
1067 msm_register_device(&msm_dtv_device, data);
1068#ifdef CONFIG_FB_MSM_TVOUT
1069 else if (!strncmp(name, "tvout_device", 12))
1070 msm_register_device(&tvout_msm_device, data);
1071#endif
1072 else
1073 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
1074}
1075
1076static struct platform_device msm_camera_device = {
1077 .name = "msm_camera",
1078 .id = 0,
1079};
1080
1081void __init msm_camera_register_device(void *res, uint32_t num,
1082 void *data)
1083{
1084 msm_camera_device.num_resources = num;
1085 msm_camera_device.resource = res;
1086
1087 msm_register_device(&msm_camera_device, data);
1088}
1089
1090struct resource kgsl_3d0_resources[] = {
1091 {
1092 .name = KGSL_3D0_REG_MEMORY,
1093 .start = 0xA3500000, /* 3D GRP address */
1094 .end = 0xA351ffff,
1095 .flags = IORESOURCE_MEM,
1096 },
1097 {
1098 .name = KGSL_3D0_IRQ,
1099 .start = INT_GRP_3D,
1100 .end = INT_GRP_3D,
1101 .flags = IORESOURCE_IRQ,
1102 },
1103};
1104
1105static struct kgsl_device_platform_data kgsl_3d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001106 .pwrlevel = {
1107 {
1108 .gpu_freq = 245760000,
1109 .bus_freq = 192000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001110 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001111 {
1112 .gpu_freq = 192000000,
1113 .bus_freq = 152000000,
1114 },
1115 {
1116 .gpu_freq = 192000000,
1117 .bus_freq = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001118 },
1119 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001120 .init_level = 0,
1121 .num_levels = 3,
1122 .set_grp_async = set_grp3d_async,
1123 .idle_timeout = HZ/20,
1124 .nap_allowed = true,
1125 .clk_map = KGSL_CLK_SRC | KGSL_CLK_CORE |
1126 KGSL_CLK_IFACE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001127};
1128
1129struct platform_device msm_kgsl_3d0 = {
1130 .name = "kgsl-3d0",
1131 .id = 0,
1132 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
1133 .resource = kgsl_3d0_resources,
1134 .dev = {
1135 .platform_data = &kgsl_3d0_pdata,
1136 },
1137};
1138
1139static struct resource kgsl_2d0_resources[] = {
1140 {
1141 .name = KGSL_2D0_REG_MEMORY,
1142 .start = 0xA3900000, /* Z180 base address */
1143 .end = 0xA3900FFF,
1144 .flags = IORESOURCE_MEM,
1145 },
1146 {
1147 .name = KGSL_2D0_IRQ,
1148 .start = INT_GRP_2D,
1149 .end = INT_GRP_2D,
1150 .flags = IORESOURCE_IRQ,
1151 },
1152};
1153
1154static struct kgsl_device_platform_data kgsl_2d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001155 .pwrlevel = {
1156 {
1157 .gpu_freq = 0,
1158 .bus_freq = 192000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001159 },
1160 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -06001161 .init_level = 0,
1162 .num_levels = 1,
1163 /* HW workaround, run Z180 SYNC @ 192 MHZ */
1164 .set_grp_async = NULL,
1165 .idle_timeout = HZ/10,
1166 .nap_allowed = true,
1167 .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001168};
1169
1170struct platform_device msm_kgsl_2d0 = {
1171 .name = "kgsl-2d0",
1172 .id = 0,
1173 .num_resources = ARRAY_SIZE(kgsl_2d0_resources),
1174 .resource = kgsl_2d0_resources,
1175 .dev = {
1176 .platform_data = &kgsl_2d0_pdata,
1177 },
1178};
1179
1180struct platform_device *msm_footswitch_devices[] = {
1181 FS_PCOM(FS_GFX2D0, "fs_gfx2d0"),
1182 FS_PCOM(FS_GFX3D, "fs_gfx3d"),
1183 FS_PCOM(FS_MDP, "fs_mdp"),
1184 FS_PCOM(FS_MFC, "fs_mfc"),
1185 FS_PCOM(FS_ROT, "fs_rot"),
1186 FS_PCOM(FS_VFE, "fs_vfe"),
1187 FS_PCOM(FS_VPE, "fs_vpe"),
1188};
1189unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);