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