blob: 9a4696fea965a5ffebcb241a6c30480d585a150e [file] [log] [blame]
Taniya Das2e948192011-12-20 11:15:13 +05301/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/dma-mapping.h>
16#include <linux/msm_kgsl.h>
17#include <linux/regulator/machine.h>
Taniya Das2e948192011-12-20 11:15:13 +053018#include <linux/init.h>
Taniya Das43bcdd62011-12-02 17:33:27 +053019#include <linux/irq.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070020#include <mach/irqs.h>
21#include <mach/msm_iomap.h>
22#include <mach/board.h>
23#include <mach/dma.h>
24#include <mach/dal_axi.h>
25#include <asm/mach/flash.h>
Taniya Das43bcdd62011-12-02 17:33:27 +053026#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070027#include <asm/hardware/cache-l2x0.h>
28#include <asm/mach/mmc.h>
29#include <mach/rpc_hsusb.h>
30#include <mach/socinfo.h>
31
32#include "devices.h"
33#include "devices-msm7x2xa.h"
34#include "footswitch.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070035#include "acpuclock.h"
Murali Nalajala41786ab2012-03-06 10:47:32 +053036#include "spm.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070037
38/* Address of GSBI blocks */
39#define MSM_GSBI0_PHYS 0xA1200000
40#define MSM_GSBI1_PHYS 0xA1300000
41
42/* GSBI QUPe devices */
43#define MSM_GSBI0_QUP_PHYS (MSM_GSBI0_PHYS + 0x80000)
44#define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000)
45
46static struct resource gsbi0_qup_i2c_resources[] = {
47 {
48 .name = "qup_phys_addr",
49 .start = MSM_GSBI0_QUP_PHYS,
50 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
51 .flags = IORESOURCE_MEM,
52 },
53 {
54 .name = "gsbi_qup_i2c_addr",
55 .start = MSM_GSBI0_PHYS,
56 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
57 .flags = IORESOURCE_MEM,
58 },
59 {
60 .name = "qup_err_intr",
61 .start = INT_PWB_I2C,
62 .end = INT_PWB_I2C,
63 .flags = IORESOURCE_IRQ,
64 },
65};
66
67/* Use GSBI0 QUP for /dev/i2c-0 */
68struct platform_device msm_gsbi0_qup_i2c_device = {
69 .name = "qup_i2c",
70 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
71 .num_resources = ARRAY_SIZE(gsbi0_qup_i2c_resources),
72 .resource = gsbi0_qup_i2c_resources,
73};
74
75static struct resource gsbi1_qup_i2c_resources[] = {
76 {
77 .name = "qup_phys_addr",
78 .start = MSM_GSBI1_QUP_PHYS,
79 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
80 .flags = IORESOURCE_MEM,
81 },
82 {
83 .name = "gsbi_qup_i2c_addr",
84 .start = MSM_GSBI1_PHYS,
85 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
86 .flags = IORESOURCE_MEM,
87 },
88 {
89 .name = "qup_err_intr",
90 .start = INT_ARM11_DMA,
91 .end = INT_ARM11_DMA,
92 .flags = IORESOURCE_IRQ,
93 },
94};
95
96/* Use GSBI1 QUP for /dev/i2c-1 */
97struct platform_device msm_gsbi1_qup_i2c_device = {
98 .name = "qup_i2c",
99 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
100 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
101 .resource = gsbi1_qup_i2c_resources,
102};
103
104#define MSM_HSUSB_PHYS 0xA0800000
105static struct resource resources_hsusb_otg[] = {
106 {
107 .start = MSM_HSUSB_PHYS,
108 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
109 .flags = IORESOURCE_MEM,
110 },
111 {
112 .start = INT_USB_HS,
113 .end = INT_USB_HS,
114 .flags = IORESOURCE_IRQ,
115 },
116};
117
118static u64 dma_mask = 0xffffffffULL;
119struct platform_device msm_device_otg = {
120 .name = "msm_otg",
121 .id = -1,
122 .num_resources = ARRAY_SIZE(resources_hsusb_otg),
123 .resource = resources_hsusb_otg,
124 .dev = {
125 .dma_mask = &dma_mask,
126 .coherent_dma_mask = 0xffffffffULL,
127 },
128};
129
130static struct resource resources_gadget_peripheral[] = {
131 {
132 .start = MSM_HSUSB_PHYS,
133 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
134 .flags = IORESOURCE_MEM,
135 },
136 {
137 .start = INT_USB_HS,
138 .end = INT_USB_HS,
139 .flags = IORESOURCE_IRQ,
140 },
141};
142
143struct platform_device msm_device_gadget_peripheral = {
144 .name = "msm_hsusb",
145 .id = -1,
146 .num_resources = ARRAY_SIZE(resources_gadget_peripheral),
147 .resource = resources_gadget_peripheral,
148 .dev = {
149 .dma_mask = &dma_mask,
150 .coherent_dma_mask = 0xffffffffULL,
151 },
152};
153
154static struct resource resources_hsusb_host[] = {
155 {
156 .start = MSM_HSUSB_PHYS,
157 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
158 .flags = IORESOURCE_MEM,
159 },
160 {
161 .start = INT_USB_HS,
162 .end = INT_USB_HS,
163 .flags = IORESOURCE_IRQ,
164 },
165};
166
167struct platform_device msm_device_hsusb_host = {
168 .name = "msm_hsusb_host",
169 .id = 0,
170 .num_resources = ARRAY_SIZE(resources_hsusb_host),
171 .resource = resources_hsusb_host,
172 .dev = {
173 .dma_mask = &dma_mask,
174 .coherent_dma_mask = 0xffffffffULL,
175 },
176};
177
178static struct platform_device *msm_host_devices[] = {
179 &msm_device_hsusb_host,
180};
181
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700182static struct resource msm_dmov_resource[] = {
183 {
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700184 .start = INT_ADM_AARM,
185 .flags = IORESOURCE_IRQ,
186 },
187 {
188 .start = 0xA9700000,
189 .end = 0xA9700000 + SZ_4K - 1,
190 .flags = IORESOURCE_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700191 },
192};
193
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700194static struct msm_dmov_pdata msm_dmov_pdata = {
195 .sd = 3,
196 .sd_size = 0x400,
197};
198
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700199struct platform_device msm_device_dmov = {
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700200 .name = "msm_dmov",
201 .id = -1,
202 .resource = msm_dmov_resource,
203 .num_resources = ARRAY_SIZE(msm_dmov_resource),
204 .dev = {
205 .platform_data = &msm_dmov_pdata,
206 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700207};
208
209struct platform_device msm_device_smd = {
210 .name = "msm_smd",
211 .id = -1,
212};
213
Angshuman Sarkarfb1cce92012-02-21 15:20:43 +0530214static struct resource smd_8625_resource[] = {
215 {
216 .name = "a9_m2a_0",
217 .start = MSM8625_INT_A9_M2A_0,
218 .flags = IORESOURCE_IRQ,
219 },
220 {
221 .name = "a9_m2a_5",
222 .start = MSM8625_INT_A9_M2A_5,
223 .flags = IORESOURCE_IRQ,
224 },
225};
226
227static struct smd_subsystem_config smd_8625_config_list[] = {
228 {
229 .irq_config_id = SMD_MODEM,
230 .subsys_name = "modem",
231 .edge = SMD_APPS_MODEM,
232
233 .smd_int.irq_name = "a9_m2a_0",
234 .smd_int.flags = IRQF_TRIGGER_RISING,
235 .smd_int.irq_id = -1,
236 .smd_int.device_name = "smd_dev",
237 .smd_int.dev_id = 0,
238
239 .smd_int.out_bit_pos = 1,
240 .smd_int.out_base = (void __iomem *)MSM_CSR_BASE,
241 .smd_int.out_offset = 0x400 + (0) * 4,
242
243 .smsm_int.irq_name = "a9_m2a_5",
244 .smsm_int.flags = IRQF_TRIGGER_RISING,
245 .smsm_int.irq_id = -1,
246 .smsm_int.device_name = "smsm_dev",
247 .smsm_int.dev_id = 0,
248
249 .smsm_int.out_bit_pos = 1,
250 .smsm_int.out_base = (void __iomem *)MSM_CSR_BASE,
251 .smsm_int.out_offset = 0x400 + (5) * 4,
252
253 }
254};
255
256static struct smd_platform smd_8625_platform_data = {
257 .num_ss_configs = ARRAY_SIZE(smd_8625_config_list),
258 .smd_ss_configs = smd_8625_config_list,
259};
260
261struct platform_device msm8625_device_smd = {
262 .name = "msm_smd",
263 .id = -1,
264 .resource = smd_8625_resource,
265 .num_resources = ARRAY_SIZE(smd_8625_resource),
266 .dev = {
267 .platform_data = &smd_8625_platform_data,
268 }
269};
270
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +0530271static struct resource resources_adsp[] = {
272 {
273 .start = INT_ADSP_A9_A11,
274 .end = INT_ADSP_A9_A11,
275 .flags = IORESOURCE_IRQ,
276 },
277};
278
279struct platform_device msm_adsp_device = {
280 .name = "msm_adsp",
281 .id = -1,
282 .num_resources = ARRAY_SIZE(resources_adsp),
283 .resource = resources_adsp,
284};
285
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700286static struct resource resources_uart1[] = {
287 {
288 .start = INT_UART1,
289 .end = INT_UART1,
290 .flags = IORESOURCE_IRQ,
291 },
292 {
Taniya Das13b811a2011-12-09 18:33:45 +0530293 .start = MSM7XXX_UART1_PHYS,
294 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700295 .flags = IORESOURCE_MEM,
296 },
297};
298
299struct platform_device msm_device_uart1 = {
300 .name = "msm_serial",
301 .id = 0,
302 .num_resources = ARRAY_SIZE(resources_uart1),
303 .resource = resources_uart1,
304};
305
306#define MSM_UART1DM_PHYS 0xA0200000
307static struct resource msm_uart1_dm_resources[] = {
308 {
309 .start = MSM_UART1DM_PHYS,
310 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
311 .flags = IORESOURCE_MEM,
312 },
313 {
314 .start = INT_UART1DM_IRQ,
315 .end = INT_UART1DM_IRQ,
316 .flags = IORESOURCE_IRQ,
317 },
318 {
319 .start = INT_UART1DM_RX,
320 .end = INT_UART1DM_RX,
321 .flags = IORESOURCE_IRQ,
322 },
323 {
324 .start = DMOV_HSUART1_TX_CHAN,
325 .end = DMOV_HSUART1_RX_CHAN,
326 .name = "uartdm_channels",
327 .flags = IORESOURCE_DMA,
328 },
329 {
330 .start = DMOV_HSUART1_TX_CRCI,
331 .end = DMOV_HSUART1_RX_CRCI,
332 .name = "uartdm_crci",
333 .flags = IORESOURCE_DMA,
334 },
335};
336
337static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32);
338struct platform_device msm_device_uart_dm1 = {
339 .name = "msm_serial_hs",
340 .id = 0,
341 .num_resources = ARRAY_SIZE(msm_uart1_dm_resources),
342 .resource = msm_uart1_dm_resources,
343 .dev = {
344 .dma_mask = &msm_uart_dm1_dma_mask,
345 .coherent_dma_mask = DMA_BIT_MASK(32),
346 },
347};
348
349#define MSM_UART2DM_PHYS 0xA0300000
350static struct resource msm_uart2dm_resources[] = {
351 {
352 .start = MSM_UART2DM_PHYS,
353 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
354 .name = "uartdm_resource",
355 .flags = IORESOURCE_MEM,
356 },
357 {
358 .start = INT_UART2DM_IRQ,
359 .end = INT_UART2DM_IRQ,
360 .flags = IORESOURCE_IRQ,
361 },
362};
363
364struct platform_device msm_device_uart_dm2 = {
365 .name = "msm_serial_hsl",
366 .id = 0,
367 .num_resources = ARRAY_SIZE(msm_uart2dm_resources),
368 .resource = msm_uart2dm_resources,
369};
370
371#define MSM_NAND_PHYS 0xA0A00000
372#define MSM_NANDC01_PHYS 0xA0A40000
373#define MSM_NANDC10_PHYS 0xA0A80000
374#define MSM_NANDC11_PHYS 0xA0AC0000
375#define EBI2_REG_BASE 0xA0D00000
376static struct resource resources_nand[] = {
377 [0] = {
378 .name = "msm_nand_dmac",
379 .start = DMOV_NAND_CHAN,
380 .end = DMOV_NAND_CHAN,
381 .flags = IORESOURCE_DMA,
382 },
383 [1] = {
384 .name = "msm_nand_phys",
385 .start = MSM_NAND_PHYS,
386 .end = MSM_NAND_PHYS + 0x7FF,
387 .flags = IORESOURCE_MEM,
388 },
389 [2] = {
390 .name = "msm_nandc01_phys",
391 .start = MSM_NANDC01_PHYS,
392 .end = MSM_NANDC01_PHYS + 0x7FF,
393 .flags = IORESOURCE_MEM,
394 },
395 [3] = {
396 .name = "msm_nandc10_phys",
397 .start = MSM_NANDC10_PHYS,
398 .end = MSM_NANDC10_PHYS + 0x7FF,
399 .flags = IORESOURCE_MEM,
400 },
401 [4] = {
402 .name = "msm_nandc11_phys",
403 .start = MSM_NANDC11_PHYS,
404 .end = MSM_NANDC11_PHYS + 0x7FF,
405 .flags = IORESOURCE_MEM,
406 },
407 [5] = {
408 .name = "ebi2_reg_base",
409 .start = EBI2_REG_BASE,
410 .end = EBI2_REG_BASE + 0x60,
411 .flags = IORESOURCE_MEM,
412 },
413};
414
415struct flash_platform_data msm_nand_data;
416
417struct platform_device msm_device_nand = {
418 .name = "msm_nand",
419 .id = -1,
420 .num_resources = ARRAY_SIZE(resources_nand),
421 .resource = resources_nand,
422 .dev = {
423 .platform_data = &msm_nand_data,
424 },
425};
426
427#define MSM_SDC1_BASE 0xA0400000
428#define MSM_SDC2_BASE 0xA0500000
429#define MSM_SDC3_BASE 0xA0600000
430#define MSM_SDC4_BASE 0xA0700000
431static struct resource resources_sdc1[] = {
432 {
433 .start = MSM_SDC1_BASE,
434 .end = MSM_SDC1_BASE + SZ_4K - 1,
435 .flags = IORESOURCE_MEM,
436 },
437 {
438 .start = INT_SDC1_0,
439 .end = INT_SDC1_1,
440 .flags = IORESOURCE_IRQ,
441 },
442 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700443 .name = "sdcc_dma_chnl",
444 .start = DMOV_SDC1_CHAN,
445 .end = DMOV_SDC1_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700446 .flags = IORESOURCE_DMA,
447 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700448 {
449 .name = "sdcc_dma_crci",
450 .start = DMOV_SDC1_CRCI,
451 .end = DMOV_SDC1_CRCI,
452 .flags = IORESOURCE_DMA,
453 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700454};
455
456static struct resource resources_sdc2[] = {
457 {
458 .start = MSM_SDC2_BASE,
459 .end = MSM_SDC2_BASE + SZ_4K - 1,
460 .flags = IORESOURCE_MEM,
461 },
462 {
463 .start = INT_SDC2_0,
464 .end = INT_SDC2_1,
465 .flags = IORESOURCE_IRQ,
466 },
467 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700468 .name = "sdcc_dma_chnl",
469 .start = DMOV_SDC2_CHAN,
470 .end = DMOV_SDC2_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700471 .flags = IORESOURCE_DMA,
472 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700473 {
474 .name = "sdcc_dma_crci",
475 .start = DMOV_SDC2_CRCI,
476 .end = DMOV_SDC2_CRCI,
477 .flags = IORESOURCE_DMA,
478 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700479};
480
481static struct resource resources_sdc3[] = {
482 {
483 .start = MSM_SDC3_BASE,
484 .end = MSM_SDC3_BASE + SZ_4K - 1,
485 .flags = IORESOURCE_MEM,
486 },
487 {
488 .start = INT_SDC3_0,
489 .end = INT_SDC3_1,
490 .flags = IORESOURCE_IRQ,
491 },
492 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700493 .name = "sdcc_dma_chnl",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530494 .start = DMOV_SDC3_CHAN,
495 .end = DMOV_SDC3_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700496 .flags = IORESOURCE_DMA,
497 },
498 {
499 .name = "sdcc_dma_crci",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530500 .start = DMOV_SDC3_CRCI,
501 .end = DMOV_SDC3_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700502 .flags = IORESOURCE_DMA,
503 },
504};
505
506static struct resource resources_sdc4[] = {
507 {
508 .start = MSM_SDC4_BASE,
509 .end = MSM_SDC4_BASE + SZ_4K - 1,
510 .flags = IORESOURCE_MEM,
511 },
512 {
513 .start = INT_SDC4_0,
514 .end = INT_SDC4_1,
515 .flags = IORESOURCE_IRQ,
516 },
517 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700518 .name = "sdcc_dma_chnl",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530519 .start = DMOV_SDC4_CHAN,
520 .end = DMOV_SDC4_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700521 .flags = IORESOURCE_DMA,
522 },
523 {
524 .name = "sdcc_dma_crci",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530525 .start = DMOV_SDC4_CRCI,
526 .end = DMOV_SDC4_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700527 .flags = IORESOURCE_DMA,
528 },
529};
530
531struct platform_device msm_device_sdc1 = {
532 .name = "msm_sdcc",
533 .id = 1,
534 .num_resources = ARRAY_SIZE(resources_sdc1),
535 .resource = resources_sdc1,
536 .dev = {
537 .coherent_dma_mask = 0xffffffff,
538 },
539};
540
541struct platform_device msm_device_sdc2 = {
542 .name = "msm_sdcc",
543 .id = 2,
544 .num_resources = ARRAY_SIZE(resources_sdc2),
545 .resource = resources_sdc2,
546 .dev = {
547 .coherent_dma_mask = 0xffffffff,
548 },
549};
550
551struct platform_device msm_device_sdc3 = {
552 .name = "msm_sdcc",
553 .id = 3,
554 .num_resources = ARRAY_SIZE(resources_sdc3),
555 .resource = resources_sdc3,
556 .dev = {
557 .coherent_dma_mask = 0xffffffff,
558 },
559};
560
561struct platform_device msm_device_sdc4 = {
562 .name = "msm_sdcc",
563 .id = 4,
564 .num_resources = ARRAY_SIZE(resources_sdc4),
565 .resource = resources_sdc4,
566 .dev = {
567 .coherent_dma_mask = 0xffffffff,
568 },
569};
570
571static struct platform_device *msm_sdcc_devices[] __initdata = {
572 &msm_device_sdc1,
573 &msm_device_sdc2,
574 &msm_device_sdc3,
575 &msm_device_sdc4,
576};
577
Suresh Vankadara20cd3be2012-01-18 00:34:06 +0530578#ifdef CONFIG_MSM_CAMERA_V4L2
579static struct resource msm_csic0_resources[] = {
580 {
581 .name = "csic",
582 .start = 0xA0F00000,
583 .end = 0xA0F00000 + 0x00100000 - 1,
584 .flags = IORESOURCE_MEM,
585 },
586 {
587 .name = "csic",
588 .start = INT_CSI_IRQ_0,
589 .end = INT_CSI_IRQ_0,
590 .flags = IORESOURCE_IRQ,
591 },
592};
593
594static struct resource msm_csic1_resources[] = {
595 {
596 .name = "csic",
597 .start = 0xA1000000,
598 .end = 0xA1000000 + 0x00100000 - 1,
599 .flags = IORESOURCE_MEM,
600 },
601 {
602 .name = "csic",
603 .start = INT_CSI_IRQ_1,
604 .end = INT_CSI_IRQ_1,
605 .flags = IORESOURCE_IRQ,
606 },
607};
608
609struct platform_device msm7x27a_device_csic0 = {
610 .name = "msm_csic",
611 .id = 0,
612 .resource = msm_csic0_resources,
613 .num_resources = ARRAY_SIZE(msm_csic0_resources),
614};
615
616struct platform_device msm7x27a_device_csic1 = {
617 .name = "msm_csic",
618 .id = 1,
619 .resource = msm_csic1_resources,
620 .num_resources = ARRAY_SIZE(msm_csic1_resources),
621};
622
623static struct resource msm_clkctl_resources[] = {
624 {
625 .name = "clk_ctl",
Taniya Das13b811a2011-12-09 18:33:45 +0530626 .start = MSM7XXX_CLK_CTL_PHYS,
627 .end = MSM7XXX_CLK_CTL_PHYS + MSM7XXX_CLK_CTL_SIZE - 1,
Suresh Vankadara20cd3be2012-01-18 00:34:06 +0530628 .flags = IORESOURCE_MEM,
629 },
630};
631struct platform_device msm7x27a_device_clkctl = {
632 .name = "msm_clk_ctl",
633 .id = 0,
634 .resource = msm_clkctl_resources,
635 .num_resources = ARRAY_SIZE(msm_clkctl_resources),
636};
637
638struct platform_device msm7x27a_device_vfe = {
639 .name = "msm_vfe",
640 .id = 0,
641};
642
643#endif
644
Murali Nalajala41786ab2012-03-06 10:47:32 +0530645/* Command sequence for simple WFI */
646static uint8_t spm_wfi_cmd_sequence[] __initdata = {
647 0x00, 0x40, 0x40, 0x03,
648 0x00, 0x40, 0x40, 0x0f,
649};
650
651/* Command sequence for GDFS, this won't send any interrupt to the modem */
652static uint8_t spm_pc_without_modem[] __initdata = {
653 0x20, 0x00, 0x30, 0x10,
654 0x40, 0x40, 0x03, 0x10,
655 0x00, 0x30, 0x2E, 0x40,
656 0x40, 0x0f,
657};
658
659static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
660 [0] = {
661 .mode = MSM_SPM_MODE_CLOCK_GATING,
662 .notify_rpm = false,
663 .cmd = spm_wfi_cmd_sequence,
664 },
665 [1] = {
666 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
667 .notify_rpm = false,
668 .cmd = spm_pc_without_modem,
669 },
670};
671
672static struct msm_spm_platform_data msm_spm_data[] __initdata = {
673 [0] = {
674 .reg_base_addr = MSM_SAW0_BASE,
675 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
676 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
677 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
678 .modes = msm_spm_seq_list,
679 },
680 [1] = {
681 .reg_base_addr = MSM_SAW1_BASE,
682 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
683 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
684 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
685 .modes = msm_spm_seq_list,
686 },
687};
688
689void __init msm8x25_spm_device_init(void)
690{
691 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
692}
693
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700694#define MDP_BASE 0xAA200000
695#define MIPI_DSI_HW_BASE 0xA1100000
696
697static struct resource msm_mipi_dsi_resources[] = {
698 {
699 .name = "mipi_dsi",
700 .start = MIPI_DSI_HW_BASE,
701 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
702 .flags = IORESOURCE_MEM,
703 },
704 {
705 .start = INT_DSI_IRQ,
706 .end = INT_DSI_IRQ,
707 .flags = IORESOURCE_IRQ,
708 },
709};
710
711static struct platform_device msm_mipi_dsi_device = {
712 .name = "mipi_dsi",
713 .id = 1,
714 .num_resources = ARRAY_SIZE(msm_mipi_dsi_resources),
715 .resource = msm_mipi_dsi_resources,
716};
717
718static struct resource msm_mdp_resources[] = {
719 {
720 .name = "mdp",
721 .start = MDP_BASE,
722 .end = MDP_BASE + 0x000F1008 - 1,
723 .flags = IORESOURCE_MEM,
724 },
725 {
726 .start = INT_MDP,
727 .end = INT_MDP,
728 .flags = IORESOURCE_IRQ,
729 },
730};
731
732static struct platform_device msm_mdp_device = {
733 .name = "mdp",
734 .id = 0,
735 .num_resources = ARRAY_SIZE(msm_mdp_resources),
736 .resource = msm_mdp_resources,
737};
738
739static struct platform_device msm_lcdc_device = {
740 .name = "lcdc",
741 .id = 0,
742};
743
744static struct resource kgsl_3d0_resources[] = {
745 {
746 .name = KGSL_3D0_REG_MEMORY,
747 .start = 0xA0000000,
748 .end = 0xA001ffff,
749 .flags = IORESOURCE_MEM,
750 },
751 {
752 .name = KGSL_3D0_IRQ,
753 .start = INT_GRAPHICS,
754 .end = INT_GRAPHICS,
755 .flags = IORESOURCE_IRQ,
756 },
757};
758
759static struct kgsl_device_platform_data kgsl_3d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600760 .pwrlevel = {
761 {
762 .gpu_freq = 245760000,
763 .bus_freq = 200000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700764 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600765 {
Lynus Vazeaf0aac2012-01-05 12:28:47 +0530766 .gpu_freq = 192000000,
767 .bus_freq = 160000000,
768 },
769 {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600770 .gpu_freq = 133330000,
771 .bus_freq = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700772 },
773 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600774 .init_level = 0,
Lynus Vazeaf0aac2012-01-05 12:28:47 +0530775 .num_levels = 3,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600776 .set_grp_async = set_grp_xbar_async,
777 .idle_timeout = HZ/5,
778 .nap_allowed = false,
779 .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700780};
781
782struct platform_device msm_kgsl_3d0 = {
783 .name = "kgsl-3d0",
784 .id = 0,
785 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
786 .resource = kgsl_3d0_resources,
787 .dev = {
788 .platform_data = &kgsl_3d0_pdata,
789 },
790};
791
792void __init msm7x25a_kgsl_3d0_init(void)
793{
794 if (cpu_is_msm7x25a() || cpu_is_msm7x25aa()) {
Lynus Vaz971610e2012-01-06 11:00:32 +0530795 kgsl_3d0_pdata.num_levels = 2;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600796 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 133330000;
797 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 160000000;
798 kgsl_3d0_pdata.pwrlevel[1].gpu_freq = 96000000;
799 kgsl_3d0_pdata.pwrlevel[1].bus_freq = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700800 }
801}
802
803static void __init msm_register_device(struct platform_device *pdev, void *data)
804{
805 int ret;
806
807 pdev->dev.platform_data = data;
808
809 ret = platform_device_register(pdev);
810
811 if (ret)
812 dev_err(&pdev->dev,
813 "%s: platform_device_register() failed = %d\n",
814 __func__, ret);
815}
816
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700817
818#define PERPH_WEB_BLOCK_ADDR (0xA9D00040)
819#define PDM0_CTL_OFFSET (0x04)
820#define SIZE_8B (0x08)
821
822static struct resource resources_led[] = {
823 {
824 .start = PERPH_WEB_BLOCK_ADDR,
825 .end = PERPH_WEB_BLOCK_ADDR + (SIZE_8B) - 1,
826 .name = "led-gpio-pdm",
827 .flags = IORESOURCE_MEM,
828 },
829};
830
831static struct led_info msm_kpbl_pdm_led_pdata = {
832 .name = "keyboard-backlight",
833};
834
835struct platform_device led_pdev = {
836 .name = "leds-msm-pdm",
837 /* use pdev id to represent pdm id */
838 .id = 0,
839 .num_resources = ARRAY_SIZE(resources_led),
840 .resource = resources_led,
841 .dev = {
842 .platform_data = &msm_kpbl_pdm_led_pdata,
843 },
844};
845
Manish Dewangan3a260992011-06-24 18:01:34 +0530846struct platform_device asoc_msm_pcm = {
847 .name = "msm-dsp-audio",
848 .id = 0,
849};
850
851struct platform_device asoc_msm_dai0 = {
852 .name = "msm-codec-dai",
853 .id = 0,
854};
855
856struct platform_device asoc_msm_dai1 = {
857 .name = "msm-cpu-dai",
858 .id = 0,
859};
860
Taniya Das2e948192011-12-20 11:15:13 +0530861static struct resource gpio_resources[] = {
862 {
863 .start = INT_GPIO_GROUP1,
864 .flags = IORESOURCE_IRQ,
865 },
866 {
867 .start = INT_GPIO_GROUP2,
868 .flags = IORESOURCE_IRQ,
869 },
870};
871
872static struct platform_device msm_device_gpio = {
873 .name = "msmgpio",
874 .id = -1,
875 .resource = gpio_resources,
876 .num_resources = ARRAY_SIZE(gpio_resources),
877};
878
Taniya Das43bcdd62011-12-02 17:33:27 +0530879struct platform_device *msm_footswitch_devices[] = {
880 FS_PCOM(FS_GFX3D, "fs_gfx3d"),
881};
882unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);
883
884/* MSM8625 Devices */
885
886static struct resource msm8625_resources_uart1[] = {
887 {
888 .start = MSM8625_INT_UART1,
889 .end = MSM8625_INT_UART1,
890 .flags = IORESOURCE_IRQ,
891 },
892 {
Taniya Das13b811a2011-12-09 18:33:45 +0530893 .start = MSM7XXX_UART1_PHYS,
894 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Taniya Das43bcdd62011-12-02 17:33:27 +0530895 .flags = IORESOURCE_MEM,
896 },
897};
898
899struct platform_device msm8625_device_uart1 = {
900 .name = "msm_serial",
901 .id = 0,
902 .num_resources = ARRAY_SIZE(msm8625_resources_uart1),
903 .resource = msm8625_resources_uart1,
904};
905
Trilok Soni269fff42012-02-13 20:35:30 +0530906static struct resource msm8625_uart1_dm_resources[] = {
907 {
908 .start = MSM_UART1DM_PHYS,
909 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
910 .flags = IORESOURCE_MEM,
911 },
912 {
913 .start = MSM8625_INT_UART1DM_IRQ,
914 .end = MSM8625_INT_UART1DM_IRQ,
915 .flags = IORESOURCE_IRQ,
916 },
917 {
918 .start = MSM8625_INT_UART1DM_RX,
919 .end = MSM8625_INT_UART1DM_RX,
920 .flags = IORESOURCE_IRQ,
921 },
922 {
923 .start = DMOV_HSUART1_TX_CHAN,
924 .end = DMOV_HSUART1_RX_CHAN,
925 .name = "uartdm_channels",
926 .flags = IORESOURCE_DMA,
927 },
928 {
929 .start = DMOV_HSUART1_TX_CRCI,
930 .end = DMOV_HSUART1_RX_CRCI,
931 .name = "uartdm_crci",
932 .flags = IORESOURCE_DMA,
933 },
934};
935
936struct platform_device msm8625_device_uart_dm1 = {
937 .name = "msm_serial_hs",
938 .id = 0,
939 .num_resources = ARRAY_SIZE(msm8625_uart1_dm_resources),
940 .resource = msm8625_uart1_dm_resources,
941 .dev = {
942 .dma_mask = &msm_uart_dm1_dma_mask,
943 .coherent_dma_mask = DMA_BIT_MASK(32),
944 },
945};
946
947static struct resource msm8625_uart2dm_resources[] = {
948 {
949 .start = MSM_UART2DM_PHYS,
950 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
951 .name = "uartdm_resource",
952 .flags = IORESOURCE_MEM,
953 },
954 {
955 .start = MSM8625_INT_UART2DM_IRQ,
956 .end = MSM8625_INT_UART2DM_IRQ,
957 .flags = IORESOURCE_IRQ,
958 },
959};
960
961struct platform_device msm8625_device_uart_dm2 = {
962 .name = "msm_serial_hsl",
963 .id = 0,
964 .num_resources = ARRAY_SIZE(msm8625_uart2dm_resources),
965 .resource = msm8625_uart2dm_resources,
966};
967
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +0530968static struct resource msm8625_resources_adsp[] = {
969 {
970 .start = MSM8625_INT_ADSP_A9_A11,
971 .end = MSM8625_INT_ADSP_A9_A11,
972 .flags = IORESOURCE_IRQ,
973 },
974};
975
976struct platform_device msm8625_device_adsp = {
977 .name = "msm_adsp",
978 .id = -1,
979 .num_resources = ARRAY_SIZE(msm8625_resources_adsp),
980 .resource = msm8625_resources_adsp,
981};
982
Taniya Das43bcdd62011-12-02 17:33:27 +0530983static struct resource msm8625_dmov_resource[] = {
984 {
985 .start = MSM8625_INT_ADM_AARM,
986 .flags = IORESOURCE_IRQ,
987 },
988 {
989 .start = 0xA9700000,
990 .end = 0xA9700000 + SZ_4K - 1,
991 .flags = IORESOURCE_MEM,
992 },
993};
994
995struct platform_device msm8625_device_dmov = {
996 .name = "msm_dmov",
997 .id = -1,
998 .resource = msm8625_dmov_resource,
999 .num_resources = ARRAY_SIZE(msm8625_dmov_resource),
1000 .dev = {
1001 .platform_data = &msm_dmov_pdata,
1002 },
1003};
Taniya Das2e948192011-12-20 11:15:13 +05301004
Taniya Das9d187142011-12-02 15:53:25 +05301005static struct resource gsbi0_msm8625_qup_resources[] = {
1006 {
1007 .name = "qup_phys_addr",
1008 .start = MSM_GSBI0_QUP_PHYS,
1009 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
1010 .flags = IORESOURCE_MEM,
1011 },
1012 {
1013 .name = "gsbi_qup_i2c_addr",
1014 .start = MSM_GSBI0_PHYS,
1015 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
1016 .flags = IORESOURCE_MEM,
1017 },
1018 {
1019 .name = "qup_err_intr",
1020 .start = MSM8625_INT_PWB_I2C,
1021 .end = MSM8625_INT_PWB_I2C,
1022 .flags = IORESOURCE_IRQ,
1023 },
1024};
1025
1026/* Use GSBI0 QUP for /dev/i2c-0 */
Taniya Dase3027e22012-02-27 16:32:27 +05301027struct platform_device msm8625_gsbi0_qup_i2c_device = {
Taniya Das9d187142011-12-02 15:53:25 +05301028 .name = "qup_i2c",
1029 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
1030 .num_resources = ARRAY_SIZE(gsbi0_msm8625_qup_resources),
1031 .resource = gsbi0_msm8625_qup_resources,
1032};
1033
Trilok Soni633e59c2012-02-13 20:28:30 +05301034static struct resource gsbi1_msm8625_qup_i2c_resources[] = {
1035 {
1036 .name = "qup_phys_addr",
1037 .start = MSM_GSBI1_QUP_PHYS,
1038 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
1039 .flags = IORESOURCE_MEM,
1040 },
1041 {
1042 .name = "gsbi_qup_i2c_addr",
1043 .start = MSM_GSBI1_PHYS,
1044 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
1045 .flags = IORESOURCE_MEM,
1046 },
1047 {
1048 .name = "qup_err_intr",
1049 .start = MSM8625_INT_ARM11_DMA,
1050 .end = MSM8625_INT_ARM11_DMA,
1051 .flags = IORESOURCE_IRQ,
1052 },
1053};
1054
1055/* Use GSBI1 QUP for /dev/i2c-1 */
Taniya Dase3027e22012-02-27 16:32:27 +05301056struct platform_device msm8625_gsbi1_qup_i2c_device = {
Trilok Soni633e59c2012-02-13 20:28:30 +05301057 .name = "qup_i2c",
1058 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
1059 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
1060 .resource = gsbi1_msm8625_qup_i2c_resources,
1061};
1062
Taniya Das6684d622012-01-12 10:29:09 +05301063static struct resource msm8625_gpio_resources[] = {
1064 {
1065 .start = MSM8625_INT_GPIO_GROUP1,
1066 .flags = IORESOURCE_IRQ,
1067 },
1068 {
1069 .start = MSM8625_INT_GPIO_GROUP2,
1070 .flags = IORESOURCE_IRQ,
1071 },
1072};
1073
1074static struct platform_device msm8625_device_gpio = {
1075 .name = "msmgpio",
1076 .id = -1,
1077 .resource = msm8625_gpio_resources,
1078 .num_resources = ARRAY_SIZE(msm8625_gpio_resources),
1079};
1080
Trilok Soniee75f6c2012-02-13 20:45:07 +05301081static struct resource msm8625_resources_sdc1[] = {
1082 {
1083 .start = MSM_SDC1_BASE,
1084 .end = MSM_SDC1_BASE + SZ_4K - 1,
1085 .flags = IORESOURCE_MEM,
1086 },
1087 {
1088 .start = MSM8625_INT_SDC1_0,
1089 .end = MSM8625_INT_SDC1_1,
1090 .flags = IORESOURCE_IRQ,
1091 },
1092 {
1093 .name = "sdcc_dma_chnl",
1094 .start = DMOV_SDC1_CHAN,
1095 .end = DMOV_SDC1_CHAN,
1096 .flags = IORESOURCE_DMA,
1097 },
1098 {
1099 .name = "sdcc_dma_crci",
1100 .start = DMOV_SDC1_CRCI,
1101 .end = DMOV_SDC1_CRCI,
1102 .flags = IORESOURCE_DMA,
1103 }
1104};
1105
1106static struct resource msm8625_resources_sdc2[] = {
1107 {
1108 .start = MSM_SDC2_BASE,
1109 .end = MSM_SDC2_BASE + SZ_4K - 1,
1110 .flags = IORESOURCE_MEM,
1111 },
1112 {
1113 .start = MSM8625_INT_SDC2_0,
1114 .end = MSM8625_INT_SDC2_1,
1115 .flags = IORESOURCE_IRQ,
1116 },
1117 {
1118 .name = "sdcc_dma_chnl",
1119 .start = DMOV_SDC2_CHAN,
1120 .end = DMOV_SDC2_CHAN,
1121 .flags = IORESOURCE_DMA,
1122 },
1123 {
1124 .name = "sdcc_dma_crci",
1125 .start = DMOV_SDC2_CRCI,
1126 .end = DMOV_SDC2_CRCI,
1127 .flags = IORESOURCE_DMA,
1128 }
1129};
1130
1131static struct resource msm8625_resources_sdc3[] = {
1132 {
1133 .start = MSM_SDC3_BASE,
1134 .end = MSM_SDC3_BASE + SZ_4K - 1,
1135 .flags = IORESOURCE_MEM,
1136 },
1137 {
1138 .start = MSM8625_INT_SDC3_0,
1139 .end = MSM8625_INT_SDC3_1,
1140 .flags = IORESOURCE_IRQ,
1141 },
1142 {
1143 .name = "sdcc_dma_chnl",
1144 .start = DMOV_SDC3_CHAN,
1145 .end = DMOV_SDC3_CHAN,
1146 .flags = IORESOURCE_DMA,
1147 },
1148 {
1149 .name = "sdcc_dma_crci",
1150 .start = DMOV_SDC3_CRCI,
1151 .end = DMOV_SDC3_CRCI,
1152 .flags = IORESOURCE_DMA,
1153 },
1154};
1155
1156static struct resource msm8625_resources_sdc4[] = {
1157 {
1158 .start = MSM_SDC4_BASE,
1159 .end = MSM_SDC4_BASE + SZ_4K - 1,
1160 .flags = IORESOURCE_MEM,
1161 },
1162 {
1163 .start = MSM8625_INT_SDC4_0,
1164 .end = MSM8625_INT_SDC4_1,
1165 .flags = IORESOURCE_IRQ,
1166 },
1167 {
1168 .name = "sdcc_dma_chnl",
1169 .start = DMOV_SDC4_CHAN,
1170 .end = DMOV_SDC4_CHAN,
1171 .flags = IORESOURCE_DMA,
1172 },
1173 {
1174 .name = "sdcc_dma_crci",
1175 .start = DMOV_SDC4_CRCI,
1176 .end = DMOV_SDC4_CRCI,
1177 .flags = IORESOURCE_DMA,
1178 },
1179};
1180
1181struct platform_device msm8625_device_sdc1 = {
1182 .name = "msm_sdcc",
1183 .id = 1,
1184 .num_resources = ARRAY_SIZE(msm8625_resources_sdc1),
1185 .resource = msm8625_resources_sdc1,
1186 .dev = {
1187 .coherent_dma_mask = 0xffffffff,
1188 },
1189};
1190
1191struct platform_device msm8625_device_sdc2 = {
1192 .name = "msm_sdcc",
1193 .id = 2,
1194 .num_resources = ARRAY_SIZE(msm8625_resources_sdc2),
1195 .resource = msm8625_resources_sdc2,
1196 .dev = {
1197 .coherent_dma_mask = 0xffffffff,
1198 },
1199};
1200
1201struct platform_device msm8625_device_sdc3 = {
1202 .name = "msm_sdcc",
1203 .id = 3,
1204 .num_resources = ARRAY_SIZE(msm8625_resources_sdc3),
1205 .resource = msm8625_resources_sdc3,
1206 .dev = {
1207 .coherent_dma_mask = 0xffffffff,
1208 },
1209};
1210
1211struct platform_device msm8625_device_sdc4 = {
1212 .name = "msm_sdcc",
1213 .id = 4,
1214 .num_resources = ARRAY_SIZE(msm8625_resources_sdc4),
1215 .resource = msm8625_resources_sdc4,
1216 .dev = {
1217 .coherent_dma_mask = 0xffffffff,
1218 },
1219};
1220
1221static struct platform_device *msm8625_sdcc_devices[] __initdata = {
1222 &msm8625_device_sdc1,
1223 &msm8625_device_sdc2,
1224 &msm8625_device_sdc3,
1225 &msm8625_device_sdc4,
1226};
1227
1228int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
1229{
1230 struct platform_device *pdev;
1231
1232 if (controller < 1 || controller > 4)
1233 return -EINVAL;
1234
1235 if (cpu_is_msm8625())
1236 pdev = msm8625_sdcc_devices[controller-1];
1237 else
1238 pdev = msm_sdcc_devices[controller-1];
1239
1240 pdev->dev.platform_data = plat;
1241 return platform_device_register(pdev);
1242}
1243
Trilok Sonida63a8b2012-02-13 20:50:03 +05301244static struct resource msm8625_resources_hsusb_otg[] = {
1245 {
1246 .start = MSM_HSUSB_PHYS,
1247 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1248 .flags = IORESOURCE_MEM,
1249 },
1250 {
1251 .start = MSM8625_INT_USB_HS,
1252 .end = MSM8625_INT_USB_HS,
1253 .flags = IORESOURCE_IRQ,
1254 },
1255};
1256
1257struct platform_device msm8625_device_otg = {
1258 .name = "msm_otg",
1259 .id = -1,
1260 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_otg),
1261 .resource = msm8625_resources_hsusb_otg,
1262 .dev = {
1263 .dma_mask = &dma_mask,
1264 .coherent_dma_mask = 0xffffffffULL,
1265 },
1266};
1267
1268static struct resource msm8625_resources_gadget_peripheral[] = {
1269 {
1270 .start = MSM_HSUSB_PHYS,
1271 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1272 .flags = IORESOURCE_MEM,
1273 },
1274 {
1275 .start = MSM8625_INT_USB_HS,
1276 .end = MSM8625_INT_USB_HS,
1277 .flags = IORESOURCE_IRQ,
1278 },
1279};
1280
1281struct platform_device msm8625_device_gadget_peripheral = {
1282 .name = "msm_hsusb",
1283 .id = -1,
1284 .num_resources = ARRAY_SIZE(msm8625_resources_gadget_peripheral),
1285 .resource = msm8625_resources_gadget_peripheral,
1286 .dev = {
1287 .dma_mask = &dma_mask,
1288 .coherent_dma_mask = 0xffffffffULL,
1289 },
1290};
1291
1292static struct resource msm8625_resources_hsusb_host[] = {
1293 {
1294 .start = MSM_HSUSB_PHYS,
1295 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1296 .flags = IORESOURCE_MEM,
1297 },
1298 {
1299 .start = MSM8625_INT_USB_HS,
1300 .end = MSM8625_INT_USB_HS,
1301 .flags = IORESOURCE_IRQ,
1302 },
1303};
1304
1305struct platform_device msm8625_device_hsusb_host = {
1306 .name = "msm_hsusb_host",
1307 .id = 0,
1308 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_host),
1309 .resource = msm8625_resources_hsusb_host,
1310 .dev = {
1311 .dma_mask = &dma_mask,
1312 .coherent_dma_mask = 0xffffffffULL,
1313 },
1314};
1315
1316static struct platform_device *msm8625_host_devices[] = {
1317 &msm8625_device_hsusb_host,
1318};
1319
1320int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
1321{
1322 struct platform_device *pdev;
1323
1324 if (cpu_is_msm8625())
1325 pdev = msm8625_host_devices[host];
1326 else
1327 pdev = msm_host_devices[host];
1328 if (!pdev)
1329 return -ENODEV;
1330 pdev->dev.platform_data = plat;
1331 return platform_device_register(pdev);
1332}
1333
Trilok Soni88da2552012-02-13 21:01:24 +05301334#ifdef CONFIG_MSM_CAMERA_V4L2
1335static struct resource msm8625_csic0_resources[] = {
1336 {
1337 .name = "csic",
1338 .start = 0xA0F00000,
1339 .end = 0xA0F00000 + 0x00100000 - 1,
1340 .flags = IORESOURCE_MEM,
1341 },
1342 {
1343 .name = "csic",
1344 .start = MSM8625_INT_CSI_IRQ_0,
1345 .end = MSM8625_INT_CSI_IRQ_0,
1346 .flags = IORESOURCE_IRQ,
1347 },
1348};
1349
1350static struct resource msm8625_csic1_resources[] = {
1351 {
1352 .name = "csic",
1353 .start = 0xA1000000,
1354 .end = 0xA1000000 + 0x00100000 - 1,
1355 .flags = IORESOURCE_MEM,
1356 },
1357 {
1358 .name = "csic",
1359 .start = MSM8625_INT_CSI_IRQ_1,
1360 .end = MSM8625_INT_CSI_IRQ_1,
1361 .flags = IORESOURCE_IRQ,
1362 },
1363};
1364
1365struct platform_device msm8625_device_csic0 = {
1366 .name = "msm_csic",
1367 .id = 0,
1368 .resource = msm8625_csic0_resources,
1369 .num_resources = ARRAY_SIZE(msm8625_csic0_resources),
1370};
1371
1372struct platform_device msm8625_device_csic1 = {
1373 .name = "msm_csic",
1374 .id = 1,
1375 .resource = msm8625_csic1_resources,
1376 .num_resources = ARRAY_SIZE(msm8625_csic1_resources),
1377};
1378#endif
1379
Trilok Soniae4633d2012-02-13 21:08:32 +05301380static struct resource msm8625_mipi_dsi_resources[] = {
1381 {
1382 .name = "mipi_dsi",
1383 .start = MIPI_DSI_HW_BASE,
1384 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
1385 .flags = IORESOURCE_MEM,
1386 },
1387 {
1388 .start = MSM8625_INT_DSI_IRQ,
1389 .end = MSM8625_INT_DSI_IRQ,
1390 .flags = IORESOURCE_IRQ,
1391 },
1392};
1393
1394static struct platform_device msm8625_mipi_dsi_device = {
1395 .name = "mipi_dsi",
1396 .id = 1,
1397 .num_resources = ARRAY_SIZE(msm8625_mipi_dsi_resources),
1398 .resource = msm8625_mipi_dsi_resources,
1399};
1400
1401static struct resource msm8625_mdp_resources[] = {
1402 {
1403 .name = "mdp",
1404 .start = MDP_BASE,
1405 .end = MDP_BASE + 0x000F1008 - 1,
1406 .flags = IORESOURCE_MEM,
1407 },
1408 {
1409 .start = MSM8625_INT_MDP,
1410 .end = MSM8625_INT_MDP,
1411 .flags = IORESOURCE_IRQ,
1412 },
1413};
1414
1415static struct platform_device msm8625_mdp_device = {
1416 .name = "mdp",
1417 .id = 0,
1418 .num_resources = ARRAY_SIZE(msm8625_mdp_resources),
1419 .resource = msm8625_mdp_resources,
1420};
1421
1422void __init msm_fb_register_device(char *name, void *data)
1423{
1424 if (!strncmp(name, "mdp", 3)) {
1425 if (cpu_is_msm8625())
1426 msm_register_device(&msm8625_mdp_device, data);
1427 else
1428 msm_register_device(&msm_mdp_device, data);
1429 } else if (!strncmp(name, "mipi_dsi", 8)) {
1430 if (cpu_is_msm8625())
1431 msm_register_device(&msm8625_mipi_dsi_device, data);
1432 else
1433 msm_register_device(&msm_mipi_dsi_device, data);
1434 } else if (!strncmp(name, "lcdc", 4)) {
1435 msm_register_device(&msm_lcdc_device, data);
1436 } else {
1437 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
1438 }
1439}
1440
Trilok Soni664b95d2012-02-13 21:13:15 +05301441static struct resource msm8625_kgsl_3d0_resources[] = {
1442 {
1443 .name = KGSL_3D0_REG_MEMORY,
1444 .start = 0xA0000000,
1445 .end = 0xA001ffff,
1446 .flags = IORESOURCE_MEM,
1447 },
1448 {
1449 .name = KGSL_3D0_IRQ,
1450 .start = MSM8625_INT_GRAPHICS,
1451 .end = MSM8625_INT_GRAPHICS,
1452 .flags = IORESOURCE_IRQ,
1453 },
1454};
1455
1456struct platform_device msm8625_kgsl_3d0 = {
1457 .name = "kgsl-3d0",
1458 .id = 0,
1459 .num_resources = ARRAY_SIZE(msm8625_kgsl_3d0_resources),
1460 .resource = msm8625_kgsl_3d0_resources,
1461 .dev = {
1462 .platform_data = &kgsl_3d0_pdata,
1463 },
1464};
1465
Taniya Das7c9f0512011-12-02 14:26:46 +05301466static struct clk_lookup msm_clock_8625_dummy[] = {
1467 CLK_DUMMY("core_clk", adm_clk.c, "msm_dmov", 0),
1468 CLK_DUMMY("adsp_clk", adsp_clk.c, NULL, 0),
1469 CLK_DUMMY("ahb_m_clk", ahb_m_clk.c, NULL, 0),
1470 CLK_DUMMY("ahb_s_clk", ahb_s_clk.c, NULL, 0),
1471 CLK_DUMMY("cam_m_clk", cam_m_clk.c, NULL, 0),
1472 CLK_DUMMY("csi_clk", csi1_clk.c, NULL, 0),
1473 CLK_DUMMY("csi_pclk", csi1_p_clk.c, NULL, 0),
1474 CLK_DUMMY("csi_vfe_clk", csi1_vfe_clk.c, NULL, 0),
1475 CLK_DUMMY("dsi_byte_clk", dsi_byte_clk.c, NULL, 0),
1476 CLK_DUMMY("dsi_clk", dsi_clk.c, NULL, 0),
1477 CLK_DUMMY("dsi_esc_clk", dsi_esc_clk.c, NULL, 0),
1478 CLK_DUMMY("dsi_pixel_clk", dsi_pixel_clk.c, NULL, 0),
1479 CLK_DUMMY("dsi_ref_clk", dsi_ref_clk.c, NULL, 0),
1480 CLK_DUMMY("ebi1_clk", ebi1_clk.c, NULL, 0),
1481 CLK_DUMMY("ebi2_clk", ebi2_clk.c, NULL, 0),
1482 CLK_DUMMY("ecodec_clk", ecodec_clk.c, NULL, 0),
1483 CLK_DUMMY("gp_clk", gp_clk.c, NULL, 0),
1484 CLK_DUMMY("core_clk", gsbi1_qup_clk.c, "qup_i2c.0", 0),
1485 CLK_DUMMY("core_clk", gsbi2_qup_clk.c, "qup_i2c.1", 0),
1486 CLK_DUMMY("iface_clk", gsbi1_qup_p_clk.c, "qup_i2c.0", 0),
1487 CLK_DUMMY("iface_clk", gsbi2_qup_p_clk.c, "qup_i2c.1", 0),
1488 CLK_DUMMY("icodec_rx_clk", icodec_rx_clk.c, NULL, 0),
1489 CLK_DUMMY("icodec_tx_clk", icodec_tx_clk.c, NULL, 0),
1490 CLK_DUMMY("mem_clk", imem_clk.c, NULL, 0),
1491 CLK_DUMMY("mddi_clk", pmdh_clk.c, NULL, 0),
1492 CLK_DUMMY("mdp_clk", mdp_clk.c, NULL, 0),
1493 CLK_DUMMY("mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk.c, NULL, 0),
1494 CLK_DUMMY("mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk.c, NULL, 0),
1495 CLK_DUMMY("mdp_vsync_clk", mdp_vsync_clk.c, NULL, 0),
1496 CLK_DUMMY("mdp_dsi_pclk", mdp_dsi_p_clk.c, NULL, 0),
1497 CLK_DUMMY("pbus_clk", pbus_clk.c, NULL, 0),
1498 CLK_DUMMY("pcm_clk", pcm_clk.c, NULL, 0),
1499 CLK_DUMMY("sdac_clk", sdac_clk.c, NULL, 0),
1500 CLK_DUMMY("core_clk", sdc1_clk.c, "msm_sdcc.1", 0),
1501 CLK_DUMMY("iface_clk", sdc1_p_clk.c, "msm_sdcc.1", 0),
1502 CLK_DUMMY("core_clk", sdc2_clk.c, "msm_sdcc.2", 0),
1503 CLK_DUMMY("iface_clk", sdc2_p_clk.c, "msm_sdcc.2", 0),
1504 CLK_DUMMY("core_clk", sdc3_clk.c, "msm_sdcc.3", 0),
1505 CLK_DUMMY("iface_clk", sdc3_p_clk.c, "msm_sdcc.3", 0),
1506 CLK_DUMMY("core_clk", sdc4_clk.c, "msm_sdcc.4", 0),
1507 CLK_DUMMY("iface_clk", sdc4_p_clk.c, "msm_sdcc.4", 0),
1508 CLK_DUMMY("ref_clk", tsif_ref_clk.c, "msm_tsif.0", 0),
1509 CLK_DUMMY("iface_clk", tsif_p_clk.c, "msm_tsif.0", 0),
1510 CLK_DUMMY("core_clk", uart1_clk.c, "msm_serial.0", 0),
1511 CLK_DUMMY("core_clk", uart2_clk.c, "msm_serial.1", 0),
1512 CLK_DUMMY("core_clk", uart1dm_clk.c, "msm_serial_hs.0", 0),
1513 CLK_DUMMY("core_clk", uart2dm_clk.c, "msm_serial_hsl.0", 0),
1514 CLK_DUMMY("usb_hs_core_clk", usb_hs_core_clk.c, NULL, 0),
1515 CLK_DUMMY("usb_hs2_clk", usb_hs2_clk.c, NULL, 0),
1516 CLK_DUMMY("usb_hs_clk", usb_hs_clk.c, NULL, 0),
1517 CLK_DUMMY("usb_hs_pclk", usb_hs_p_clk.c, NULL, 0),
1518 CLK_DUMMY("usb_phy_clk", usb_phy_clk.c, NULL, 0),
1519 CLK_DUMMY("vdc_clk", vdc_clk.c, NULL, 0),
1520 CLK_DUMMY("ebi1_acpu_clk", ebi_acpu_clk.c, NULL, 0),
1521 CLK_DUMMY("ebi1_lcdc_clk", ebi_lcdc_clk.c, NULL, 0),
1522 CLK_DUMMY("ebi1_mddi_clk", ebi_mddi_clk.c, NULL, 0),
1523 CLK_DUMMY("ebi1_usb_clk", ebi_usb_clk.c, NULL, 0),
1524 CLK_DUMMY("ebi1_vfe_clk", ebi_vfe_clk.c, NULL, 0),
1525 CLK_DUMMY("mem_clk", ebi_adm_clk.c, "msm_dmov", 0),
1526};
1527
1528struct clock_init_data msm8625_dummy_clock_init_data __initdata = {
1529 .table = msm_clock_8625_dummy,
1530 .size = ARRAY_SIZE(msm_clock_8625_dummy),
1531};
1532
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001533int __init msm7x2x_misc_init(void)
1534{
Taniya Das7c9f0512011-12-02 14:26:46 +05301535 if (machine_is_msm8625_rumi3()) {
1536 msm_clock_init(&msm8625_dummy_clock_init_data);
Taniya Das43bcdd62011-12-02 17:33:27 +05301537 return 0;
Taniya Das7c9f0512011-12-02 14:26:46 +05301538 }
Taniya Das43bcdd62011-12-02 17:33:27 +05301539
Stephen Boydbb600ae2011-08-02 20:11:40 -07001540 msm_clock_init(&msm7x27a_clock_init_data);
Taniya Dase3027e22012-02-27 16:32:27 +05301541 if (cpu_is_msm7x27aa() || cpu_is_msm8625())
Matt Wagantallec57f062011-08-16 23:54:46 -07001542 acpuclk_init(&acpuclk_7x27aa_soc_data);
1543 else
1544 acpuclk_init(&acpuclk_7x27a_soc_data);
1545
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001546
1547 return 0;
1548}
1549
1550#ifdef CONFIG_CACHE_L2X0
1551static int __init msm7x27x_cache_init(void)
1552{
1553 int aux_ctrl = 0;
1554
1555 /* Way Size 010(0x2) 32KB */
1556 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
1557 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
1558 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
1559
Taniya Das379b5682011-12-02 14:53:46 +05301560 if (cpu_is_msm8625()) {
1561 /* Way Size 011(0x3) 64KB */
1562 aux_ctrl |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
1563 (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | \
1564 (0x1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT);
1565 }
1566
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001567 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
1568
1569 return 0;
1570}
1571#else
pankaj kumar80d7cb62011-08-23 13:37:55 +05301572static int __init msm7x27x_cache_init(void){ return 0; }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001573#endif
1574
1575void __init msm_common_io_init(void)
1576{
1577 msm_map_common_io();
Taniya Das43bcdd62011-12-02 17:33:27 +05301578 if (socinfo_init() < 0)
1579 pr_err("%s: socinfo_init() failed!\n", __func__);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001580 msm7x27x_cache_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301581}
1582
1583void __init msm8625_init_irq(void)
1584{
1585 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1586 (void *)MSM_QGIC_CPU_BASE);
Taniya Das43bcdd62011-12-02 17:33:27 +05301587}
1588
1589void __init msm8625_map_io(void)
1590{
1591 msm_map_msm8625_io();
1592
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001593 if (socinfo_init() < 0)
1594 pr_err("%s: socinfo_init() failed!\n", __func__);
Taniya Das379b5682011-12-02 14:53:46 +05301595 msm7x27x_cache_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001596}
1597
Taniya Das43bcdd62011-12-02 17:33:27 +05301598static int msm7627a_init_gpio(void)
1599{
Taniya Das6684d622012-01-12 10:29:09 +05301600 if (cpu_is_msm8625())
1601 platform_device_register(&msm8625_device_gpio);
1602 else
1603 platform_device_register(&msm_device_gpio);
Taniya Das43bcdd62011-12-02 17:33:27 +05301604 return 0;
1605}
1606postcore_initcall(msm7627a_init_gpio);
1607