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