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