blob: 017eed9e9ebc645c09b31d7d9bb5998da4f52dbe [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,
793 .enable_ion = 0
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700794};
795
796struct platform_device msm_device_vidc_720p = {
797 .name = "msm_vidc",
798 .id = 0,
799 .num_resources = ARRAY_SIZE(msm_vidc_720p_resources),
800 .resource = msm_vidc_720p_resources,
801 .dev = {
802 .platform_data = &vidc_platform_data,
803 },
804};
805
806#if defined(CONFIG_FB_MSM_MDP40)
807#define MDP_BASE 0xA3F00000
808#define PMDH_BASE 0xAD600000
809#define EMDH_BASE 0xAD700000
810#define TVENC_BASE 0xAD400000
811#else
812#define MDP_BASE 0xAA200000
813#define PMDH_BASE 0xAA600000
814#define EMDH_BASE 0xAA700000
815#define TVENC_BASE 0xAA400000
816#endif
817
818static struct resource msm_mdp_resources[] = {
819 {
820 .name = "mdp",
821 .start = MDP_BASE,
822 .end = MDP_BASE + 0x000F0000 - 1,
823 .flags = IORESOURCE_MEM,
824 },
825 {
826 .start = INT_MDP,
827 .end = INT_MDP,
828 .flags = IORESOURCE_IRQ,
829 },
830};
831
832static struct resource msm_mddi_resources[] = {
833 {
834 .name = "pmdh",
835 .start = PMDH_BASE,
836 .end = PMDH_BASE + PAGE_SIZE - 1,
837 .flags = IORESOURCE_MEM,
838 }
839};
840
841static struct resource msm_mddi_ext_resources[] = {
842 {
843 .name = "emdh",
844 .start = EMDH_BASE,
845 .end = EMDH_BASE + PAGE_SIZE - 1,
846 .flags = IORESOURCE_MEM,
847 }
848};
849
850static struct resource msm_ebi2_lcd_resources[] = {
851 {
852 .name = "base",
853 .start = 0xa0d00000,
854 .end = 0xa0d00000 + PAGE_SIZE - 1,
855 .flags = IORESOURCE_MEM,
856 },
857 {
858 .name = "lcd01",
859 .start = 0x98000000,
860 .end = 0x98000000 + 0x80000 - 1,
861 .flags = IORESOURCE_MEM,
862 },
863 {
864 .name = "lcd02",
865 .start = 0x9c000000,
866 .end = 0x9c000000 + 0x80000 - 1,
867 .flags = IORESOURCE_MEM,
868 },
869};
870
871static struct resource msm_tvenc_resources[] = {
872 {
873 .name = "tvenc",
874 .start = TVENC_BASE,
875 .end = TVENC_BASE + PAGE_SIZE - 1,
876 .flags = IORESOURCE_MEM,
877 }
878};
879
880#ifdef CONFIG_FB_MSM_TVOUT
881static struct resource tvout_device_resources[] = {
882 {
883 .name = "tvout_device_irq",
884 .start = INT_TV_ENC,
885 .end = INT_TV_ENC,
886 .flags = IORESOURCE_IRQ,
887 },
888};
889#endif
890
891static struct platform_device msm_mdp_device = {
892 .name = "mdp",
893 .id = 0,
894 .num_resources = ARRAY_SIZE(msm_mdp_resources),
895 .resource = msm_mdp_resources,
896};
897
898static struct platform_device msm_mddi_device = {
899 .name = "mddi",
900 .id = 0,
901 .num_resources = ARRAY_SIZE(msm_mddi_resources),
902 .resource = msm_mddi_resources,
903};
904
905static struct platform_device msm_mddi_ext_device = {
906 .name = "mddi_ext",
907 .id = 0,
908 .num_resources = ARRAY_SIZE(msm_mddi_ext_resources),
909 .resource = msm_mddi_ext_resources,
910};
911
912static struct platform_device msm_ebi2_lcd_device = {
913 .name = "ebi2_lcd",
914 .id = 0,
915 .num_resources = ARRAY_SIZE(msm_ebi2_lcd_resources),
916 .resource = msm_ebi2_lcd_resources,
917};
918
919static struct platform_device msm_lcdc_device = {
920 .name = "lcdc",
921 .id = 0,
922};
923
924static struct platform_device msm_dtv_device = {
925 .name = "dtv",
926 .id = 0,
927};
928
929static struct platform_device msm_tvenc_device = {
930 .name = "tvenc",
931 .id = 0,
932 .num_resources = ARRAY_SIZE(msm_tvenc_resources),
933 .resource = msm_tvenc_resources,
934};
935
936#ifdef CONFIG_FB_MSM_TVOUT
937static struct platform_device tvout_msm_device = {
938 .name = "tvout_device",
939 .id = 0,
940 .num_resources = ARRAY_SIZE(tvout_device_resources),
941 .resource = tvout_device_resources,
942};
943#endif
944
945/* TSIF begin */
946#if defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE)
947
948#define MSM_TSIF_PHYS (0xa3400000)
949#define MSM_TSIF_SIZE (0x200)
950
951static struct resource tsif_resources[] = {
952 [0] = {
953 .flags = IORESOURCE_IRQ,
954 .start = INT_TSIF,
955 .end = INT_TSIF,
956 },
957 [1] = {
958 .flags = IORESOURCE_MEM,
959 .start = MSM_TSIF_PHYS,
960 .end = MSM_TSIF_PHYS + MSM_TSIF_SIZE - 1,
961 },
962 [2] = {
963 .flags = IORESOURCE_DMA,
964 .start = DMOV_TSIF_CHAN,
965 .end = DMOV_TSIF_CRCI,
966 },
967};
968
969static void tsif_release(struct device *dev)
970{
971 dev_info(dev, "release\n");
972}
973
974struct platform_device msm_device_tsif = {
975 .name = "msm_tsif",
976 .id = 0,
977 .num_resources = ARRAY_SIZE(tsif_resources),
978 .resource = tsif_resources,
979 .dev = {
980 .release = tsif_release,
981 },
982};
983#endif /* defined(CONFIG_TSIF) || defined(CONFIG_TSIF_MODULE) */
984/* TSIF end */
985
986
987
988#ifdef CONFIG_MSM_ROTATOR
989static struct resource resources_msm_rotator[] = {
990 {
991 .start = 0xA3E00000,
992 .end = 0xA3F00000 - 1,
993 .flags = IORESOURCE_MEM,
994 },
995 {
996 .start = INT_ROTATOR,
997 .end = INT_ROTATOR,
998 .flags = IORESOURCE_IRQ,
999 },
1000};
1001
1002static struct msm_rot_clocks rotator_clocks[] = {
1003 {
Matt Wagantallbb90da92011-10-25 15:07:52 -07001004 .clk_name = "core_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001005 .clk_type = ROTATOR_CORE_CLK,
1006 .clk_rate = 0,
1007 },
1008 {
Matt Wagantallbb90da92011-10-25 15:07:52 -07001009 .clk_name = "iface_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001010 .clk_type = ROTATOR_PCLK,
1011 .clk_rate = 0,
1012 },
1013 {
Matt Wagantallbb90da92011-10-25 15:07:52 -07001014 .clk_name = "mem_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001015 .clk_type = ROTATOR_IMEM_CLK,
1016 .clk_rate = 0,
1017 },
1018};
1019
1020static struct msm_rotator_platform_data rotator_pdata = {
1021 .number_of_clocks = ARRAY_SIZE(rotator_clocks),
1022 .hardware_version_number = 0x1000303,
1023 .rotator_clks = rotator_clocks,
1024 .regulator_name = "fs_rot",
1025};
1026
1027struct platform_device msm_rotator_device = {
1028 .name = "msm_rotator",
1029 .id = 0,
1030 .num_resources = ARRAY_SIZE(resources_msm_rotator),
1031 .resource = resources_msm_rotator,
1032 .dev = {
1033 .platform_data = &rotator_pdata,
1034 },
1035};
1036#endif
1037
1038static void __init msm_register_device(struct platform_device *pdev, void *data)
1039{
1040 int ret;
1041
1042 pdev->dev.platform_data = data;
1043
1044 ret = platform_device_register(pdev);
1045 if (ret)
1046 dev_err(&pdev->dev,
1047 "%s: platform_device_register() failed = %d\n",
1048 __func__, ret);
1049}
1050
1051void __init msm_fb_register_device(char *name, void *data)
1052{
1053 if (!strncmp(name, "mdp", 3))
1054 msm_register_device(&msm_mdp_device, data);
1055 else if (!strncmp(name, "pmdh", 4))
1056 msm_register_device(&msm_mddi_device, data);
1057 else if (!strncmp(name, "emdh", 4))
1058 msm_register_device(&msm_mddi_ext_device, data);
1059 else if (!strncmp(name, "ebi2", 4))
1060 msm_register_device(&msm_ebi2_lcd_device, data);
1061 else if (!strncmp(name, "tvenc", 5))
1062 msm_register_device(&msm_tvenc_device, data);
1063 else if (!strncmp(name, "lcdc", 4))
1064 msm_register_device(&msm_lcdc_device, data);
1065 else if (!strncmp(name, "dtv", 3))
1066 msm_register_device(&msm_dtv_device, data);
1067#ifdef CONFIG_FB_MSM_TVOUT
1068 else if (!strncmp(name, "tvout_device", 12))
1069 msm_register_device(&tvout_msm_device, data);
1070#endif
1071 else
1072 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
1073}
1074
1075static struct platform_device msm_camera_device = {
1076 .name = "msm_camera",
1077 .id = 0,
1078};
1079
1080void __init msm_camera_register_device(void *res, uint32_t num,
1081 void *data)
1082{
1083 msm_camera_device.num_resources = num;
1084 msm_camera_device.resource = res;
1085
1086 msm_register_device(&msm_camera_device, data);
1087}
1088
1089struct resource kgsl_3d0_resources[] = {
1090 {
1091 .name = KGSL_3D0_REG_MEMORY,
1092 .start = 0xA3500000, /* 3D GRP address */
1093 .end = 0xA351ffff,
1094 .flags = IORESOURCE_MEM,
1095 },
1096 {
1097 .name = KGSL_3D0_IRQ,
1098 .start = INT_GRP_3D,
1099 .end = INT_GRP_3D,
1100 .flags = IORESOURCE_IRQ,
1101 },
1102};
1103
1104static struct kgsl_device_platform_data kgsl_3d0_pdata = {
1105 .pwr_data = {
1106 .pwrlevel = {
1107 {
1108 .gpu_freq = 245760000,
1109 .bus_freq = 192000000,
1110 },
1111 {
1112 .gpu_freq = 192000000,
1113 .bus_freq = 152000000,
1114 },
1115 {
1116 .gpu_freq = 192000000,
1117 .bus_freq = 0,
1118 },
1119 },
1120 .init_level = 0,
1121 .num_levels = 3,
1122 .set_grp_async = set_grp3d_async,
1123 .idle_timeout = HZ/20,
1124 .nap_allowed = true,
1125 },
1126 .clk = {
1127 .name = {
Matt Wagantall9dc01632011-08-17 18:55:04 -07001128 .clk = "core_clk",
1129 .pclk = "iface_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001130 },
1131 },
1132 .imem_clk_name = {
Matt Wagantall9dc01632011-08-17 18:55:04 -07001133 .clk = "mem_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001134 .pclk = NULL,
1135 },
1136};
1137
1138struct platform_device msm_kgsl_3d0 = {
1139 .name = "kgsl-3d0",
1140 .id = 0,
1141 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
1142 .resource = kgsl_3d0_resources,
1143 .dev = {
1144 .platform_data = &kgsl_3d0_pdata,
1145 },
1146};
1147
1148static struct resource kgsl_2d0_resources[] = {
1149 {
1150 .name = KGSL_2D0_REG_MEMORY,
1151 .start = 0xA3900000, /* Z180 base address */
1152 .end = 0xA3900FFF,
1153 .flags = IORESOURCE_MEM,
1154 },
1155 {
1156 .name = KGSL_2D0_IRQ,
1157 .start = INT_GRP_2D,
1158 .end = INT_GRP_2D,
1159 .flags = IORESOURCE_IRQ,
1160 },
1161};
1162
1163static struct kgsl_device_platform_data kgsl_2d0_pdata = {
1164 .pwr_data = {
1165 .pwrlevel = {
1166 {
1167 .gpu_freq = 0,
1168 .bus_freq = 192000000,
1169 },
1170 },
1171 .init_level = 0,
1172 .num_levels = 1,
1173 /* HW workaround, run Z180 SYNC @ 192 MHZ */
1174 .set_grp_async = NULL,
1175 .idle_timeout = HZ/10,
1176 .nap_allowed = true,
1177 },
1178 .clk = {
1179 .name = {
Matt Wagantall9dc01632011-08-17 18:55:04 -07001180 .clk = "core_clk",
1181 .pclk = "iface_clk",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001182 },
1183 },
1184};
1185
1186struct platform_device msm_kgsl_2d0 = {
1187 .name = "kgsl-2d0",
1188 .id = 0,
1189 .num_resources = ARRAY_SIZE(kgsl_2d0_resources),
1190 .resource = kgsl_2d0_resources,
1191 .dev = {
1192 .platform_data = &kgsl_2d0_pdata,
1193 },
1194};
1195
1196struct platform_device *msm_footswitch_devices[] = {
1197 FS_PCOM(FS_GFX2D0, "fs_gfx2d0"),
1198 FS_PCOM(FS_GFX3D, "fs_gfx3d"),
1199 FS_PCOM(FS_MDP, "fs_mdp"),
1200 FS_PCOM(FS_MFC, "fs_mfc"),
1201 FS_PCOM(FS_ROT, "fs_rot"),
1202 FS_PCOM(FS_VFE, "fs_vfe"),
1203 FS_PCOM(FS_VPE, "fs_vpe"),
1204};
1205unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);