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