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