blob: 72b1535ffb4d4345b43f38b1759674c18a18938c [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>
Jordan Crouse914de9b2012-07-09 13:49:46 -060016#include <mach/kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/regulator/machine.h>
Taniya Das2e948192011-12-20 11:15:13 +053018#include <linux/init.h>
Taniya Das43bcdd62011-12-02 17:33:27 +053019#include <linux/irq.h>
Taniya Das9d0c3c52012-05-04 14:40:55 +053020#include <linux/notifier.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070021#include <mach/irqs.h>
22#include <mach/msm_iomap.h>
23#include <mach/board.h>
24#include <mach/dma.h>
25#include <mach/dal_axi.h>
26#include <asm/mach/flash.h>
Taniya Das43bcdd62011-12-02 17:33:27 +053027#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070028#include <asm/hardware/cache-l2x0.h>
29#include <asm/mach/mmc.h>
Taniya Das9d0c3c52012-05-04 14:40:55 +053030#include <asm/cacheflush.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070031#include <mach/rpc_hsusb.h>
32#include <mach/socinfo.h>
33
34#include "devices.h"
35#include "devices-msm7x2xa.h"
36#include "footswitch.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070037#include "acpuclock.h"
Murali Nalajala41786ab2012-03-06 10:47:32 +053038#include "spm.h"
Taniya Dasfcb35002012-03-09 15:28:12 +053039#include "mpm-8625.h"
Murali Nalajala2a0bbda2012-03-28 12:12:54 +053040#include "irq.h"
41#include "pm.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042
43/* Address of GSBI blocks */
44#define MSM_GSBI0_PHYS 0xA1200000
45#define MSM_GSBI1_PHYS 0xA1300000
46
47/* GSBI QUPe devices */
48#define MSM_GSBI0_QUP_PHYS (MSM_GSBI0_PHYS + 0x80000)
49#define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000)
50
51static struct resource gsbi0_qup_i2c_resources[] = {
52 {
53 .name = "qup_phys_addr",
54 .start = MSM_GSBI0_QUP_PHYS,
55 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
56 .flags = IORESOURCE_MEM,
57 },
58 {
59 .name = "gsbi_qup_i2c_addr",
60 .start = MSM_GSBI0_PHYS,
61 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
62 .flags = IORESOURCE_MEM,
63 },
64 {
65 .name = "qup_err_intr",
66 .start = INT_PWB_I2C,
67 .end = INT_PWB_I2C,
68 .flags = IORESOURCE_IRQ,
69 },
70};
71
72/* Use GSBI0 QUP for /dev/i2c-0 */
73struct platform_device msm_gsbi0_qup_i2c_device = {
74 .name = "qup_i2c",
75 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
76 .num_resources = ARRAY_SIZE(gsbi0_qup_i2c_resources),
77 .resource = gsbi0_qup_i2c_resources,
78};
79
80static struct resource gsbi1_qup_i2c_resources[] = {
81 {
82 .name = "qup_phys_addr",
83 .start = MSM_GSBI1_QUP_PHYS,
84 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
85 .flags = IORESOURCE_MEM,
86 },
87 {
88 .name = "gsbi_qup_i2c_addr",
89 .start = MSM_GSBI1_PHYS,
90 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
91 .flags = IORESOURCE_MEM,
92 },
93 {
94 .name = "qup_err_intr",
95 .start = INT_ARM11_DMA,
96 .end = INT_ARM11_DMA,
97 .flags = IORESOURCE_IRQ,
98 },
99};
100
101/* Use GSBI1 QUP for /dev/i2c-1 */
102struct platform_device msm_gsbi1_qup_i2c_device = {
103 .name = "qup_i2c",
104 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
105 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
106 .resource = gsbi1_qup_i2c_resources,
107};
108
109#define MSM_HSUSB_PHYS 0xA0800000
110static struct resource resources_hsusb_otg[] = {
111 {
112 .start = MSM_HSUSB_PHYS,
113 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
114 .flags = IORESOURCE_MEM,
115 },
116 {
117 .start = INT_USB_HS,
118 .end = INT_USB_HS,
119 .flags = IORESOURCE_IRQ,
120 },
121};
122
123static u64 dma_mask = 0xffffffffULL;
124struct platform_device msm_device_otg = {
125 .name = "msm_otg",
126 .id = -1,
127 .num_resources = ARRAY_SIZE(resources_hsusb_otg),
128 .resource = resources_hsusb_otg,
129 .dev = {
130 .dma_mask = &dma_mask,
131 .coherent_dma_mask = 0xffffffffULL,
132 },
133};
134
135static struct resource resources_gadget_peripheral[] = {
136 {
137 .start = MSM_HSUSB_PHYS,
138 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
139 .flags = IORESOURCE_MEM,
140 },
141 {
142 .start = INT_USB_HS,
143 .end = INT_USB_HS,
144 .flags = IORESOURCE_IRQ,
145 },
146};
147
148struct platform_device msm_device_gadget_peripheral = {
149 .name = "msm_hsusb",
150 .id = -1,
151 .num_resources = ARRAY_SIZE(resources_gadget_peripheral),
152 .resource = resources_gadget_peripheral,
153 .dev = {
154 .dma_mask = &dma_mask,
155 .coherent_dma_mask = 0xffffffffULL,
156 },
157};
158
159static struct resource resources_hsusb_host[] = {
160 {
161 .start = MSM_HSUSB_PHYS,
162 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
163 .flags = IORESOURCE_MEM,
164 },
165 {
166 .start = INT_USB_HS,
167 .end = INT_USB_HS,
168 .flags = IORESOURCE_IRQ,
169 },
170};
171
172struct platform_device msm_device_hsusb_host = {
173 .name = "msm_hsusb_host",
174 .id = 0,
175 .num_resources = ARRAY_SIZE(resources_hsusb_host),
176 .resource = resources_hsusb_host,
177 .dev = {
178 .dma_mask = &dma_mask,
179 .coherent_dma_mask = 0xffffffffULL,
180 },
181};
182
183static struct platform_device *msm_host_devices[] = {
184 &msm_device_hsusb_host,
185};
186
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700187static struct resource msm_dmov_resource[] = {
188 {
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700189 .start = INT_ADM_AARM,
190 .flags = IORESOURCE_IRQ,
191 },
192 {
193 .start = 0xA9700000,
194 .end = 0xA9700000 + SZ_4K - 1,
195 .flags = IORESOURCE_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700196 },
197};
198
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700199static struct msm_dmov_pdata msm_dmov_pdata = {
200 .sd = 3,
201 .sd_size = 0x400,
202};
203
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700204struct platform_device msm_device_dmov = {
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700205 .name = "msm_dmov",
206 .id = -1,
207 .resource = msm_dmov_resource,
208 .num_resources = ARRAY_SIZE(msm_dmov_resource),
209 .dev = {
210 .platform_data = &msm_dmov_pdata,
211 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700212};
213
Matt Wagantallbf430eb2012-03-22 11:45:49 -0700214static struct acpuclk_pdata msm7x27a_acpuclk_pdata = {
215 .max_speed_delta_khz = 400000,
216};
217
218struct platform_device msm7x27a_device_acpuclk = {
219 .name = "acpuclk-7627",
220 .id = -1,
221 .dev.platform_data = &msm7x27a_acpuclk_pdata,
222};
223
224static struct acpuclk_pdata msm7x27aa_acpuclk_pdata = {
225 .max_speed_delta_khz = 504000,
226};
227
228struct platform_device msm7x27aa_device_acpuclk = {
229 .name = "acpuclk-7627",
230 .id = -1,
231 .dev.platform_data = &msm7x27aa_acpuclk_pdata,
232};
233
234static struct acpuclk_pdata msm8625_acpuclk_pdata = {
235 /* TODO: Need to update speed delta from H/w Team */
236 .max_speed_delta_khz = 604800,
237};
238
Kaushal Kumar86473f02012-06-28 19:35:58 +0530239static struct acpuclk_pdata msm8625ab_acpuclk_pdata = {
240 .max_speed_delta_khz = 801600,
241};
242
Matt Wagantallbf430eb2012-03-22 11:45:49 -0700243struct platform_device msm8625_device_acpuclk = {
244 .name = "acpuclk-7627",
245 .id = -1,
246 .dev.platform_data = &msm8625_acpuclk_pdata,
247};
248
Kaushal Kumar86473f02012-06-28 19:35:58 +0530249struct platform_device msm8625ab_device_acpuclk = {
250 .name = "acpuclk-7627",
251 .id = -1,
252 .dev.platform_data = &msm8625ab_acpuclk_pdata,
253};
254
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700255struct platform_device msm_device_smd = {
256 .name = "msm_smd",
257 .id = -1,
258};
259
Angshuman Sarkarfb1cce92012-02-21 15:20:43 +0530260static struct resource smd_8625_resource[] = {
261 {
262 .name = "a9_m2a_0",
263 .start = MSM8625_INT_A9_M2A_0,
264 .flags = IORESOURCE_IRQ,
265 },
266 {
267 .name = "a9_m2a_5",
268 .start = MSM8625_INT_A9_M2A_5,
269 .flags = IORESOURCE_IRQ,
270 },
271};
272
273static struct smd_subsystem_config smd_8625_config_list[] = {
274 {
275 .irq_config_id = SMD_MODEM,
276 .subsys_name = "modem",
277 .edge = SMD_APPS_MODEM,
278
279 .smd_int.irq_name = "a9_m2a_0",
280 .smd_int.flags = IRQF_TRIGGER_RISING,
281 .smd_int.irq_id = -1,
282 .smd_int.device_name = "smd_dev",
283 .smd_int.dev_id = 0,
284
285 .smd_int.out_bit_pos = 1,
286 .smd_int.out_base = (void __iomem *)MSM_CSR_BASE,
287 .smd_int.out_offset = 0x400 + (0) * 4,
288
289 .smsm_int.irq_name = "a9_m2a_5",
290 .smsm_int.flags = IRQF_TRIGGER_RISING,
291 .smsm_int.irq_id = -1,
292 .smsm_int.device_name = "smsm_dev",
293 .smsm_int.dev_id = 0,
294
295 .smsm_int.out_bit_pos = 1,
296 .smsm_int.out_base = (void __iomem *)MSM_CSR_BASE,
297 .smsm_int.out_offset = 0x400 + (5) * 4,
298
299 }
300};
301
302static struct smd_platform smd_8625_platform_data = {
303 .num_ss_configs = ARRAY_SIZE(smd_8625_config_list),
304 .smd_ss_configs = smd_8625_config_list,
305};
306
307struct platform_device msm8625_device_smd = {
308 .name = "msm_smd",
309 .id = -1,
310 .resource = smd_8625_resource,
311 .num_resources = ARRAY_SIZE(smd_8625_resource),
312 .dev = {
313 .platform_data = &smd_8625_platform_data,
314 }
315};
316
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +0530317static struct resource resources_adsp[] = {
318 {
319 .start = INT_ADSP_A9_A11,
320 .end = INT_ADSP_A9_A11,
321 .flags = IORESOURCE_IRQ,
322 },
323};
324
325struct platform_device msm_adsp_device = {
326 .name = "msm_adsp",
327 .id = -1,
328 .num_resources = ARRAY_SIZE(resources_adsp),
329 .resource = resources_adsp,
330};
331
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700332static struct resource resources_uart1[] = {
333 {
334 .start = INT_UART1,
335 .end = INT_UART1,
336 .flags = IORESOURCE_IRQ,
337 },
338 {
Taniya Das13b811a2011-12-09 18:33:45 +0530339 .start = MSM7XXX_UART1_PHYS,
340 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700341 .flags = IORESOURCE_MEM,
342 },
343};
344
345struct platform_device msm_device_uart1 = {
346 .name = "msm_serial",
347 .id = 0,
348 .num_resources = ARRAY_SIZE(resources_uart1),
349 .resource = resources_uart1,
350};
351
352#define MSM_UART1DM_PHYS 0xA0200000
353static struct resource msm_uart1_dm_resources[] = {
354 {
355 .start = MSM_UART1DM_PHYS,
356 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
357 .flags = IORESOURCE_MEM,
358 },
359 {
360 .start = INT_UART1DM_IRQ,
361 .end = INT_UART1DM_IRQ,
362 .flags = IORESOURCE_IRQ,
363 },
364 {
365 .start = INT_UART1DM_RX,
366 .end = INT_UART1DM_RX,
367 .flags = IORESOURCE_IRQ,
368 },
369 {
370 .start = DMOV_HSUART1_TX_CHAN,
371 .end = DMOV_HSUART1_RX_CHAN,
372 .name = "uartdm_channels",
373 .flags = IORESOURCE_DMA,
374 },
375 {
376 .start = DMOV_HSUART1_TX_CRCI,
377 .end = DMOV_HSUART1_RX_CRCI,
378 .name = "uartdm_crci",
379 .flags = IORESOURCE_DMA,
380 },
381};
382
383static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32);
384struct platform_device msm_device_uart_dm1 = {
385 .name = "msm_serial_hs",
386 .id = 0,
387 .num_resources = ARRAY_SIZE(msm_uart1_dm_resources),
388 .resource = msm_uart1_dm_resources,
389 .dev = {
390 .dma_mask = &msm_uart_dm1_dma_mask,
391 .coherent_dma_mask = DMA_BIT_MASK(32),
392 },
393};
394
395#define MSM_UART2DM_PHYS 0xA0300000
396static struct resource msm_uart2dm_resources[] = {
397 {
398 .start = MSM_UART2DM_PHYS,
399 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
400 .name = "uartdm_resource",
401 .flags = IORESOURCE_MEM,
402 },
403 {
404 .start = INT_UART2DM_IRQ,
405 .end = INT_UART2DM_IRQ,
406 .flags = IORESOURCE_IRQ,
407 },
408};
409
410struct platform_device msm_device_uart_dm2 = {
411 .name = "msm_serial_hsl",
412 .id = 0,
413 .num_resources = ARRAY_SIZE(msm_uart2dm_resources),
414 .resource = msm_uart2dm_resources,
415};
416
417#define MSM_NAND_PHYS 0xA0A00000
418#define MSM_NANDC01_PHYS 0xA0A40000
419#define MSM_NANDC10_PHYS 0xA0A80000
420#define MSM_NANDC11_PHYS 0xA0AC0000
421#define EBI2_REG_BASE 0xA0D00000
422static struct resource resources_nand[] = {
423 [0] = {
424 .name = "msm_nand_dmac",
425 .start = DMOV_NAND_CHAN,
426 .end = DMOV_NAND_CHAN,
427 .flags = IORESOURCE_DMA,
428 },
429 [1] = {
430 .name = "msm_nand_phys",
431 .start = MSM_NAND_PHYS,
432 .end = MSM_NAND_PHYS + 0x7FF,
433 .flags = IORESOURCE_MEM,
434 },
435 [2] = {
436 .name = "msm_nandc01_phys",
437 .start = MSM_NANDC01_PHYS,
438 .end = MSM_NANDC01_PHYS + 0x7FF,
439 .flags = IORESOURCE_MEM,
440 },
441 [3] = {
442 .name = "msm_nandc10_phys",
443 .start = MSM_NANDC10_PHYS,
444 .end = MSM_NANDC10_PHYS + 0x7FF,
445 .flags = IORESOURCE_MEM,
446 },
447 [4] = {
448 .name = "msm_nandc11_phys",
449 .start = MSM_NANDC11_PHYS,
450 .end = MSM_NANDC11_PHYS + 0x7FF,
451 .flags = IORESOURCE_MEM,
452 },
453 [5] = {
454 .name = "ebi2_reg_base",
455 .start = EBI2_REG_BASE,
456 .end = EBI2_REG_BASE + 0x60,
457 .flags = IORESOURCE_MEM,
458 },
459};
460
Sujit Reddy Thummaec9b3252012-04-23 15:53:45 +0530461struct flash_platform_data msm_nand_data = {
462 .version = VERSION_2,
463};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700464
465struct platform_device msm_device_nand = {
466 .name = "msm_nand",
467 .id = -1,
468 .num_resources = ARRAY_SIZE(resources_nand),
469 .resource = resources_nand,
470 .dev = {
471 .platform_data = &msm_nand_data,
472 },
473};
474
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530475static struct msm_pm_irq_calls msm7x27a_pm_irq_calls = {
476 .irq_pending = msm_irq_pending,
477 .idle_sleep_allowed = msm_irq_idle_sleep_allowed,
478 .enter_sleep1 = msm_irq_enter_sleep1,
479 .enter_sleep2 = msm_irq_enter_sleep2,
480 .exit_sleep1 = msm_irq_exit_sleep1,
481 .exit_sleep2 = msm_irq_exit_sleep2,
482 .exit_sleep3 = msm_irq_exit_sleep3,
483};
484
485static struct msm_pm_irq_calls msm8625_pm_irq_calls = {
486 .irq_pending = msm_gic_spi_ppi_pending,
487 .idle_sleep_allowed = msm_gic_irq_idle_sleep_allowed,
488 .enter_sleep1 = msm_gic_irq_enter_sleep1,
489 .enter_sleep2 = msm_gic_irq_enter_sleep2,
490 .exit_sleep1 = msm_gic_irq_exit_sleep1,
491 .exit_sleep2 = msm_gic_irq_exit_sleep2,
492 .exit_sleep3 = msm_gic_irq_exit_sleep3,
493};
494
Stephen Boyd986c9632012-04-24 16:31:45 -0700495void __init msm_pm_register_irqs(void)
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530496{
497 if (cpu_is_msm8625())
498 msm_pm_set_irq_extns(&msm8625_pm_irq_calls);
499 else
500 msm_pm_set_irq_extns(&msm7x27a_pm_irq_calls);
501
502}
503
Murali Nalajala0ac89b42012-07-13 16:54:40 +0530504static struct msm_pm_cpr_ops msm8625_pm_cpr_ops = {
505 .cpr_suspend = msm_cpr_pm_suspend,
506 .cpr_resume = msm_cpr_pm_resume,
507};
508
509void __init msm_pm_register_cpr_ops(void)
510{
511 /* CPR presents on revision >= v2.0 chipsets */
512 if (cpu_is_msm8625() &&
513 SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
514 msm_pm_set_cpr_ops(&msm8625_pm_cpr_ops);
515}
516
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700517#define MSM_SDC1_BASE 0xA0400000
518#define MSM_SDC2_BASE 0xA0500000
519#define MSM_SDC3_BASE 0xA0600000
520#define MSM_SDC4_BASE 0xA0700000
521static struct resource resources_sdc1[] = {
522 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530523 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700524 .start = MSM_SDC1_BASE,
525 .end = MSM_SDC1_BASE + SZ_4K - 1,
526 .flags = IORESOURCE_MEM,
527 },
528 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530529 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700530 .start = INT_SDC1_0,
531 .end = INT_SDC1_1,
532 .flags = IORESOURCE_IRQ,
533 },
534 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530535 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700536 .start = DMOV_SDC1_CHAN,
537 .end = DMOV_SDC1_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700538 .flags = IORESOURCE_DMA,
539 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700540 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530541 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700542 .start = DMOV_SDC1_CRCI,
543 .end = DMOV_SDC1_CRCI,
544 .flags = IORESOURCE_DMA,
545 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700546};
547
548static struct resource resources_sdc2[] = {
549 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530550 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700551 .start = MSM_SDC2_BASE,
552 .end = MSM_SDC2_BASE + SZ_4K - 1,
553 .flags = IORESOURCE_MEM,
554 },
555 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530556 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700557 .start = INT_SDC2_0,
558 .end = INT_SDC2_1,
559 .flags = IORESOURCE_IRQ,
560 },
561 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530562 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700563 .start = DMOV_SDC2_CHAN,
564 .end = DMOV_SDC2_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700565 .flags = IORESOURCE_DMA,
566 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700567 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530568 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700569 .start = DMOV_SDC2_CRCI,
570 .end = DMOV_SDC2_CRCI,
571 .flags = IORESOURCE_DMA,
572 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700573};
574
575static struct resource resources_sdc3[] = {
576 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530577 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700578 .start = MSM_SDC3_BASE,
579 .end = MSM_SDC3_BASE + SZ_4K - 1,
580 .flags = IORESOURCE_MEM,
581 },
582 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530583 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700584 .start = INT_SDC3_0,
585 .end = INT_SDC3_1,
586 .flags = IORESOURCE_IRQ,
587 },
588 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530589 .name = "dma_chnl",
Subhash Jadavanif29aefd2012-06-21 00:43:15 +0530590 .start = DMOV_NAND_CHAN,
591 .end = DMOV_NAND_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700592 .flags = IORESOURCE_DMA,
593 },
594 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530595 .name = "dma_crci",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530596 .start = DMOV_SDC3_CRCI,
597 .end = DMOV_SDC3_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700598 .flags = IORESOURCE_DMA,
599 },
600};
601
602static struct resource resources_sdc4[] = {
603 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530604 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700605 .start = MSM_SDC4_BASE,
606 .end = MSM_SDC4_BASE + SZ_4K - 1,
607 .flags = IORESOURCE_MEM,
608 },
609 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530610 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700611 .start = INT_SDC4_0,
612 .end = INT_SDC4_1,
613 .flags = IORESOURCE_IRQ,
614 },
615 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530616 .name = "dma_chnl",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530617 .start = DMOV_SDC4_CHAN,
618 .end = DMOV_SDC4_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700619 .flags = IORESOURCE_DMA,
620 },
621 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530622 .name = "dma_crci",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530623 .start = DMOV_SDC4_CRCI,
624 .end = DMOV_SDC4_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700625 .flags = IORESOURCE_DMA,
626 },
627};
628
629struct platform_device msm_device_sdc1 = {
630 .name = "msm_sdcc",
631 .id = 1,
632 .num_resources = ARRAY_SIZE(resources_sdc1),
633 .resource = resources_sdc1,
634 .dev = {
635 .coherent_dma_mask = 0xffffffff,
636 },
637};
638
639struct platform_device msm_device_sdc2 = {
640 .name = "msm_sdcc",
641 .id = 2,
642 .num_resources = ARRAY_SIZE(resources_sdc2),
643 .resource = resources_sdc2,
644 .dev = {
645 .coherent_dma_mask = 0xffffffff,
646 },
647};
648
649struct platform_device msm_device_sdc3 = {
650 .name = "msm_sdcc",
651 .id = 3,
652 .num_resources = ARRAY_SIZE(resources_sdc3),
653 .resource = resources_sdc3,
654 .dev = {
655 .coherent_dma_mask = 0xffffffff,
656 },
657};
658
659struct platform_device msm_device_sdc4 = {
660 .name = "msm_sdcc",
661 .id = 4,
662 .num_resources = ARRAY_SIZE(resources_sdc4),
663 .resource = resources_sdc4,
664 .dev = {
665 .coherent_dma_mask = 0xffffffff,
666 },
667};
668
669static struct platform_device *msm_sdcc_devices[] __initdata = {
670 &msm_device_sdc1,
671 &msm_device_sdc2,
672 &msm_device_sdc3,
673 &msm_device_sdc4,
674};
675
Suresh Vankadara20cd3be2012-01-18 00:34:06 +0530676#ifdef CONFIG_MSM_CAMERA_V4L2
Suresh Vankadara6050cef52012-04-16 21:44:59 +0530677static int apps_reset;
Suresh Vankadara20cd3be2012-01-18 00:34:06 +0530678static struct resource msm_csic0_resources[] = {
679 {
680 .name = "csic",
681 .start = 0xA0F00000,
682 .end = 0xA0F00000 + 0x00100000 - 1,
683 .flags = IORESOURCE_MEM,
684 },
685 {
686 .name = "csic",
687 .start = INT_CSI_IRQ_0,
688 .end = INT_CSI_IRQ_0,
689 .flags = IORESOURCE_IRQ,
690 },
691};
692
693static struct resource msm_csic1_resources[] = {
694 {
695 .name = "csic",
696 .start = 0xA1000000,
697 .end = 0xA1000000 + 0x00100000 - 1,
698 .flags = IORESOURCE_MEM,
699 },
700 {
701 .name = "csic",
702 .start = INT_CSI_IRQ_1,
703 .end = INT_CSI_IRQ_1,
704 .flags = IORESOURCE_IRQ,
705 },
706};
707
708struct platform_device msm7x27a_device_csic0 = {
709 .name = "msm_csic",
710 .id = 0,
711 .resource = msm_csic0_resources,
712 .num_resources = ARRAY_SIZE(msm_csic0_resources),
713};
714
715struct platform_device msm7x27a_device_csic1 = {
716 .name = "msm_csic",
717 .id = 1,
718 .resource = msm_csic1_resources,
719 .num_resources = ARRAY_SIZE(msm_csic1_resources),
720};
721
722static struct resource msm_clkctl_resources[] = {
723 {
724 .name = "clk_ctl",
Taniya Das13b811a2011-12-09 18:33:45 +0530725 .start = MSM7XXX_CLK_CTL_PHYS,
726 .end = MSM7XXX_CLK_CTL_PHYS + MSM7XXX_CLK_CTL_SIZE - 1,
Suresh Vankadara20cd3be2012-01-18 00:34:06 +0530727 .flags = IORESOURCE_MEM,
728 },
729};
730struct platform_device msm7x27a_device_clkctl = {
731 .name = "msm_clk_ctl",
732 .id = 0,
733 .resource = msm_clkctl_resources,
734 .num_resources = ARRAY_SIZE(msm_clkctl_resources),
Suresh Vankadara6050cef52012-04-16 21:44:59 +0530735 .dev = {
736 .platform_data = &apps_reset,
737 },
Suresh Vankadara20cd3be2012-01-18 00:34:06 +0530738};
739
740struct platform_device msm7x27a_device_vfe = {
741 .name = "msm_vfe",
742 .id = 0,
743};
744
745#endif
746
Murali Nalajala41786ab2012-03-06 10:47:32 +0530747/* Command sequence for simple WFI */
748static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Murali Nalajala2250a272012-03-13 15:56:59 +0530749 0x04, 0x03, 0x04, 0x0f,
Murali Nalajala41786ab2012-03-06 10:47:32 +0530750};
751
752/* Command sequence for GDFS, this won't send any interrupt to the modem */
753static uint8_t spm_pc_without_modem[] __initdata = {
754 0x20, 0x00, 0x30, 0x10,
Murali Nalajala2250a272012-03-13 15:56:59 +0530755 0x03, 0x1e, 0x0e, 0x3e,
756 0x4e, 0x4e, 0x4e, 0x4e,
757 0x4e, 0x4e, 0x4e, 0x4e,
758 0x4e, 0x4e, 0x4e, 0x4e,
759 0x4e, 0x4e, 0x4e, 0x4e,
760 0x2E, 0x0f,
Murali Nalajala41786ab2012-03-06 10:47:32 +0530761};
762
763static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
764 [0] = {
765 .mode = MSM_SPM_MODE_CLOCK_GATING,
766 .notify_rpm = false,
767 .cmd = spm_wfi_cmd_sequence,
768 },
769 [1] = {
770 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
771 .notify_rpm = false,
772 .cmd = spm_pc_without_modem,
773 },
774};
775
776static struct msm_spm_platform_data msm_spm_data[] __initdata = {
777 [0] = {
778 .reg_base_addr = MSM_SAW0_BASE,
779 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
780 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
781 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
782 .modes = msm_spm_seq_list,
783 },
784 [1] = {
785 .reg_base_addr = MSM_SAW1_BASE,
786 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
787 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
788 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
789 .modes = msm_spm_seq_list,
790 },
791};
792
793void __init msm8x25_spm_device_init(void)
794{
795 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
796}
797
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700798#define MDP_BASE 0xAA200000
799#define MIPI_DSI_HW_BASE 0xA1100000
800
801static struct resource msm_mipi_dsi_resources[] = {
802 {
803 .name = "mipi_dsi",
804 .start = MIPI_DSI_HW_BASE,
805 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
806 .flags = IORESOURCE_MEM,
807 },
808 {
809 .start = INT_DSI_IRQ,
810 .end = INT_DSI_IRQ,
811 .flags = IORESOURCE_IRQ,
812 },
813};
814
815static struct platform_device msm_mipi_dsi_device = {
816 .name = "mipi_dsi",
817 .id = 1,
818 .num_resources = ARRAY_SIZE(msm_mipi_dsi_resources),
819 .resource = msm_mipi_dsi_resources,
820};
821
822static struct resource msm_mdp_resources[] = {
823 {
824 .name = "mdp",
825 .start = MDP_BASE,
826 .end = MDP_BASE + 0x000F1008 - 1,
827 .flags = IORESOURCE_MEM,
828 },
829 {
830 .start = INT_MDP,
831 .end = INT_MDP,
832 .flags = IORESOURCE_IRQ,
833 },
834};
835
836static struct platform_device msm_mdp_device = {
837 .name = "mdp",
838 .id = 0,
839 .num_resources = ARRAY_SIZE(msm_mdp_resources),
840 .resource = msm_mdp_resources,
841};
842
843static struct platform_device msm_lcdc_device = {
844 .name = "lcdc",
845 .id = 0,
846};
847
848static struct resource kgsl_3d0_resources[] = {
849 {
850 .name = KGSL_3D0_REG_MEMORY,
851 .start = 0xA0000000,
852 .end = 0xA001ffff,
853 .flags = IORESOURCE_MEM,
854 },
855 {
856 .name = KGSL_3D0_IRQ,
857 .start = INT_GRAPHICS,
858 .end = INT_GRAPHICS,
859 .flags = IORESOURCE_IRQ,
860 },
861};
862
863static struct kgsl_device_platform_data kgsl_3d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600864 .pwrlevel = {
865 {
866 .gpu_freq = 245760000,
867 .bus_freq = 200000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700868 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600869 {
Lynus Vazeaf0aac2012-01-05 12:28:47 +0530870 .gpu_freq = 192000000,
871 .bus_freq = 160000000,
872 },
873 {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600874 .gpu_freq = 133330000,
875 .bus_freq = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700876 },
877 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600878 .init_level = 0,
Lynus Vazeaf0aac2012-01-05 12:28:47 +0530879 .num_levels = 3,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600880 .set_grp_async = set_grp_xbar_async,
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700881 .idle_timeout = HZ,
Lynus Vazfe4bede2012-04-06 11:53:30 -0700882 .strtstp_sleepwake = true,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600883 .nap_allowed = false,
884 .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700885};
886
887struct platform_device msm_kgsl_3d0 = {
888 .name = "kgsl-3d0",
889 .id = 0,
890 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
891 .resource = kgsl_3d0_resources,
892 .dev = {
893 .platform_data = &kgsl_3d0_pdata,
894 },
895};
896
897void __init msm7x25a_kgsl_3d0_init(void)
898{
Pankaj Kumarfee56a82012-04-17 14:26:49 +0530899 if (cpu_is_msm7x25a() || cpu_is_msm7x25aa() || cpu_is_msm7x25ab()) {
Lynus Vaz971610e2012-01-06 11:00:32 +0530900 kgsl_3d0_pdata.num_levels = 2;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600901 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 133330000;
902 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 160000000;
903 kgsl_3d0_pdata.pwrlevel[1].gpu_freq = 96000000;
904 kgsl_3d0_pdata.pwrlevel[1].bus_freq = 0;
Rajesh Kemisettidf6e62f2012-03-12 14:02:30 +0530905 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700906}
907
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700908void __init msm8x25_kgsl_3d0_init(void)
909{
Lynus Vazfe4bede2012-04-06 11:53:30 -0700910 if (cpu_is_msm8625()) {
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700911 kgsl_3d0_pdata.idle_timeout = HZ/5;
Lynus Vazfe4bede2012-04-06 11:53:30 -0700912 kgsl_3d0_pdata.strtstp_sleepwake = false;
Ranjhith Kalisamy24696322012-04-11 22:09:17 +0530913 /* 8x25 supports a higher GPU frequency */
Rajesh Kemisettid41dd802012-07-24 11:31:47 +0530914 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 320000000;
Ranjhith Kalisamy24696322012-04-11 22:09:17 +0530915 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 200000000;
Lynus Vazfe4bede2012-04-06 11:53:30 -0700916 }
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700917}
918
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700919static void __init msm_register_device(struct platform_device *pdev, void *data)
920{
921 int ret;
922
923 pdev->dev.platform_data = data;
924
925 ret = platform_device_register(pdev);
926
927 if (ret)
928 dev_err(&pdev->dev,
929 "%s: platform_device_register() failed = %d\n",
930 __func__, ret);
931}
932
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700933
934#define PERPH_WEB_BLOCK_ADDR (0xA9D00040)
935#define PDM0_CTL_OFFSET (0x04)
936#define SIZE_8B (0x08)
937
938static struct resource resources_led[] = {
939 {
940 .start = PERPH_WEB_BLOCK_ADDR,
941 .end = PERPH_WEB_BLOCK_ADDR + (SIZE_8B) - 1,
942 .name = "led-gpio-pdm",
943 .flags = IORESOURCE_MEM,
944 },
945};
946
947static struct led_info msm_kpbl_pdm_led_pdata = {
948 .name = "keyboard-backlight",
949};
950
951struct platform_device led_pdev = {
952 .name = "leds-msm-pdm",
953 /* use pdev id to represent pdm id */
954 .id = 0,
955 .num_resources = ARRAY_SIZE(resources_led),
956 .resource = resources_led,
957 .dev = {
958 .platform_data = &msm_kpbl_pdm_led_pdata,
959 },
960};
961
Manish Dewangan3a260992011-06-24 18:01:34 +0530962struct platform_device asoc_msm_pcm = {
963 .name = "msm-dsp-audio",
964 .id = 0,
965};
966
967struct platform_device asoc_msm_dai0 = {
968 .name = "msm-codec-dai",
969 .id = 0,
970};
971
972struct platform_device asoc_msm_dai1 = {
973 .name = "msm-cpu-dai",
974 .id = 0,
975};
976
Taniya Das2e948192011-12-20 11:15:13 +0530977static struct resource gpio_resources[] = {
978 {
979 .start = INT_GPIO_GROUP1,
980 .flags = IORESOURCE_IRQ,
981 },
982 {
983 .start = INT_GPIO_GROUP2,
984 .flags = IORESOURCE_IRQ,
985 },
986};
987
988static struct platform_device msm_device_gpio = {
989 .name = "msmgpio",
990 .id = -1,
991 .resource = gpio_resources,
992 .num_resources = ARRAY_SIZE(gpio_resources),
993};
994
Taniya Das43bcdd62011-12-02 17:33:27 +0530995struct platform_device *msm_footswitch_devices[] = {
Matt Wagantalld6fbf232012-05-03 20:09:28 -0700996 FS_PCOM(FS_GFX3D, "vdd", "kgsl-3d0.0"),
Taniya Das43bcdd62011-12-02 17:33:27 +0530997};
998unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);
999
1000/* MSM8625 Devices */
1001
1002static struct resource msm8625_resources_uart1[] = {
1003 {
1004 .start = MSM8625_INT_UART1,
1005 .end = MSM8625_INT_UART1,
1006 .flags = IORESOURCE_IRQ,
1007 },
1008 {
Taniya Das13b811a2011-12-09 18:33:45 +05301009 .start = MSM7XXX_UART1_PHYS,
1010 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Taniya Das43bcdd62011-12-02 17:33:27 +05301011 .flags = IORESOURCE_MEM,
1012 },
1013};
1014
1015struct platform_device msm8625_device_uart1 = {
1016 .name = "msm_serial",
1017 .id = 0,
1018 .num_resources = ARRAY_SIZE(msm8625_resources_uart1),
1019 .resource = msm8625_resources_uart1,
1020};
1021
Trilok Soni269fff42012-02-13 20:35:30 +05301022static struct resource msm8625_uart1_dm_resources[] = {
1023 {
1024 .start = MSM_UART1DM_PHYS,
1025 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
1026 .flags = IORESOURCE_MEM,
1027 },
1028 {
1029 .start = MSM8625_INT_UART1DM_IRQ,
1030 .end = MSM8625_INT_UART1DM_IRQ,
1031 .flags = IORESOURCE_IRQ,
1032 },
1033 {
1034 .start = MSM8625_INT_UART1DM_RX,
1035 .end = MSM8625_INT_UART1DM_RX,
1036 .flags = IORESOURCE_IRQ,
1037 },
1038 {
1039 .start = DMOV_HSUART1_TX_CHAN,
1040 .end = DMOV_HSUART1_RX_CHAN,
1041 .name = "uartdm_channels",
1042 .flags = IORESOURCE_DMA,
1043 },
1044 {
1045 .start = DMOV_HSUART1_TX_CRCI,
1046 .end = DMOV_HSUART1_RX_CRCI,
1047 .name = "uartdm_crci",
1048 .flags = IORESOURCE_DMA,
1049 },
1050};
1051
1052struct platform_device msm8625_device_uart_dm1 = {
1053 .name = "msm_serial_hs",
1054 .id = 0,
1055 .num_resources = ARRAY_SIZE(msm8625_uart1_dm_resources),
1056 .resource = msm8625_uart1_dm_resources,
1057 .dev = {
1058 .dma_mask = &msm_uart_dm1_dma_mask,
1059 .coherent_dma_mask = DMA_BIT_MASK(32),
1060 },
1061};
1062
1063static struct resource msm8625_uart2dm_resources[] = {
1064 {
1065 .start = MSM_UART2DM_PHYS,
1066 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
1067 .name = "uartdm_resource",
1068 .flags = IORESOURCE_MEM,
1069 },
1070 {
1071 .start = MSM8625_INT_UART2DM_IRQ,
1072 .end = MSM8625_INT_UART2DM_IRQ,
1073 .flags = IORESOURCE_IRQ,
1074 },
1075};
1076
1077struct platform_device msm8625_device_uart_dm2 = {
1078 .name = "msm_serial_hsl",
1079 .id = 0,
1080 .num_resources = ARRAY_SIZE(msm8625_uart2dm_resources),
1081 .resource = msm8625_uart2dm_resources,
1082};
1083
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +05301084static struct resource msm8625_resources_adsp[] = {
1085 {
1086 .start = MSM8625_INT_ADSP_A9_A11,
1087 .end = MSM8625_INT_ADSP_A9_A11,
1088 .flags = IORESOURCE_IRQ,
1089 },
1090};
1091
1092struct platform_device msm8625_device_adsp = {
1093 .name = "msm_adsp",
1094 .id = -1,
1095 .num_resources = ARRAY_SIZE(msm8625_resources_adsp),
1096 .resource = msm8625_resources_adsp,
1097};
1098
Taniya Das43bcdd62011-12-02 17:33:27 +05301099static struct resource msm8625_dmov_resource[] = {
1100 {
1101 .start = MSM8625_INT_ADM_AARM,
1102 .flags = IORESOURCE_IRQ,
1103 },
1104 {
1105 .start = 0xA9700000,
1106 .end = 0xA9700000 + SZ_4K - 1,
1107 .flags = IORESOURCE_MEM,
1108 },
1109};
1110
1111struct platform_device msm8625_device_dmov = {
1112 .name = "msm_dmov",
1113 .id = -1,
1114 .resource = msm8625_dmov_resource,
1115 .num_resources = ARRAY_SIZE(msm8625_dmov_resource),
1116 .dev = {
1117 .platform_data = &msm_dmov_pdata,
1118 },
1119};
Taniya Das2e948192011-12-20 11:15:13 +05301120
Taniya Das9d187142011-12-02 15:53:25 +05301121static struct resource gsbi0_msm8625_qup_resources[] = {
1122 {
1123 .name = "qup_phys_addr",
1124 .start = MSM_GSBI0_QUP_PHYS,
1125 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
1126 .flags = IORESOURCE_MEM,
1127 },
1128 {
1129 .name = "gsbi_qup_i2c_addr",
1130 .start = MSM_GSBI0_PHYS,
1131 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
1132 .flags = IORESOURCE_MEM,
1133 },
1134 {
1135 .name = "qup_err_intr",
1136 .start = MSM8625_INT_PWB_I2C,
1137 .end = MSM8625_INT_PWB_I2C,
1138 .flags = IORESOURCE_IRQ,
1139 },
1140};
1141
1142/* Use GSBI0 QUP for /dev/i2c-0 */
Taniya Dase3027e22012-02-27 16:32:27 +05301143struct platform_device msm8625_gsbi0_qup_i2c_device = {
Taniya Das9d187142011-12-02 15:53:25 +05301144 .name = "qup_i2c",
1145 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
1146 .num_resources = ARRAY_SIZE(gsbi0_msm8625_qup_resources),
1147 .resource = gsbi0_msm8625_qup_resources,
1148};
1149
Trilok Soni633e59c2012-02-13 20:28:30 +05301150static struct resource gsbi1_msm8625_qup_i2c_resources[] = {
1151 {
1152 .name = "qup_phys_addr",
1153 .start = MSM_GSBI1_QUP_PHYS,
1154 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
1155 .flags = IORESOURCE_MEM,
1156 },
1157 {
1158 .name = "gsbi_qup_i2c_addr",
1159 .start = MSM_GSBI1_PHYS,
1160 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
1161 .flags = IORESOURCE_MEM,
1162 },
1163 {
1164 .name = "qup_err_intr",
1165 .start = MSM8625_INT_ARM11_DMA,
1166 .end = MSM8625_INT_ARM11_DMA,
1167 .flags = IORESOURCE_IRQ,
1168 },
1169};
1170
1171/* Use GSBI1 QUP for /dev/i2c-1 */
Taniya Dase3027e22012-02-27 16:32:27 +05301172struct platform_device msm8625_gsbi1_qup_i2c_device = {
Trilok Soni633e59c2012-02-13 20:28:30 +05301173 .name = "qup_i2c",
1174 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
1175 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
1176 .resource = gsbi1_msm8625_qup_i2c_resources,
1177};
1178
Taniya Das6684d622012-01-12 10:29:09 +05301179static struct resource msm8625_gpio_resources[] = {
1180 {
1181 .start = MSM8625_INT_GPIO_GROUP1,
1182 .flags = IORESOURCE_IRQ,
1183 },
1184 {
1185 .start = MSM8625_INT_GPIO_GROUP2,
1186 .flags = IORESOURCE_IRQ,
1187 },
1188};
1189
1190static struct platform_device msm8625_device_gpio = {
1191 .name = "msmgpio",
1192 .id = -1,
1193 .resource = msm8625_gpio_resources,
1194 .num_resources = ARRAY_SIZE(msm8625_gpio_resources),
1195};
1196
Trilok Soniee75f6c2012-02-13 20:45:07 +05301197static struct resource msm8625_resources_sdc1[] = {
1198 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301199 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301200 .start = MSM_SDC1_BASE,
1201 .end = MSM_SDC1_BASE + SZ_4K - 1,
1202 .flags = IORESOURCE_MEM,
1203 },
1204 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301205 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301206 .start = MSM8625_INT_SDC1_0,
1207 .end = MSM8625_INT_SDC1_1,
1208 .flags = IORESOURCE_IRQ,
1209 },
1210 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301211 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301212 .start = DMOV_SDC1_CHAN,
1213 .end = DMOV_SDC1_CHAN,
1214 .flags = IORESOURCE_DMA,
1215 },
1216 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301217 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301218 .start = DMOV_SDC1_CRCI,
1219 .end = DMOV_SDC1_CRCI,
1220 .flags = IORESOURCE_DMA,
1221 }
1222};
1223
1224static struct resource msm8625_resources_sdc2[] = {
1225 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301226 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301227 .start = MSM_SDC2_BASE,
1228 .end = MSM_SDC2_BASE + SZ_4K - 1,
1229 .flags = IORESOURCE_MEM,
1230 },
1231 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301232 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301233 .start = MSM8625_INT_SDC2_0,
1234 .end = MSM8625_INT_SDC2_1,
1235 .flags = IORESOURCE_IRQ,
1236 },
1237 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301238 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301239 .start = DMOV_SDC2_CHAN,
1240 .end = DMOV_SDC2_CHAN,
1241 .flags = IORESOURCE_DMA,
1242 },
1243 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301244 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301245 .start = DMOV_SDC2_CRCI,
1246 .end = DMOV_SDC2_CRCI,
1247 .flags = IORESOURCE_DMA,
1248 }
1249};
1250
1251static struct resource msm8625_resources_sdc3[] = {
1252 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301253 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301254 .start = MSM_SDC3_BASE,
1255 .end = MSM_SDC3_BASE + SZ_4K - 1,
1256 .flags = IORESOURCE_MEM,
1257 },
1258 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301259 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301260 .start = MSM8625_INT_SDC3_0,
1261 .end = MSM8625_INT_SDC3_1,
1262 .flags = IORESOURCE_IRQ,
1263 },
1264 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301265 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301266 .start = DMOV_SDC3_CHAN,
1267 .end = DMOV_SDC3_CHAN,
1268 .flags = IORESOURCE_DMA,
1269 },
1270 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301271 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301272 .start = DMOV_SDC3_CRCI,
1273 .end = DMOV_SDC3_CRCI,
1274 .flags = IORESOURCE_DMA,
1275 },
1276};
1277
1278static struct resource msm8625_resources_sdc4[] = {
1279 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301280 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301281 .start = MSM_SDC4_BASE,
1282 .end = MSM_SDC4_BASE + SZ_4K - 1,
1283 .flags = IORESOURCE_MEM,
1284 },
1285 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301286 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301287 .start = MSM8625_INT_SDC4_0,
1288 .end = MSM8625_INT_SDC4_1,
1289 .flags = IORESOURCE_IRQ,
1290 },
1291 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301292 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301293 .start = DMOV_SDC4_CHAN,
1294 .end = DMOV_SDC4_CHAN,
1295 .flags = IORESOURCE_DMA,
1296 },
1297 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301298 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301299 .start = DMOV_SDC4_CRCI,
1300 .end = DMOV_SDC4_CRCI,
1301 .flags = IORESOURCE_DMA,
1302 },
1303};
1304
1305struct platform_device msm8625_device_sdc1 = {
1306 .name = "msm_sdcc",
1307 .id = 1,
1308 .num_resources = ARRAY_SIZE(msm8625_resources_sdc1),
1309 .resource = msm8625_resources_sdc1,
1310 .dev = {
1311 .coherent_dma_mask = 0xffffffff,
1312 },
1313};
1314
1315struct platform_device msm8625_device_sdc2 = {
1316 .name = "msm_sdcc",
1317 .id = 2,
1318 .num_resources = ARRAY_SIZE(msm8625_resources_sdc2),
1319 .resource = msm8625_resources_sdc2,
1320 .dev = {
1321 .coherent_dma_mask = 0xffffffff,
1322 },
1323};
1324
1325struct platform_device msm8625_device_sdc3 = {
1326 .name = "msm_sdcc",
1327 .id = 3,
1328 .num_resources = ARRAY_SIZE(msm8625_resources_sdc3),
1329 .resource = msm8625_resources_sdc3,
1330 .dev = {
1331 .coherent_dma_mask = 0xffffffff,
1332 },
1333};
1334
1335struct platform_device msm8625_device_sdc4 = {
1336 .name = "msm_sdcc",
1337 .id = 4,
1338 .num_resources = ARRAY_SIZE(msm8625_resources_sdc4),
1339 .resource = msm8625_resources_sdc4,
1340 .dev = {
1341 .coherent_dma_mask = 0xffffffff,
1342 },
1343};
1344
1345static struct platform_device *msm8625_sdcc_devices[] __initdata = {
1346 &msm8625_device_sdc1,
1347 &msm8625_device_sdc2,
1348 &msm8625_device_sdc3,
1349 &msm8625_device_sdc4,
1350};
1351
1352int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
1353{
1354 struct platform_device *pdev;
1355
1356 if (controller < 1 || controller > 4)
1357 return -EINVAL;
1358
1359 if (cpu_is_msm8625())
1360 pdev = msm8625_sdcc_devices[controller-1];
1361 else
1362 pdev = msm_sdcc_devices[controller-1];
1363
1364 pdev->dev.platform_data = plat;
1365 return platform_device_register(pdev);
1366}
1367
Trilok Sonida63a8b2012-02-13 20:50:03 +05301368static struct resource msm8625_resources_hsusb_otg[] = {
1369 {
1370 .start = MSM_HSUSB_PHYS,
1371 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1372 .flags = IORESOURCE_MEM,
1373 },
1374 {
1375 .start = MSM8625_INT_USB_HS,
1376 .end = MSM8625_INT_USB_HS,
1377 .flags = IORESOURCE_IRQ,
1378 },
1379};
1380
1381struct platform_device msm8625_device_otg = {
1382 .name = "msm_otg",
1383 .id = -1,
1384 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_otg),
1385 .resource = msm8625_resources_hsusb_otg,
1386 .dev = {
1387 .dma_mask = &dma_mask,
1388 .coherent_dma_mask = 0xffffffffULL,
1389 },
1390};
1391
1392static struct resource msm8625_resources_gadget_peripheral[] = {
1393 {
1394 .start = MSM_HSUSB_PHYS,
1395 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1396 .flags = IORESOURCE_MEM,
1397 },
1398 {
1399 .start = MSM8625_INT_USB_HS,
1400 .end = MSM8625_INT_USB_HS,
1401 .flags = IORESOURCE_IRQ,
1402 },
1403};
1404
1405struct platform_device msm8625_device_gadget_peripheral = {
1406 .name = "msm_hsusb",
1407 .id = -1,
1408 .num_resources = ARRAY_SIZE(msm8625_resources_gadget_peripheral),
1409 .resource = msm8625_resources_gadget_peripheral,
1410 .dev = {
1411 .dma_mask = &dma_mask,
1412 .coherent_dma_mask = 0xffffffffULL,
1413 },
1414};
1415
1416static struct resource msm8625_resources_hsusb_host[] = {
1417 {
1418 .start = MSM_HSUSB_PHYS,
1419 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1420 .flags = IORESOURCE_MEM,
1421 },
1422 {
1423 .start = MSM8625_INT_USB_HS,
1424 .end = MSM8625_INT_USB_HS,
1425 .flags = IORESOURCE_IRQ,
1426 },
1427};
1428
1429struct platform_device msm8625_device_hsusb_host = {
1430 .name = "msm_hsusb_host",
1431 .id = 0,
1432 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_host),
1433 .resource = msm8625_resources_hsusb_host,
1434 .dev = {
1435 .dma_mask = &dma_mask,
1436 .coherent_dma_mask = 0xffffffffULL,
1437 },
1438};
1439
1440static struct platform_device *msm8625_host_devices[] = {
1441 &msm8625_device_hsusb_host,
1442};
1443
1444int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
1445{
1446 struct platform_device *pdev;
1447
1448 if (cpu_is_msm8625())
1449 pdev = msm8625_host_devices[host];
1450 else
1451 pdev = msm_host_devices[host];
1452 if (!pdev)
1453 return -ENODEV;
1454 pdev->dev.platform_data = plat;
1455 return platform_device_register(pdev);
1456}
1457
Trilok Soni88da2552012-02-13 21:01:24 +05301458#ifdef CONFIG_MSM_CAMERA_V4L2
1459static struct resource msm8625_csic0_resources[] = {
1460 {
1461 .name = "csic",
1462 .start = 0xA0F00000,
1463 .end = 0xA0F00000 + 0x00100000 - 1,
1464 .flags = IORESOURCE_MEM,
1465 },
1466 {
1467 .name = "csic",
1468 .start = MSM8625_INT_CSI_IRQ_0,
1469 .end = MSM8625_INT_CSI_IRQ_0,
1470 .flags = IORESOURCE_IRQ,
1471 },
1472};
1473
1474static struct resource msm8625_csic1_resources[] = {
1475 {
1476 .name = "csic",
1477 .start = 0xA1000000,
1478 .end = 0xA1000000 + 0x00100000 - 1,
1479 .flags = IORESOURCE_MEM,
1480 },
1481 {
1482 .name = "csic",
1483 .start = MSM8625_INT_CSI_IRQ_1,
1484 .end = MSM8625_INT_CSI_IRQ_1,
1485 .flags = IORESOURCE_IRQ,
1486 },
1487};
1488
1489struct platform_device msm8625_device_csic0 = {
1490 .name = "msm_csic",
1491 .id = 0,
1492 .resource = msm8625_csic0_resources,
1493 .num_resources = ARRAY_SIZE(msm8625_csic0_resources),
1494};
1495
1496struct platform_device msm8625_device_csic1 = {
1497 .name = "msm_csic",
1498 .id = 1,
1499 .resource = msm8625_csic1_resources,
1500 .num_resources = ARRAY_SIZE(msm8625_csic1_resources),
1501};
1502#endif
1503
Trilok Soniae4633d2012-02-13 21:08:32 +05301504static struct resource msm8625_mipi_dsi_resources[] = {
1505 {
1506 .name = "mipi_dsi",
1507 .start = MIPI_DSI_HW_BASE,
1508 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
1509 .flags = IORESOURCE_MEM,
1510 },
1511 {
1512 .start = MSM8625_INT_DSI_IRQ,
1513 .end = MSM8625_INT_DSI_IRQ,
1514 .flags = IORESOURCE_IRQ,
1515 },
1516};
1517
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301518static struct platform_device msm8625_mipi_dsi_device = {
Trilok Soniae4633d2012-02-13 21:08:32 +05301519 .name = "mipi_dsi",
1520 .id = 1,
1521 .num_resources = ARRAY_SIZE(msm8625_mipi_dsi_resources),
1522 .resource = msm8625_mipi_dsi_resources,
1523};
1524
1525static struct resource msm8625_mdp_resources[] = {
1526 {
1527 .name = "mdp",
1528 .start = MDP_BASE,
1529 .end = MDP_BASE + 0x000F1008 - 1,
1530 .flags = IORESOURCE_MEM,
1531 },
1532 {
1533 .start = MSM8625_INT_MDP,
1534 .end = MSM8625_INT_MDP,
1535 .flags = IORESOURCE_IRQ,
1536 },
1537};
1538
1539static struct platform_device msm8625_mdp_device = {
1540 .name = "mdp",
1541 .id = 0,
1542 .num_resources = ARRAY_SIZE(msm8625_mdp_resources),
1543 .resource = msm8625_mdp_resources,
1544};
1545
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301546struct platform_device mipi_dsi_device;
1547
Trilok Soniae4633d2012-02-13 21:08:32 +05301548void __init msm_fb_register_device(char *name, void *data)
1549{
1550 if (!strncmp(name, "mdp", 3)) {
1551 if (cpu_is_msm8625())
1552 msm_register_device(&msm8625_mdp_device, data);
1553 else
1554 msm_register_device(&msm_mdp_device, data);
1555 } else if (!strncmp(name, "mipi_dsi", 8)) {
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301556 if (cpu_is_msm8625()) {
Trilok Soniae4633d2012-02-13 21:08:32 +05301557 msm_register_device(&msm8625_mipi_dsi_device, data);
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301558 mipi_dsi_device = msm8625_mipi_dsi_device;
1559 } else {
Trilok Soniae4633d2012-02-13 21:08:32 +05301560 msm_register_device(&msm_mipi_dsi_device, data);
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301561 mipi_dsi_device = msm_mipi_dsi_device;
1562 }
Trilok Soniae4633d2012-02-13 21:08:32 +05301563 } else if (!strncmp(name, "lcdc", 4)) {
1564 msm_register_device(&msm_lcdc_device, data);
1565 } else {
1566 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
1567 }
1568}
1569
Trilok Soni664b95d2012-02-13 21:13:15 +05301570static struct resource msm8625_kgsl_3d0_resources[] = {
1571 {
1572 .name = KGSL_3D0_REG_MEMORY,
1573 .start = 0xA0000000,
1574 .end = 0xA001ffff,
1575 .flags = IORESOURCE_MEM,
1576 },
1577 {
1578 .name = KGSL_3D0_IRQ,
1579 .start = MSM8625_INT_GRAPHICS,
1580 .end = MSM8625_INT_GRAPHICS,
1581 .flags = IORESOURCE_IRQ,
1582 },
1583};
1584
1585struct platform_device msm8625_kgsl_3d0 = {
1586 .name = "kgsl-3d0",
1587 .id = 0,
1588 .num_resources = ARRAY_SIZE(msm8625_kgsl_3d0_resources),
1589 .resource = msm8625_kgsl_3d0_resources,
1590 .dev = {
1591 .platform_data = &kgsl_3d0_pdata,
1592 },
1593};
1594
Taniya Das7c9f0512011-12-02 14:26:46 +05301595static struct clk_lookup msm_clock_8625_dummy[] = {
1596 CLK_DUMMY("core_clk", adm_clk.c, "msm_dmov", 0),
1597 CLK_DUMMY("adsp_clk", adsp_clk.c, NULL, 0),
1598 CLK_DUMMY("ahb_m_clk", ahb_m_clk.c, NULL, 0),
1599 CLK_DUMMY("ahb_s_clk", ahb_s_clk.c, NULL, 0),
1600 CLK_DUMMY("cam_m_clk", cam_m_clk.c, NULL, 0),
1601 CLK_DUMMY("csi_clk", csi1_clk.c, NULL, 0),
1602 CLK_DUMMY("csi_pclk", csi1_p_clk.c, NULL, 0),
1603 CLK_DUMMY("csi_vfe_clk", csi1_vfe_clk.c, NULL, 0),
1604 CLK_DUMMY("dsi_byte_clk", dsi_byte_clk.c, NULL, 0),
1605 CLK_DUMMY("dsi_clk", dsi_clk.c, NULL, 0),
1606 CLK_DUMMY("dsi_esc_clk", dsi_esc_clk.c, NULL, 0),
1607 CLK_DUMMY("dsi_pixel_clk", dsi_pixel_clk.c, NULL, 0),
1608 CLK_DUMMY("dsi_ref_clk", dsi_ref_clk.c, NULL, 0),
1609 CLK_DUMMY("ebi1_clk", ebi1_clk.c, NULL, 0),
1610 CLK_DUMMY("ebi2_clk", ebi2_clk.c, NULL, 0),
1611 CLK_DUMMY("ecodec_clk", ecodec_clk.c, NULL, 0),
1612 CLK_DUMMY("gp_clk", gp_clk.c, NULL, 0),
1613 CLK_DUMMY("core_clk", gsbi1_qup_clk.c, "qup_i2c.0", 0),
1614 CLK_DUMMY("core_clk", gsbi2_qup_clk.c, "qup_i2c.1", 0),
1615 CLK_DUMMY("iface_clk", gsbi1_qup_p_clk.c, "qup_i2c.0", 0),
1616 CLK_DUMMY("iface_clk", gsbi2_qup_p_clk.c, "qup_i2c.1", 0),
1617 CLK_DUMMY("icodec_rx_clk", icodec_rx_clk.c, NULL, 0),
1618 CLK_DUMMY("icodec_tx_clk", icodec_tx_clk.c, NULL, 0),
1619 CLK_DUMMY("mem_clk", imem_clk.c, NULL, 0),
1620 CLK_DUMMY("mddi_clk", pmdh_clk.c, NULL, 0),
1621 CLK_DUMMY("mdp_clk", mdp_clk.c, NULL, 0),
1622 CLK_DUMMY("mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk.c, NULL, 0),
1623 CLK_DUMMY("mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk.c, NULL, 0),
1624 CLK_DUMMY("mdp_vsync_clk", mdp_vsync_clk.c, NULL, 0),
1625 CLK_DUMMY("mdp_dsi_pclk", mdp_dsi_p_clk.c, NULL, 0),
1626 CLK_DUMMY("pbus_clk", pbus_clk.c, NULL, 0),
1627 CLK_DUMMY("pcm_clk", pcm_clk.c, NULL, 0),
1628 CLK_DUMMY("sdac_clk", sdac_clk.c, NULL, 0),
1629 CLK_DUMMY("core_clk", sdc1_clk.c, "msm_sdcc.1", 0),
1630 CLK_DUMMY("iface_clk", sdc1_p_clk.c, "msm_sdcc.1", 0),
1631 CLK_DUMMY("core_clk", sdc2_clk.c, "msm_sdcc.2", 0),
1632 CLK_DUMMY("iface_clk", sdc2_p_clk.c, "msm_sdcc.2", 0),
1633 CLK_DUMMY("core_clk", sdc3_clk.c, "msm_sdcc.3", 0),
1634 CLK_DUMMY("iface_clk", sdc3_p_clk.c, "msm_sdcc.3", 0),
1635 CLK_DUMMY("core_clk", sdc4_clk.c, "msm_sdcc.4", 0),
1636 CLK_DUMMY("iface_clk", sdc4_p_clk.c, "msm_sdcc.4", 0),
1637 CLK_DUMMY("ref_clk", tsif_ref_clk.c, "msm_tsif.0", 0),
1638 CLK_DUMMY("iface_clk", tsif_p_clk.c, "msm_tsif.0", 0),
1639 CLK_DUMMY("core_clk", uart1_clk.c, "msm_serial.0", 0),
1640 CLK_DUMMY("core_clk", uart2_clk.c, "msm_serial.1", 0),
1641 CLK_DUMMY("core_clk", uart1dm_clk.c, "msm_serial_hs.0", 0),
1642 CLK_DUMMY("core_clk", uart2dm_clk.c, "msm_serial_hsl.0", 0),
1643 CLK_DUMMY("usb_hs_core_clk", usb_hs_core_clk.c, NULL, 0),
1644 CLK_DUMMY("usb_hs2_clk", usb_hs2_clk.c, NULL, 0),
1645 CLK_DUMMY("usb_hs_clk", usb_hs_clk.c, NULL, 0),
1646 CLK_DUMMY("usb_hs_pclk", usb_hs_p_clk.c, NULL, 0),
1647 CLK_DUMMY("usb_phy_clk", usb_phy_clk.c, NULL, 0),
1648 CLK_DUMMY("vdc_clk", vdc_clk.c, NULL, 0),
1649 CLK_DUMMY("ebi1_acpu_clk", ebi_acpu_clk.c, NULL, 0),
1650 CLK_DUMMY("ebi1_lcdc_clk", ebi_lcdc_clk.c, NULL, 0),
1651 CLK_DUMMY("ebi1_mddi_clk", ebi_mddi_clk.c, NULL, 0),
1652 CLK_DUMMY("ebi1_usb_clk", ebi_usb_clk.c, NULL, 0),
1653 CLK_DUMMY("ebi1_vfe_clk", ebi_vfe_clk.c, NULL, 0),
1654 CLK_DUMMY("mem_clk", ebi_adm_clk.c, "msm_dmov", 0),
1655};
1656
1657struct clock_init_data msm8625_dummy_clock_init_data __initdata = {
1658 .table = msm_clock_8625_dummy,
1659 .size = ARRAY_SIZE(msm_clock_8625_dummy),
1660};
1661
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301662enum {
1663 MSM8625,
1664 MSM8625A,
Kaushal Kumar86473f02012-06-28 19:35:58 +05301665 MSM8625AB,
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301666};
1667
1668static int __init msm8625_cpu_id(void)
1669{
1670 int raw_id, cpu;
1671
1672 raw_id = socinfo_get_raw_id();
1673 switch (raw_id) {
1674 /* Part number for 1GHz part */
1675 case 0x770:
1676 case 0x771:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301677 case 0x77C:
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301678 case 0x780:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301679 case 0x8D0:
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301680 cpu = MSM8625;
1681 break;
1682 /* Part number for 1.2GHz part */
1683 case 0x773:
1684 case 0x774:
1685 case 0x781:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301686 case 0x8D1:
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301687 cpu = MSM8625A;
1688 break;
Kaushal Kumar86473f02012-06-28 19:35:58 +05301689 case 0x775:
1690 case 0x776:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301691 case 0x77D:
Kaushal Kumar86473f02012-06-28 19:35:58 +05301692 case 0x782:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301693 case 0x8D2:
Kaushal Kumar86473f02012-06-28 19:35:58 +05301694 cpu = MSM8625AB;
1695 break;
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301696 default:
1697 pr_err("Invalid Raw ID\n");
1698 return -ENODEV;
1699 }
1700 return cpu;
1701}
1702
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001703int __init msm7x2x_misc_init(void)
1704{
Taniya Das7c9f0512011-12-02 14:26:46 +05301705 if (machine_is_msm8625_rumi3()) {
1706 msm_clock_init(&msm8625_dummy_clock_init_data);
Taniya Das43bcdd62011-12-02 17:33:27 +05301707 return 0;
Taniya Das7c9f0512011-12-02 14:26:46 +05301708 }
Taniya Das43bcdd62011-12-02 17:33:27 +05301709
Stephen Boydbb600ae2011-08-02 20:11:40 -07001710 msm_clock_init(&msm7x27a_clock_init_data);
Pankaj Kumarfee56a82012-04-17 14:26:49 +05301711 if (cpu_is_msm7x27aa() || cpu_is_msm7x25ab())
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001712 platform_device_register(&msm7x27aa_device_acpuclk);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301713 else if (cpu_is_msm8625()) {
1714 if (msm8625_cpu_id() == MSM8625)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001715 platform_device_register(&msm7x27aa_device_acpuclk);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301716 else if (msm8625_cpu_id() == MSM8625A)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001717 platform_device_register(&msm8625_device_acpuclk);
Kaushal Kumar86473f02012-06-28 19:35:58 +05301718 else if (msm8625_cpu_id() == MSM8625AB)
1719 platform_device_register(&msm8625ab_device_acpuclk);
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001720 } else {
1721 platform_device_register(&msm7x27a_device_acpuclk);
1722 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001723 return 0;
1724}
1725
1726#ifdef CONFIG_CACHE_L2X0
1727static int __init msm7x27x_cache_init(void)
1728{
1729 int aux_ctrl = 0;
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301730 int pctrl = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001731
1732 /* Way Size 010(0x2) 32KB */
1733 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
1734 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
1735 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
1736
Taniya Das379b5682011-12-02 14:53:46 +05301737 if (cpu_is_msm8625()) {
1738 /* Way Size 011(0x3) 64KB */
1739 aux_ctrl |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
1740 (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | \
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301741 (0X1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) | \
1742 (0x1 << L2X0_AUX_CTRL_L2_FORCE_NWA_SHIFT);
1743
1744 /* Write Prefetch Control settings */
1745 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
1746 pctrl |= (0x3 << L2X0_PREFETCH_CTRL_OFFSET_SHIFT) | \
1747 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_INC_SHIFT) | \
1748 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_SHIFT);
1749 writel_relaxed(pctrl , MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
Taniya Das379b5682011-12-02 14:53:46 +05301750 }
1751
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001752 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301753 if (cpu_is_msm8625()) {
1754 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
1755 pr_info("Prfetch Ctrl: 0x%08x\n", pctrl);
1756 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001757
1758 return 0;
1759}
1760#else
pankaj kumar80d7cb62011-08-23 13:37:55 +05301761static int __init msm7x27x_cache_init(void){ return 0; }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001762#endif
1763
1764void __init msm_common_io_init(void)
1765{
1766 msm_map_common_io();
Taniya Das43bcdd62011-12-02 17:33:27 +05301767 if (socinfo_init() < 0)
1768 pr_err("%s: socinfo_init() failed!\n", __func__);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001769 msm7x27x_cache_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301770}
1771
1772void __init msm8625_init_irq(void)
1773{
Trilok Soni1a9fdee2012-05-28 19:54:11 +05301774 msm_gic_irq_extn_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301775 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1776 (void *)MSM_QGIC_CPU_BASE);
Taniya Das43bcdd62011-12-02 17:33:27 +05301777}
1778
1779void __init msm8625_map_io(void)
1780{
1781 msm_map_msm8625_io();
1782
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001783 if (socinfo_init() < 0)
1784 pr_err("%s: socinfo_init() failed!\n", __func__);
Taniya Das379b5682011-12-02 14:53:46 +05301785 msm7x27x_cache_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001786}
1787
Taniya Das43bcdd62011-12-02 17:33:27 +05301788static int msm7627a_init_gpio(void)
1789{
Taniya Das6684d622012-01-12 10:29:09 +05301790 if (cpu_is_msm8625())
1791 platform_device_register(&msm8625_device_gpio);
1792 else
1793 platform_device_register(&msm_device_gpio);
Taniya Das43bcdd62011-12-02 17:33:27 +05301794 return 0;
1795}
1796postcore_initcall(msm7627a_init_gpio);
Taniya Das9d0c3c52012-05-04 14:40:55 +05301797
1798static int msm7627a_panic_handler(struct notifier_block *this,
1799 unsigned long event, void *ptr)
1800{
1801 flush_cache_all();
1802 outer_flush_all();
1803 return NOTIFY_DONE;
1804}
1805
1806static struct notifier_block panic_handler = {
1807 .notifier_call = msm7627a_panic_handler,
1808};
1809
1810static int __init panic_register(void)
1811{
1812 atomic_notifier_chain_register(&panic_notifier_list,
1813 &panic_handler);
1814 return 0;
1815}
1816module_init(panic_register);