blob: f7e67cbdc30e7a1c23c47a1ac71deb53b87a4531 [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;
Rajesh Kemisettidf6e62f2012-03-12 14:02:30 +0530802 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700803}
804
805static void __init msm_register_device(struct platform_device *pdev, void *data)
806{
807 int ret;
808
809 pdev->dev.platform_data = data;
810
811 ret = platform_device_register(pdev);
812
813 if (ret)
814 dev_err(&pdev->dev,
815 "%s: platform_device_register() failed = %d\n",
816 __func__, ret);
817}
818
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700819
820#define PERPH_WEB_BLOCK_ADDR (0xA9D00040)
821#define PDM0_CTL_OFFSET (0x04)
822#define SIZE_8B (0x08)
823
824static struct resource resources_led[] = {
825 {
826 .start = PERPH_WEB_BLOCK_ADDR,
827 .end = PERPH_WEB_BLOCK_ADDR + (SIZE_8B) - 1,
828 .name = "led-gpio-pdm",
829 .flags = IORESOURCE_MEM,
830 },
831};
832
833static struct led_info msm_kpbl_pdm_led_pdata = {
834 .name = "keyboard-backlight",
835};
836
837struct platform_device led_pdev = {
838 .name = "leds-msm-pdm",
839 /* use pdev id to represent pdm id */
840 .id = 0,
841 .num_resources = ARRAY_SIZE(resources_led),
842 .resource = resources_led,
843 .dev = {
844 .platform_data = &msm_kpbl_pdm_led_pdata,
845 },
846};
847
Manish Dewangan3a260992011-06-24 18:01:34 +0530848struct platform_device asoc_msm_pcm = {
849 .name = "msm-dsp-audio",
850 .id = 0,
851};
852
853struct platform_device asoc_msm_dai0 = {
854 .name = "msm-codec-dai",
855 .id = 0,
856};
857
858struct platform_device asoc_msm_dai1 = {
859 .name = "msm-cpu-dai",
860 .id = 0,
861};
862
Taniya Das2e948192011-12-20 11:15:13 +0530863static struct resource gpio_resources[] = {
864 {
865 .start = INT_GPIO_GROUP1,
866 .flags = IORESOURCE_IRQ,
867 },
868 {
869 .start = INT_GPIO_GROUP2,
870 .flags = IORESOURCE_IRQ,
871 },
872};
873
874static struct platform_device msm_device_gpio = {
875 .name = "msmgpio",
876 .id = -1,
877 .resource = gpio_resources,
878 .num_resources = ARRAY_SIZE(gpio_resources),
879};
880
Taniya Das43bcdd62011-12-02 17:33:27 +0530881struct platform_device *msm_footswitch_devices[] = {
882 FS_PCOM(FS_GFX3D, "fs_gfx3d"),
883};
884unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);
885
886/* MSM8625 Devices */
887
888static struct resource msm8625_resources_uart1[] = {
889 {
890 .start = MSM8625_INT_UART1,
891 .end = MSM8625_INT_UART1,
892 .flags = IORESOURCE_IRQ,
893 },
894 {
Taniya Das13b811a2011-12-09 18:33:45 +0530895 .start = MSM7XXX_UART1_PHYS,
896 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Taniya Das43bcdd62011-12-02 17:33:27 +0530897 .flags = IORESOURCE_MEM,
898 },
899};
900
901struct platform_device msm8625_device_uart1 = {
902 .name = "msm_serial",
903 .id = 0,
904 .num_resources = ARRAY_SIZE(msm8625_resources_uart1),
905 .resource = msm8625_resources_uart1,
906};
907
Trilok Soni269fff42012-02-13 20:35:30 +0530908static struct resource msm8625_uart1_dm_resources[] = {
909 {
910 .start = MSM_UART1DM_PHYS,
911 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
912 .flags = IORESOURCE_MEM,
913 },
914 {
915 .start = MSM8625_INT_UART1DM_IRQ,
916 .end = MSM8625_INT_UART1DM_IRQ,
917 .flags = IORESOURCE_IRQ,
918 },
919 {
920 .start = MSM8625_INT_UART1DM_RX,
921 .end = MSM8625_INT_UART1DM_RX,
922 .flags = IORESOURCE_IRQ,
923 },
924 {
925 .start = DMOV_HSUART1_TX_CHAN,
926 .end = DMOV_HSUART1_RX_CHAN,
927 .name = "uartdm_channels",
928 .flags = IORESOURCE_DMA,
929 },
930 {
931 .start = DMOV_HSUART1_TX_CRCI,
932 .end = DMOV_HSUART1_RX_CRCI,
933 .name = "uartdm_crci",
934 .flags = IORESOURCE_DMA,
935 },
936};
937
938struct platform_device msm8625_device_uart_dm1 = {
939 .name = "msm_serial_hs",
940 .id = 0,
941 .num_resources = ARRAY_SIZE(msm8625_uart1_dm_resources),
942 .resource = msm8625_uart1_dm_resources,
943 .dev = {
944 .dma_mask = &msm_uart_dm1_dma_mask,
945 .coherent_dma_mask = DMA_BIT_MASK(32),
946 },
947};
948
949static struct resource msm8625_uart2dm_resources[] = {
950 {
951 .start = MSM_UART2DM_PHYS,
952 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
953 .name = "uartdm_resource",
954 .flags = IORESOURCE_MEM,
955 },
956 {
957 .start = MSM8625_INT_UART2DM_IRQ,
958 .end = MSM8625_INT_UART2DM_IRQ,
959 .flags = IORESOURCE_IRQ,
960 },
961};
962
963struct platform_device msm8625_device_uart_dm2 = {
964 .name = "msm_serial_hsl",
965 .id = 0,
966 .num_resources = ARRAY_SIZE(msm8625_uart2dm_resources),
967 .resource = msm8625_uart2dm_resources,
968};
969
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +0530970static struct resource msm8625_resources_adsp[] = {
971 {
972 .start = MSM8625_INT_ADSP_A9_A11,
973 .end = MSM8625_INT_ADSP_A9_A11,
974 .flags = IORESOURCE_IRQ,
975 },
976};
977
978struct platform_device msm8625_device_adsp = {
979 .name = "msm_adsp",
980 .id = -1,
981 .num_resources = ARRAY_SIZE(msm8625_resources_adsp),
982 .resource = msm8625_resources_adsp,
983};
984
Taniya Das43bcdd62011-12-02 17:33:27 +0530985static struct resource msm8625_dmov_resource[] = {
986 {
987 .start = MSM8625_INT_ADM_AARM,
988 .flags = IORESOURCE_IRQ,
989 },
990 {
991 .start = 0xA9700000,
992 .end = 0xA9700000 + SZ_4K - 1,
993 .flags = IORESOURCE_MEM,
994 },
995};
996
997struct platform_device msm8625_device_dmov = {
998 .name = "msm_dmov",
999 .id = -1,
1000 .resource = msm8625_dmov_resource,
1001 .num_resources = ARRAY_SIZE(msm8625_dmov_resource),
1002 .dev = {
1003 .platform_data = &msm_dmov_pdata,
1004 },
1005};
Taniya Das2e948192011-12-20 11:15:13 +05301006
Taniya Das9d187142011-12-02 15:53:25 +05301007static struct resource gsbi0_msm8625_qup_resources[] = {
1008 {
1009 .name = "qup_phys_addr",
1010 .start = MSM_GSBI0_QUP_PHYS,
1011 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
1012 .flags = IORESOURCE_MEM,
1013 },
1014 {
1015 .name = "gsbi_qup_i2c_addr",
1016 .start = MSM_GSBI0_PHYS,
1017 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
1018 .flags = IORESOURCE_MEM,
1019 },
1020 {
1021 .name = "qup_err_intr",
1022 .start = MSM8625_INT_PWB_I2C,
1023 .end = MSM8625_INT_PWB_I2C,
1024 .flags = IORESOURCE_IRQ,
1025 },
1026};
1027
1028/* Use GSBI0 QUP for /dev/i2c-0 */
Taniya Dase3027e22012-02-27 16:32:27 +05301029struct platform_device msm8625_gsbi0_qup_i2c_device = {
Taniya Das9d187142011-12-02 15:53:25 +05301030 .name = "qup_i2c",
1031 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
1032 .num_resources = ARRAY_SIZE(gsbi0_msm8625_qup_resources),
1033 .resource = gsbi0_msm8625_qup_resources,
1034};
1035
Trilok Soni633e59c2012-02-13 20:28:30 +05301036static struct resource gsbi1_msm8625_qup_i2c_resources[] = {
1037 {
1038 .name = "qup_phys_addr",
1039 .start = MSM_GSBI1_QUP_PHYS,
1040 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
1041 .flags = IORESOURCE_MEM,
1042 },
1043 {
1044 .name = "gsbi_qup_i2c_addr",
1045 .start = MSM_GSBI1_PHYS,
1046 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
1047 .flags = IORESOURCE_MEM,
1048 },
1049 {
1050 .name = "qup_err_intr",
1051 .start = MSM8625_INT_ARM11_DMA,
1052 .end = MSM8625_INT_ARM11_DMA,
1053 .flags = IORESOURCE_IRQ,
1054 },
1055};
1056
1057/* Use GSBI1 QUP for /dev/i2c-1 */
Taniya Dase3027e22012-02-27 16:32:27 +05301058struct platform_device msm8625_gsbi1_qup_i2c_device = {
Trilok Soni633e59c2012-02-13 20:28:30 +05301059 .name = "qup_i2c",
1060 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
1061 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
1062 .resource = gsbi1_msm8625_qup_i2c_resources,
1063};
1064
Taniya Das6684d622012-01-12 10:29:09 +05301065static struct resource msm8625_gpio_resources[] = {
1066 {
1067 .start = MSM8625_INT_GPIO_GROUP1,
1068 .flags = IORESOURCE_IRQ,
1069 },
1070 {
1071 .start = MSM8625_INT_GPIO_GROUP2,
1072 .flags = IORESOURCE_IRQ,
1073 },
1074};
1075
1076static struct platform_device msm8625_device_gpio = {
1077 .name = "msmgpio",
1078 .id = -1,
1079 .resource = msm8625_gpio_resources,
1080 .num_resources = ARRAY_SIZE(msm8625_gpio_resources),
1081};
1082
Trilok Soniee75f6c2012-02-13 20:45:07 +05301083static struct resource msm8625_resources_sdc1[] = {
1084 {
1085 .start = MSM_SDC1_BASE,
1086 .end = MSM_SDC1_BASE + SZ_4K - 1,
1087 .flags = IORESOURCE_MEM,
1088 },
1089 {
1090 .start = MSM8625_INT_SDC1_0,
1091 .end = MSM8625_INT_SDC1_1,
1092 .flags = IORESOURCE_IRQ,
1093 },
1094 {
1095 .name = "sdcc_dma_chnl",
1096 .start = DMOV_SDC1_CHAN,
1097 .end = DMOV_SDC1_CHAN,
1098 .flags = IORESOURCE_DMA,
1099 },
1100 {
1101 .name = "sdcc_dma_crci",
1102 .start = DMOV_SDC1_CRCI,
1103 .end = DMOV_SDC1_CRCI,
1104 .flags = IORESOURCE_DMA,
1105 }
1106};
1107
1108static struct resource msm8625_resources_sdc2[] = {
1109 {
1110 .start = MSM_SDC2_BASE,
1111 .end = MSM_SDC2_BASE + SZ_4K - 1,
1112 .flags = IORESOURCE_MEM,
1113 },
1114 {
1115 .start = MSM8625_INT_SDC2_0,
1116 .end = MSM8625_INT_SDC2_1,
1117 .flags = IORESOURCE_IRQ,
1118 },
1119 {
1120 .name = "sdcc_dma_chnl",
1121 .start = DMOV_SDC2_CHAN,
1122 .end = DMOV_SDC2_CHAN,
1123 .flags = IORESOURCE_DMA,
1124 },
1125 {
1126 .name = "sdcc_dma_crci",
1127 .start = DMOV_SDC2_CRCI,
1128 .end = DMOV_SDC2_CRCI,
1129 .flags = IORESOURCE_DMA,
1130 }
1131};
1132
1133static struct resource msm8625_resources_sdc3[] = {
1134 {
1135 .start = MSM_SDC3_BASE,
1136 .end = MSM_SDC3_BASE + SZ_4K - 1,
1137 .flags = IORESOURCE_MEM,
1138 },
1139 {
1140 .start = MSM8625_INT_SDC3_0,
1141 .end = MSM8625_INT_SDC3_1,
1142 .flags = IORESOURCE_IRQ,
1143 },
1144 {
1145 .name = "sdcc_dma_chnl",
1146 .start = DMOV_SDC3_CHAN,
1147 .end = DMOV_SDC3_CHAN,
1148 .flags = IORESOURCE_DMA,
1149 },
1150 {
1151 .name = "sdcc_dma_crci",
1152 .start = DMOV_SDC3_CRCI,
1153 .end = DMOV_SDC3_CRCI,
1154 .flags = IORESOURCE_DMA,
1155 },
1156};
1157
1158static struct resource msm8625_resources_sdc4[] = {
1159 {
1160 .start = MSM_SDC4_BASE,
1161 .end = MSM_SDC4_BASE + SZ_4K - 1,
1162 .flags = IORESOURCE_MEM,
1163 },
1164 {
1165 .start = MSM8625_INT_SDC4_0,
1166 .end = MSM8625_INT_SDC4_1,
1167 .flags = IORESOURCE_IRQ,
1168 },
1169 {
1170 .name = "sdcc_dma_chnl",
1171 .start = DMOV_SDC4_CHAN,
1172 .end = DMOV_SDC4_CHAN,
1173 .flags = IORESOURCE_DMA,
1174 },
1175 {
1176 .name = "sdcc_dma_crci",
1177 .start = DMOV_SDC4_CRCI,
1178 .end = DMOV_SDC4_CRCI,
1179 .flags = IORESOURCE_DMA,
1180 },
1181};
1182
1183struct platform_device msm8625_device_sdc1 = {
1184 .name = "msm_sdcc",
1185 .id = 1,
1186 .num_resources = ARRAY_SIZE(msm8625_resources_sdc1),
1187 .resource = msm8625_resources_sdc1,
1188 .dev = {
1189 .coherent_dma_mask = 0xffffffff,
1190 },
1191};
1192
1193struct platform_device msm8625_device_sdc2 = {
1194 .name = "msm_sdcc",
1195 .id = 2,
1196 .num_resources = ARRAY_SIZE(msm8625_resources_sdc2),
1197 .resource = msm8625_resources_sdc2,
1198 .dev = {
1199 .coherent_dma_mask = 0xffffffff,
1200 },
1201};
1202
1203struct platform_device msm8625_device_sdc3 = {
1204 .name = "msm_sdcc",
1205 .id = 3,
1206 .num_resources = ARRAY_SIZE(msm8625_resources_sdc3),
1207 .resource = msm8625_resources_sdc3,
1208 .dev = {
1209 .coherent_dma_mask = 0xffffffff,
1210 },
1211};
1212
1213struct platform_device msm8625_device_sdc4 = {
1214 .name = "msm_sdcc",
1215 .id = 4,
1216 .num_resources = ARRAY_SIZE(msm8625_resources_sdc4),
1217 .resource = msm8625_resources_sdc4,
1218 .dev = {
1219 .coherent_dma_mask = 0xffffffff,
1220 },
1221};
1222
1223static struct platform_device *msm8625_sdcc_devices[] __initdata = {
1224 &msm8625_device_sdc1,
1225 &msm8625_device_sdc2,
1226 &msm8625_device_sdc3,
1227 &msm8625_device_sdc4,
1228};
1229
1230int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
1231{
1232 struct platform_device *pdev;
1233
1234 if (controller < 1 || controller > 4)
1235 return -EINVAL;
1236
1237 if (cpu_is_msm8625())
1238 pdev = msm8625_sdcc_devices[controller-1];
1239 else
1240 pdev = msm_sdcc_devices[controller-1];
1241
1242 pdev->dev.platform_data = plat;
1243 return platform_device_register(pdev);
1244}
1245
Trilok Sonida63a8b2012-02-13 20:50:03 +05301246static struct resource msm8625_resources_hsusb_otg[] = {
1247 {
1248 .start = MSM_HSUSB_PHYS,
1249 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1250 .flags = IORESOURCE_MEM,
1251 },
1252 {
1253 .start = MSM8625_INT_USB_HS,
1254 .end = MSM8625_INT_USB_HS,
1255 .flags = IORESOURCE_IRQ,
1256 },
1257};
1258
1259struct platform_device msm8625_device_otg = {
1260 .name = "msm_otg",
1261 .id = -1,
1262 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_otg),
1263 .resource = msm8625_resources_hsusb_otg,
1264 .dev = {
1265 .dma_mask = &dma_mask,
1266 .coherent_dma_mask = 0xffffffffULL,
1267 },
1268};
1269
1270static struct resource msm8625_resources_gadget_peripheral[] = {
1271 {
1272 .start = MSM_HSUSB_PHYS,
1273 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1274 .flags = IORESOURCE_MEM,
1275 },
1276 {
1277 .start = MSM8625_INT_USB_HS,
1278 .end = MSM8625_INT_USB_HS,
1279 .flags = IORESOURCE_IRQ,
1280 },
1281};
1282
1283struct platform_device msm8625_device_gadget_peripheral = {
1284 .name = "msm_hsusb",
1285 .id = -1,
1286 .num_resources = ARRAY_SIZE(msm8625_resources_gadget_peripheral),
1287 .resource = msm8625_resources_gadget_peripheral,
1288 .dev = {
1289 .dma_mask = &dma_mask,
1290 .coherent_dma_mask = 0xffffffffULL,
1291 },
1292};
1293
1294static struct resource msm8625_resources_hsusb_host[] = {
1295 {
1296 .start = MSM_HSUSB_PHYS,
1297 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1298 .flags = IORESOURCE_MEM,
1299 },
1300 {
1301 .start = MSM8625_INT_USB_HS,
1302 .end = MSM8625_INT_USB_HS,
1303 .flags = IORESOURCE_IRQ,
1304 },
1305};
1306
1307struct platform_device msm8625_device_hsusb_host = {
1308 .name = "msm_hsusb_host",
1309 .id = 0,
1310 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_host),
1311 .resource = msm8625_resources_hsusb_host,
1312 .dev = {
1313 .dma_mask = &dma_mask,
1314 .coherent_dma_mask = 0xffffffffULL,
1315 },
1316};
1317
1318static struct platform_device *msm8625_host_devices[] = {
1319 &msm8625_device_hsusb_host,
1320};
1321
1322int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
1323{
1324 struct platform_device *pdev;
1325
1326 if (cpu_is_msm8625())
1327 pdev = msm8625_host_devices[host];
1328 else
1329 pdev = msm_host_devices[host];
1330 if (!pdev)
1331 return -ENODEV;
1332 pdev->dev.platform_data = plat;
1333 return platform_device_register(pdev);
1334}
1335
Trilok Soni88da2552012-02-13 21:01:24 +05301336#ifdef CONFIG_MSM_CAMERA_V4L2
1337static struct resource msm8625_csic0_resources[] = {
1338 {
1339 .name = "csic",
1340 .start = 0xA0F00000,
1341 .end = 0xA0F00000 + 0x00100000 - 1,
1342 .flags = IORESOURCE_MEM,
1343 },
1344 {
1345 .name = "csic",
1346 .start = MSM8625_INT_CSI_IRQ_0,
1347 .end = MSM8625_INT_CSI_IRQ_0,
1348 .flags = IORESOURCE_IRQ,
1349 },
1350};
1351
1352static struct resource msm8625_csic1_resources[] = {
1353 {
1354 .name = "csic",
1355 .start = 0xA1000000,
1356 .end = 0xA1000000 + 0x00100000 - 1,
1357 .flags = IORESOURCE_MEM,
1358 },
1359 {
1360 .name = "csic",
1361 .start = MSM8625_INT_CSI_IRQ_1,
1362 .end = MSM8625_INT_CSI_IRQ_1,
1363 .flags = IORESOURCE_IRQ,
1364 },
1365};
1366
1367struct platform_device msm8625_device_csic0 = {
1368 .name = "msm_csic",
1369 .id = 0,
1370 .resource = msm8625_csic0_resources,
1371 .num_resources = ARRAY_SIZE(msm8625_csic0_resources),
1372};
1373
1374struct platform_device msm8625_device_csic1 = {
1375 .name = "msm_csic",
1376 .id = 1,
1377 .resource = msm8625_csic1_resources,
1378 .num_resources = ARRAY_SIZE(msm8625_csic1_resources),
1379};
1380#endif
1381
Trilok Soniae4633d2012-02-13 21:08:32 +05301382static struct resource msm8625_mipi_dsi_resources[] = {
1383 {
1384 .name = "mipi_dsi",
1385 .start = MIPI_DSI_HW_BASE,
1386 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
1387 .flags = IORESOURCE_MEM,
1388 },
1389 {
1390 .start = MSM8625_INT_DSI_IRQ,
1391 .end = MSM8625_INT_DSI_IRQ,
1392 .flags = IORESOURCE_IRQ,
1393 },
1394};
1395
1396static struct platform_device msm8625_mipi_dsi_device = {
1397 .name = "mipi_dsi",
1398 .id = 1,
1399 .num_resources = ARRAY_SIZE(msm8625_mipi_dsi_resources),
1400 .resource = msm8625_mipi_dsi_resources,
1401};
1402
1403static struct resource msm8625_mdp_resources[] = {
1404 {
1405 .name = "mdp",
1406 .start = MDP_BASE,
1407 .end = MDP_BASE + 0x000F1008 - 1,
1408 .flags = IORESOURCE_MEM,
1409 },
1410 {
1411 .start = MSM8625_INT_MDP,
1412 .end = MSM8625_INT_MDP,
1413 .flags = IORESOURCE_IRQ,
1414 },
1415};
1416
1417static struct platform_device msm8625_mdp_device = {
1418 .name = "mdp",
1419 .id = 0,
1420 .num_resources = ARRAY_SIZE(msm8625_mdp_resources),
1421 .resource = msm8625_mdp_resources,
1422};
1423
1424void __init msm_fb_register_device(char *name, void *data)
1425{
1426 if (!strncmp(name, "mdp", 3)) {
1427 if (cpu_is_msm8625())
1428 msm_register_device(&msm8625_mdp_device, data);
1429 else
1430 msm_register_device(&msm_mdp_device, data);
1431 } else if (!strncmp(name, "mipi_dsi", 8)) {
1432 if (cpu_is_msm8625())
1433 msm_register_device(&msm8625_mipi_dsi_device, data);
1434 else
1435 msm_register_device(&msm_mipi_dsi_device, data);
1436 } else if (!strncmp(name, "lcdc", 4)) {
1437 msm_register_device(&msm_lcdc_device, data);
1438 } else {
1439 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
1440 }
1441}
1442
Trilok Soni664b95d2012-02-13 21:13:15 +05301443static struct resource msm8625_kgsl_3d0_resources[] = {
1444 {
1445 .name = KGSL_3D0_REG_MEMORY,
1446 .start = 0xA0000000,
1447 .end = 0xA001ffff,
1448 .flags = IORESOURCE_MEM,
1449 },
1450 {
1451 .name = KGSL_3D0_IRQ,
1452 .start = MSM8625_INT_GRAPHICS,
1453 .end = MSM8625_INT_GRAPHICS,
1454 .flags = IORESOURCE_IRQ,
1455 },
1456};
1457
1458struct platform_device msm8625_kgsl_3d0 = {
1459 .name = "kgsl-3d0",
1460 .id = 0,
1461 .num_resources = ARRAY_SIZE(msm8625_kgsl_3d0_resources),
1462 .resource = msm8625_kgsl_3d0_resources,
1463 .dev = {
1464 .platform_data = &kgsl_3d0_pdata,
1465 },
1466};
1467
Taniya Das7c9f0512011-12-02 14:26:46 +05301468static struct clk_lookup msm_clock_8625_dummy[] = {
1469 CLK_DUMMY("core_clk", adm_clk.c, "msm_dmov", 0),
1470 CLK_DUMMY("adsp_clk", adsp_clk.c, NULL, 0),
1471 CLK_DUMMY("ahb_m_clk", ahb_m_clk.c, NULL, 0),
1472 CLK_DUMMY("ahb_s_clk", ahb_s_clk.c, NULL, 0),
1473 CLK_DUMMY("cam_m_clk", cam_m_clk.c, NULL, 0),
1474 CLK_DUMMY("csi_clk", csi1_clk.c, NULL, 0),
1475 CLK_DUMMY("csi_pclk", csi1_p_clk.c, NULL, 0),
1476 CLK_DUMMY("csi_vfe_clk", csi1_vfe_clk.c, NULL, 0),
1477 CLK_DUMMY("dsi_byte_clk", dsi_byte_clk.c, NULL, 0),
1478 CLK_DUMMY("dsi_clk", dsi_clk.c, NULL, 0),
1479 CLK_DUMMY("dsi_esc_clk", dsi_esc_clk.c, NULL, 0),
1480 CLK_DUMMY("dsi_pixel_clk", dsi_pixel_clk.c, NULL, 0),
1481 CLK_DUMMY("dsi_ref_clk", dsi_ref_clk.c, NULL, 0),
1482 CLK_DUMMY("ebi1_clk", ebi1_clk.c, NULL, 0),
1483 CLK_DUMMY("ebi2_clk", ebi2_clk.c, NULL, 0),
1484 CLK_DUMMY("ecodec_clk", ecodec_clk.c, NULL, 0),
1485 CLK_DUMMY("gp_clk", gp_clk.c, NULL, 0),
1486 CLK_DUMMY("core_clk", gsbi1_qup_clk.c, "qup_i2c.0", 0),
1487 CLK_DUMMY("core_clk", gsbi2_qup_clk.c, "qup_i2c.1", 0),
1488 CLK_DUMMY("iface_clk", gsbi1_qup_p_clk.c, "qup_i2c.0", 0),
1489 CLK_DUMMY("iface_clk", gsbi2_qup_p_clk.c, "qup_i2c.1", 0),
1490 CLK_DUMMY("icodec_rx_clk", icodec_rx_clk.c, NULL, 0),
1491 CLK_DUMMY("icodec_tx_clk", icodec_tx_clk.c, NULL, 0),
1492 CLK_DUMMY("mem_clk", imem_clk.c, NULL, 0),
1493 CLK_DUMMY("mddi_clk", pmdh_clk.c, NULL, 0),
1494 CLK_DUMMY("mdp_clk", mdp_clk.c, NULL, 0),
1495 CLK_DUMMY("mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk.c, NULL, 0),
1496 CLK_DUMMY("mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk.c, NULL, 0),
1497 CLK_DUMMY("mdp_vsync_clk", mdp_vsync_clk.c, NULL, 0),
1498 CLK_DUMMY("mdp_dsi_pclk", mdp_dsi_p_clk.c, NULL, 0),
1499 CLK_DUMMY("pbus_clk", pbus_clk.c, NULL, 0),
1500 CLK_DUMMY("pcm_clk", pcm_clk.c, NULL, 0),
1501 CLK_DUMMY("sdac_clk", sdac_clk.c, NULL, 0),
1502 CLK_DUMMY("core_clk", sdc1_clk.c, "msm_sdcc.1", 0),
1503 CLK_DUMMY("iface_clk", sdc1_p_clk.c, "msm_sdcc.1", 0),
1504 CLK_DUMMY("core_clk", sdc2_clk.c, "msm_sdcc.2", 0),
1505 CLK_DUMMY("iface_clk", sdc2_p_clk.c, "msm_sdcc.2", 0),
1506 CLK_DUMMY("core_clk", sdc3_clk.c, "msm_sdcc.3", 0),
1507 CLK_DUMMY("iface_clk", sdc3_p_clk.c, "msm_sdcc.3", 0),
1508 CLK_DUMMY("core_clk", sdc4_clk.c, "msm_sdcc.4", 0),
1509 CLK_DUMMY("iface_clk", sdc4_p_clk.c, "msm_sdcc.4", 0),
1510 CLK_DUMMY("ref_clk", tsif_ref_clk.c, "msm_tsif.0", 0),
1511 CLK_DUMMY("iface_clk", tsif_p_clk.c, "msm_tsif.0", 0),
1512 CLK_DUMMY("core_clk", uart1_clk.c, "msm_serial.0", 0),
1513 CLK_DUMMY("core_clk", uart2_clk.c, "msm_serial.1", 0),
1514 CLK_DUMMY("core_clk", uart1dm_clk.c, "msm_serial_hs.0", 0),
1515 CLK_DUMMY("core_clk", uart2dm_clk.c, "msm_serial_hsl.0", 0),
1516 CLK_DUMMY("usb_hs_core_clk", usb_hs_core_clk.c, NULL, 0),
1517 CLK_DUMMY("usb_hs2_clk", usb_hs2_clk.c, NULL, 0),
1518 CLK_DUMMY("usb_hs_clk", usb_hs_clk.c, NULL, 0),
1519 CLK_DUMMY("usb_hs_pclk", usb_hs_p_clk.c, NULL, 0),
1520 CLK_DUMMY("usb_phy_clk", usb_phy_clk.c, NULL, 0),
1521 CLK_DUMMY("vdc_clk", vdc_clk.c, NULL, 0),
1522 CLK_DUMMY("ebi1_acpu_clk", ebi_acpu_clk.c, NULL, 0),
1523 CLK_DUMMY("ebi1_lcdc_clk", ebi_lcdc_clk.c, NULL, 0),
1524 CLK_DUMMY("ebi1_mddi_clk", ebi_mddi_clk.c, NULL, 0),
1525 CLK_DUMMY("ebi1_usb_clk", ebi_usb_clk.c, NULL, 0),
1526 CLK_DUMMY("ebi1_vfe_clk", ebi_vfe_clk.c, NULL, 0),
1527 CLK_DUMMY("mem_clk", ebi_adm_clk.c, "msm_dmov", 0),
1528};
1529
1530struct clock_init_data msm8625_dummy_clock_init_data __initdata = {
1531 .table = msm_clock_8625_dummy,
1532 .size = ARRAY_SIZE(msm_clock_8625_dummy),
1533};
1534
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301535enum {
1536 MSM8625,
1537 MSM8625A,
1538};
1539
1540static int __init msm8625_cpu_id(void)
1541{
1542 int raw_id, cpu;
1543
1544 raw_id = socinfo_get_raw_id();
1545 switch (raw_id) {
1546 /* Part number for 1GHz part */
1547 case 0x770:
1548 case 0x771:
1549 case 0x780:
1550 cpu = MSM8625;
1551 break;
1552 /* Part number for 1.2GHz part */
1553 case 0x773:
1554 case 0x774:
1555 case 0x781:
1556 cpu = MSM8625A;
1557 break;
1558 default:
1559 pr_err("Invalid Raw ID\n");
1560 return -ENODEV;
1561 }
1562 return cpu;
1563}
1564
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001565int __init msm7x2x_misc_init(void)
1566{
Taniya Das7c9f0512011-12-02 14:26:46 +05301567 if (machine_is_msm8625_rumi3()) {
1568 msm_clock_init(&msm8625_dummy_clock_init_data);
Taniya Das43bcdd62011-12-02 17:33:27 +05301569 return 0;
Taniya Das7c9f0512011-12-02 14:26:46 +05301570 }
Taniya Das43bcdd62011-12-02 17:33:27 +05301571
Stephen Boydbb600ae2011-08-02 20:11:40 -07001572 msm_clock_init(&msm7x27a_clock_init_data);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301573 if (cpu_is_msm7x27aa())
Matt Wagantallec57f062011-08-16 23:54:46 -07001574 acpuclk_init(&acpuclk_7x27aa_soc_data);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301575 else if (cpu_is_msm8625()) {
1576 if (msm8625_cpu_id() == MSM8625)
1577 acpuclk_init(&acpuclk_7x27aa_soc_data);
1578 else if (msm8625_cpu_id() == MSM8625A)
1579 acpuclk_init(&acpuclk_8625_soc_data);
1580 } else {
Matt Wagantallec57f062011-08-16 23:54:46 -07001581 acpuclk_init(&acpuclk_7x27a_soc_data);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301582 }
Matt Wagantallec57f062011-08-16 23:54:46 -07001583
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001584
1585 return 0;
1586}
1587
1588#ifdef CONFIG_CACHE_L2X0
1589static int __init msm7x27x_cache_init(void)
1590{
1591 int aux_ctrl = 0;
1592
1593 /* Way Size 010(0x2) 32KB */
1594 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
1595 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
1596 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
1597
Taniya Das379b5682011-12-02 14:53:46 +05301598 if (cpu_is_msm8625()) {
1599 /* Way Size 011(0x3) 64KB */
1600 aux_ctrl |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
1601 (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | \
1602 (0x1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT);
1603 }
1604
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001605 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
1606
1607 return 0;
1608}
1609#else
pankaj kumar80d7cb62011-08-23 13:37:55 +05301610static int __init msm7x27x_cache_init(void){ return 0; }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001611#endif
1612
1613void __init msm_common_io_init(void)
1614{
1615 msm_map_common_io();
Taniya Das43bcdd62011-12-02 17:33:27 +05301616 if (socinfo_init() < 0)
1617 pr_err("%s: socinfo_init() failed!\n", __func__);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001618 msm7x27x_cache_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301619}
1620
1621void __init msm8625_init_irq(void)
1622{
Taniya Dasfcb35002012-03-09 15:28:12 +05301623 msm_gic_irq_extn_init(MSM_QGIC_DIST_BASE, MSM_QGIC_CPU_BASE);
Taniya Das43bcdd62011-12-02 17:33:27 +05301624 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1625 (void *)MSM_QGIC_CPU_BASE);
Taniya Das43bcdd62011-12-02 17:33:27 +05301626}
1627
Taniya Das0c29cae2012-03-08 15:17:37 +05301628static phys_addr_t msm8625_phys_base;
1629
1630static void __init msm_reserve_sdram_memblock(void)
1631{
1632 phys_addr_t paddr;
1633
1634 paddr = memblock_alloc(SZ_8, SZ_64K);
1635 pr_debug("%s physical address = %x\n", __func__, paddr);
1636
1637 if (!paddr) {
1638 pr_err("%s: failed to reserve SZ_8 bytes\n", __func__);
1639 return;
1640 }
1641
1642 msm8625_phys_base = paddr;
1643}
1644
1645phys_addr_t msm8625_get_phys_base(void)
1646{
1647 return msm8625_phys_base;
1648}
1649EXPORT_SYMBOL(msm8625_get_phys_base);
1650
Taniya Das43bcdd62011-12-02 17:33:27 +05301651void __init msm8625_map_io(void)
1652{
Taniya Das0c29cae2012-03-08 15:17:37 +05301653 msm_reserve_sdram_memblock();
Taniya Das43bcdd62011-12-02 17:33:27 +05301654 msm_map_msm8625_io();
1655
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001656 if (socinfo_init() < 0)
1657 pr_err("%s: socinfo_init() failed!\n", __func__);
Taniya Das379b5682011-12-02 14:53:46 +05301658 msm7x27x_cache_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001659}
1660
Taniya Das43bcdd62011-12-02 17:33:27 +05301661static int msm7627a_init_gpio(void)
1662{
Taniya Das6684d622012-01-12 10:29:09 +05301663 if (cpu_is_msm8625())
1664 platform_device_register(&msm8625_device_gpio);
1665 else
1666 platform_device_register(&msm_device_gpio);
Taniya Das43bcdd62011-12-02 17:33:27 +05301667 return 0;
1668}
1669postcore_initcall(msm7627a_init_gpio);
1670