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