blob: ecd8ba83c50b12f92a5d56f47da7ed7ccd9fec07 [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"
Kaushal Kumarc0e5d672012-07-31 16:07:49 +053042#include "msm_cpr.h"
43#include "msm_smem_iface.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070044
45/* Address of GSBI blocks */
46#define MSM_GSBI0_PHYS 0xA1200000
47#define MSM_GSBI1_PHYS 0xA1300000
48
49/* GSBI QUPe devices */
50#define MSM_GSBI0_QUP_PHYS (MSM_GSBI0_PHYS + 0x80000)
51#define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000)
52
Kaushal Kumarc0e5d672012-07-31 16:07:49 +053053#define A11S_TEST_BUS_SEL_ADDR (MSM_CSR_BASE + 0x518)
54#define RBCPR_CLK_MUX_SEL (1 << 13)
55
56/* Reset Address of RBCPR (Active Low)*/
57#define RBCPR_SW_RESET_N (MSM_CSR_BASE + 0x64)
58
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070059static struct resource gsbi0_qup_i2c_resources[] = {
60 {
61 .name = "qup_phys_addr",
62 .start = MSM_GSBI0_QUP_PHYS,
63 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
64 .flags = IORESOURCE_MEM,
65 },
66 {
67 .name = "gsbi_qup_i2c_addr",
68 .start = MSM_GSBI0_PHYS,
69 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
70 .flags = IORESOURCE_MEM,
71 },
72 {
73 .name = "qup_err_intr",
74 .start = INT_PWB_I2C,
75 .end = INT_PWB_I2C,
76 .flags = IORESOURCE_IRQ,
77 },
78};
79
80/* Use GSBI0 QUP for /dev/i2c-0 */
81struct platform_device msm_gsbi0_qup_i2c_device = {
82 .name = "qup_i2c",
83 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
84 .num_resources = ARRAY_SIZE(gsbi0_qup_i2c_resources),
85 .resource = gsbi0_qup_i2c_resources,
86};
87
88static struct resource gsbi1_qup_i2c_resources[] = {
89 {
90 .name = "qup_phys_addr",
91 .start = MSM_GSBI1_QUP_PHYS,
92 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
93 .flags = IORESOURCE_MEM,
94 },
95 {
96 .name = "gsbi_qup_i2c_addr",
97 .start = MSM_GSBI1_PHYS,
98 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
99 .flags = IORESOURCE_MEM,
100 },
101 {
102 .name = "qup_err_intr",
103 .start = INT_ARM11_DMA,
104 .end = INT_ARM11_DMA,
105 .flags = IORESOURCE_IRQ,
106 },
107};
108
109/* Use GSBI1 QUP for /dev/i2c-1 */
110struct platform_device msm_gsbi1_qup_i2c_device = {
111 .name = "qup_i2c",
112 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
113 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
114 .resource = gsbi1_qup_i2c_resources,
115};
116
117#define MSM_HSUSB_PHYS 0xA0800000
118static struct resource resources_hsusb_otg[] = {
119 {
120 .start = MSM_HSUSB_PHYS,
121 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
122 .flags = IORESOURCE_MEM,
123 },
124 {
125 .start = INT_USB_HS,
126 .end = INT_USB_HS,
127 .flags = IORESOURCE_IRQ,
128 },
129};
130
131static u64 dma_mask = 0xffffffffULL;
132struct platform_device msm_device_otg = {
133 .name = "msm_otg",
134 .id = -1,
135 .num_resources = ARRAY_SIZE(resources_hsusb_otg),
136 .resource = resources_hsusb_otg,
137 .dev = {
138 .dma_mask = &dma_mask,
139 .coherent_dma_mask = 0xffffffffULL,
140 },
141};
142
143static struct resource resources_gadget_peripheral[] = {
144 {
145 .start = MSM_HSUSB_PHYS,
146 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
147 .flags = IORESOURCE_MEM,
148 },
149 {
150 .start = INT_USB_HS,
151 .end = INT_USB_HS,
152 .flags = IORESOURCE_IRQ,
153 },
154};
155
156struct platform_device msm_device_gadget_peripheral = {
157 .name = "msm_hsusb",
158 .id = -1,
159 .num_resources = ARRAY_SIZE(resources_gadget_peripheral),
160 .resource = resources_gadget_peripheral,
161 .dev = {
162 .dma_mask = &dma_mask,
163 .coherent_dma_mask = 0xffffffffULL,
164 },
165};
166
167static struct resource resources_hsusb_host[] = {
168 {
169 .start = MSM_HSUSB_PHYS,
170 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
171 .flags = IORESOURCE_MEM,
172 },
173 {
174 .start = INT_USB_HS,
175 .end = INT_USB_HS,
176 .flags = IORESOURCE_IRQ,
177 },
178};
179
180struct platform_device msm_device_hsusb_host = {
181 .name = "msm_hsusb_host",
182 .id = 0,
183 .num_resources = ARRAY_SIZE(resources_hsusb_host),
184 .resource = resources_hsusb_host,
185 .dev = {
186 .dma_mask = &dma_mask,
187 .coherent_dma_mask = 0xffffffffULL,
188 },
189};
190
191static struct platform_device *msm_host_devices[] = {
192 &msm_device_hsusb_host,
193};
194
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700195static struct resource msm_dmov_resource[] = {
196 {
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700197 .start = INT_ADM_AARM,
198 .flags = IORESOURCE_IRQ,
199 },
200 {
201 .start = 0xA9700000,
202 .end = 0xA9700000 + SZ_4K - 1,
203 .flags = IORESOURCE_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700204 },
205};
206
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700207static struct msm_dmov_pdata msm_dmov_pdata = {
208 .sd = 3,
209 .sd_size = 0x400,
210};
211
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700212struct platform_device msm_device_dmov = {
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700213 .name = "msm_dmov",
214 .id = -1,
215 .resource = msm_dmov_resource,
216 .num_resources = ARRAY_SIZE(msm_dmov_resource),
217 .dev = {
218 .platform_data = &msm_dmov_pdata,
219 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700220};
221
Matt Wagantallbf430eb2012-03-22 11:45:49 -0700222static struct acpuclk_pdata msm7x27a_acpuclk_pdata = {
223 .max_speed_delta_khz = 400000,
224};
225
226struct platform_device msm7x27a_device_acpuclk = {
227 .name = "acpuclk-7627",
228 .id = -1,
229 .dev.platform_data = &msm7x27a_acpuclk_pdata,
230};
231
232static struct acpuclk_pdata msm7x27aa_acpuclk_pdata = {
233 .max_speed_delta_khz = 504000,
234};
235
236struct platform_device msm7x27aa_device_acpuclk = {
237 .name = "acpuclk-7627",
238 .id = -1,
239 .dev.platform_data = &msm7x27aa_acpuclk_pdata,
240};
241
242static struct acpuclk_pdata msm8625_acpuclk_pdata = {
243 /* TODO: Need to update speed delta from H/w Team */
244 .max_speed_delta_khz = 604800,
245};
246
Kaushal Kumar86473f02012-06-28 19:35:58 +0530247static struct acpuclk_pdata msm8625ab_acpuclk_pdata = {
248 .max_speed_delta_khz = 801600,
249};
250
Matt Wagantallbf430eb2012-03-22 11:45:49 -0700251struct platform_device msm8625_device_acpuclk = {
252 .name = "acpuclk-7627",
253 .id = -1,
254 .dev.platform_data = &msm8625_acpuclk_pdata,
255};
256
Kaushal Kumar86473f02012-06-28 19:35:58 +0530257struct platform_device msm8625ab_device_acpuclk = {
258 .name = "acpuclk-7627",
259 .id = -1,
260 .dev.platform_data = &msm8625ab_acpuclk_pdata,
261};
262
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700263struct platform_device msm_device_smd = {
264 .name = "msm_smd",
265 .id = -1,
266};
267
Angshuman Sarkarfb1cce92012-02-21 15:20:43 +0530268static struct resource smd_8625_resource[] = {
269 {
270 .name = "a9_m2a_0",
271 .start = MSM8625_INT_A9_M2A_0,
272 .flags = IORESOURCE_IRQ,
273 },
274 {
275 .name = "a9_m2a_5",
276 .start = MSM8625_INT_A9_M2A_5,
277 .flags = IORESOURCE_IRQ,
278 },
279};
280
281static struct smd_subsystem_config smd_8625_config_list[] = {
282 {
283 .irq_config_id = SMD_MODEM,
284 .subsys_name = "modem",
285 .edge = SMD_APPS_MODEM,
286
287 .smd_int.irq_name = "a9_m2a_0",
288 .smd_int.flags = IRQF_TRIGGER_RISING,
289 .smd_int.irq_id = -1,
290 .smd_int.device_name = "smd_dev",
291 .smd_int.dev_id = 0,
292
293 .smd_int.out_bit_pos = 1,
294 .smd_int.out_base = (void __iomem *)MSM_CSR_BASE,
295 .smd_int.out_offset = 0x400 + (0) * 4,
296
297 .smsm_int.irq_name = "a9_m2a_5",
298 .smsm_int.flags = IRQF_TRIGGER_RISING,
299 .smsm_int.irq_id = -1,
300 .smsm_int.device_name = "smsm_dev",
301 .smsm_int.dev_id = 0,
302
303 .smsm_int.out_bit_pos = 1,
304 .smsm_int.out_base = (void __iomem *)MSM_CSR_BASE,
305 .smsm_int.out_offset = 0x400 + (5) * 4,
306
307 }
308};
309
310static struct smd_platform smd_8625_platform_data = {
311 .num_ss_configs = ARRAY_SIZE(smd_8625_config_list),
312 .smd_ss_configs = smd_8625_config_list,
313};
314
315struct platform_device msm8625_device_smd = {
316 .name = "msm_smd",
317 .id = -1,
318 .resource = smd_8625_resource,
319 .num_resources = ARRAY_SIZE(smd_8625_resource),
320 .dev = {
321 .platform_data = &smd_8625_platform_data,
322 }
323};
324
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +0530325static struct resource resources_adsp[] = {
326 {
327 .start = INT_ADSP_A9_A11,
328 .end = INT_ADSP_A9_A11,
329 .flags = IORESOURCE_IRQ,
330 },
331};
332
333struct platform_device msm_adsp_device = {
334 .name = "msm_adsp",
335 .id = -1,
336 .num_resources = ARRAY_SIZE(resources_adsp),
337 .resource = resources_adsp,
338};
339
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700340static struct resource resources_uart1[] = {
341 {
342 .start = INT_UART1,
343 .end = INT_UART1,
344 .flags = IORESOURCE_IRQ,
345 },
346 {
Taniya Das13b811a2011-12-09 18:33:45 +0530347 .start = MSM7XXX_UART1_PHYS,
348 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700349 .flags = IORESOURCE_MEM,
350 },
351};
352
353struct platform_device msm_device_uart1 = {
354 .name = "msm_serial",
355 .id = 0,
356 .num_resources = ARRAY_SIZE(resources_uart1),
357 .resource = resources_uart1,
358};
359
360#define MSM_UART1DM_PHYS 0xA0200000
361static struct resource msm_uart1_dm_resources[] = {
362 {
363 .start = MSM_UART1DM_PHYS,
364 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
365 .flags = IORESOURCE_MEM,
366 },
367 {
368 .start = INT_UART1DM_IRQ,
369 .end = INT_UART1DM_IRQ,
370 .flags = IORESOURCE_IRQ,
371 },
372 {
373 .start = INT_UART1DM_RX,
374 .end = INT_UART1DM_RX,
375 .flags = IORESOURCE_IRQ,
376 },
377 {
378 .start = DMOV_HSUART1_TX_CHAN,
379 .end = DMOV_HSUART1_RX_CHAN,
380 .name = "uartdm_channels",
381 .flags = IORESOURCE_DMA,
382 },
383 {
384 .start = DMOV_HSUART1_TX_CRCI,
385 .end = DMOV_HSUART1_RX_CRCI,
386 .name = "uartdm_crci",
387 .flags = IORESOURCE_DMA,
388 },
389};
390
391static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32);
392struct platform_device msm_device_uart_dm1 = {
393 .name = "msm_serial_hs",
394 .id = 0,
395 .num_resources = ARRAY_SIZE(msm_uart1_dm_resources),
396 .resource = msm_uart1_dm_resources,
397 .dev = {
398 .dma_mask = &msm_uart_dm1_dma_mask,
399 .coherent_dma_mask = DMA_BIT_MASK(32),
400 },
401};
402
403#define MSM_UART2DM_PHYS 0xA0300000
404static struct resource msm_uart2dm_resources[] = {
405 {
406 .start = MSM_UART2DM_PHYS,
407 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
408 .name = "uartdm_resource",
409 .flags = IORESOURCE_MEM,
410 },
411 {
412 .start = INT_UART2DM_IRQ,
413 .end = INT_UART2DM_IRQ,
414 .flags = IORESOURCE_IRQ,
415 },
416};
417
418struct platform_device msm_device_uart_dm2 = {
419 .name = "msm_serial_hsl",
420 .id = 0,
421 .num_resources = ARRAY_SIZE(msm_uart2dm_resources),
422 .resource = msm_uart2dm_resources,
423};
424
425#define MSM_NAND_PHYS 0xA0A00000
426#define MSM_NANDC01_PHYS 0xA0A40000
427#define MSM_NANDC10_PHYS 0xA0A80000
428#define MSM_NANDC11_PHYS 0xA0AC0000
429#define EBI2_REG_BASE 0xA0D00000
430static struct resource resources_nand[] = {
431 [0] = {
432 .name = "msm_nand_dmac",
433 .start = DMOV_NAND_CHAN,
434 .end = DMOV_NAND_CHAN,
435 .flags = IORESOURCE_DMA,
436 },
437 [1] = {
438 .name = "msm_nand_phys",
439 .start = MSM_NAND_PHYS,
440 .end = MSM_NAND_PHYS + 0x7FF,
441 .flags = IORESOURCE_MEM,
442 },
443 [2] = {
444 .name = "msm_nandc01_phys",
445 .start = MSM_NANDC01_PHYS,
446 .end = MSM_NANDC01_PHYS + 0x7FF,
447 .flags = IORESOURCE_MEM,
448 },
449 [3] = {
450 .name = "msm_nandc10_phys",
451 .start = MSM_NANDC10_PHYS,
452 .end = MSM_NANDC10_PHYS + 0x7FF,
453 .flags = IORESOURCE_MEM,
454 },
455 [4] = {
456 .name = "msm_nandc11_phys",
457 .start = MSM_NANDC11_PHYS,
458 .end = MSM_NANDC11_PHYS + 0x7FF,
459 .flags = IORESOURCE_MEM,
460 },
461 [5] = {
462 .name = "ebi2_reg_base",
463 .start = EBI2_REG_BASE,
464 .end = EBI2_REG_BASE + 0x60,
465 .flags = IORESOURCE_MEM,
466 },
467};
468
Sujit Reddy Thummaec9b3252012-04-23 15:53:45 +0530469struct flash_platform_data msm_nand_data = {
470 .version = VERSION_2,
471};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700472
473struct platform_device msm_device_nand = {
474 .name = "msm_nand",
475 .id = -1,
476 .num_resources = ARRAY_SIZE(resources_nand),
477 .resource = resources_nand,
478 .dev = {
479 .platform_data = &msm_nand_data,
480 },
481};
482
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530483static struct msm_pm_irq_calls msm7x27a_pm_irq_calls = {
484 .irq_pending = msm_irq_pending,
485 .idle_sleep_allowed = msm_irq_idle_sleep_allowed,
486 .enter_sleep1 = msm_irq_enter_sleep1,
487 .enter_sleep2 = msm_irq_enter_sleep2,
488 .exit_sleep1 = msm_irq_exit_sleep1,
489 .exit_sleep2 = msm_irq_exit_sleep2,
490 .exit_sleep3 = msm_irq_exit_sleep3,
491};
492
493static struct msm_pm_irq_calls msm8625_pm_irq_calls = {
494 .irq_pending = msm_gic_spi_ppi_pending,
495 .idle_sleep_allowed = msm_gic_irq_idle_sleep_allowed,
496 .enter_sleep1 = msm_gic_irq_enter_sleep1,
497 .enter_sleep2 = msm_gic_irq_enter_sleep2,
498 .exit_sleep1 = msm_gic_irq_exit_sleep1,
499 .exit_sleep2 = msm_gic_irq_exit_sleep2,
500 .exit_sleep3 = msm_gic_irq_exit_sleep3,
501};
502
Stephen Boyd986c9632012-04-24 16:31:45 -0700503void __init msm_pm_register_irqs(void)
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530504{
505 if (cpu_is_msm8625())
506 msm_pm_set_irq_extns(&msm8625_pm_irq_calls);
507 else
508 msm_pm_set_irq_extns(&msm7x27a_pm_irq_calls);
509
510}
511
Murali Nalajalaff723ec2012-07-13 16:54:40 +0530512static struct msm_pm_cpr_ops msm8625_pm_cpr_ops = {
513 .cpr_suspend = msm_cpr_pm_suspend,
514 .cpr_resume = msm_cpr_pm_resume,
515};
516
517void __init msm_pm_register_cpr_ops(void)
518{
519 /* CPR presents on revision >= v2.0 chipsets */
520 if (cpu_is_msm8625() &&
521 SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
522 msm_pm_set_cpr_ops(&msm8625_pm_cpr_ops);
523}
524
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700525#define MSM_SDC1_BASE 0xA0400000
526#define MSM_SDC2_BASE 0xA0500000
527#define MSM_SDC3_BASE 0xA0600000
528#define MSM_SDC4_BASE 0xA0700000
529static struct resource resources_sdc1[] = {
530 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530531 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700532 .start = MSM_SDC1_BASE,
533 .end = MSM_SDC1_BASE + SZ_4K - 1,
534 .flags = IORESOURCE_MEM,
535 },
536 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530537 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700538 .start = INT_SDC1_0,
539 .end = INT_SDC1_1,
540 .flags = IORESOURCE_IRQ,
541 },
542 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530543 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700544 .start = DMOV_SDC1_CHAN,
545 .end = DMOV_SDC1_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700546 .flags = IORESOURCE_DMA,
547 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700548 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530549 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700550 .start = DMOV_SDC1_CRCI,
551 .end = DMOV_SDC1_CRCI,
552 .flags = IORESOURCE_DMA,
553 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700554};
555
556static struct resource resources_sdc2[] = {
557 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530558 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700559 .start = MSM_SDC2_BASE,
560 .end = MSM_SDC2_BASE + SZ_4K - 1,
561 .flags = IORESOURCE_MEM,
562 },
563 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530564 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700565 .start = INT_SDC2_0,
566 .end = INT_SDC2_1,
567 .flags = IORESOURCE_IRQ,
568 },
569 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530570 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700571 .start = DMOV_SDC2_CHAN,
572 .end = DMOV_SDC2_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700573 .flags = IORESOURCE_DMA,
574 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700575 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530576 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700577 .start = DMOV_SDC2_CRCI,
578 .end = DMOV_SDC2_CRCI,
579 .flags = IORESOURCE_DMA,
580 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700581};
582
583static struct resource resources_sdc3[] = {
584 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530585 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700586 .start = MSM_SDC3_BASE,
587 .end = MSM_SDC3_BASE + SZ_4K - 1,
588 .flags = IORESOURCE_MEM,
589 },
590 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530591 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700592 .start = INT_SDC3_0,
593 .end = INT_SDC3_1,
594 .flags = IORESOURCE_IRQ,
595 },
596 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530597 .name = "dma_chnl",
Subhash Jadavanif29aefd2012-06-21 00:43:15 +0530598 .start = DMOV_NAND_CHAN,
599 .end = DMOV_NAND_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700600 .flags = IORESOURCE_DMA,
601 },
602 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530603 .name = "dma_crci",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530604 .start = DMOV_SDC3_CRCI,
605 .end = DMOV_SDC3_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700606 .flags = IORESOURCE_DMA,
607 },
608};
609
610static struct resource resources_sdc4[] = {
611 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530612 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700613 .start = MSM_SDC4_BASE,
614 .end = MSM_SDC4_BASE + SZ_4K - 1,
615 .flags = IORESOURCE_MEM,
616 },
617 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530618 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700619 .start = INT_SDC4_0,
620 .end = INT_SDC4_1,
621 .flags = IORESOURCE_IRQ,
622 },
623 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530624 .name = "dma_chnl",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530625 .start = DMOV_SDC4_CHAN,
626 .end = DMOV_SDC4_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700627 .flags = IORESOURCE_DMA,
628 },
629 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530630 .name = "dma_crci",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530631 .start = DMOV_SDC4_CRCI,
632 .end = DMOV_SDC4_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700633 .flags = IORESOURCE_DMA,
634 },
635};
636
637struct platform_device msm_device_sdc1 = {
638 .name = "msm_sdcc",
639 .id = 1,
640 .num_resources = ARRAY_SIZE(resources_sdc1),
641 .resource = resources_sdc1,
642 .dev = {
643 .coherent_dma_mask = 0xffffffff,
644 },
645};
646
647struct platform_device msm_device_sdc2 = {
648 .name = "msm_sdcc",
649 .id = 2,
650 .num_resources = ARRAY_SIZE(resources_sdc2),
651 .resource = resources_sdc2,
652 .dev = {
653 .coherent_dma_mask = 0xffffffff,
654 },
655};
656
657struct platform_device msm_device_sdc3 = {
658 .name = "msm_sdcc",
659 .id = 3,
660 .num_resources = ARRAY_SIZE(resources_sdc3),
661 .resource = resources_sdc3,
662 .dev = {
663 .coherent_dma_mask = 0xffffffff,
664 },
665};
666
667struct platform_device msm_device_sdc4 = {
668 .name = "msm_sdcc",
669 .id = 4,
670 .num_resources = ARRAY_SIZE(resources_sdc4),
671 .resource = resources_sdc4,
672 .dev = {
673 .coherent_dma_mask = 0xffffffff,
674 },
675};
676
677static struct platform_device *msm_sdcc_devices[] __initdata = {
678 &msm_device_sdc1,
679 &msm_device_sdc2,
680 &msm_device_sdc3,
681 &msm_device_sdc4,
682};
683
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530684#ifdef CONFIG_MSM_CAMERA_V4L2
Suresh Vankadara6050cef52012-04-16 21:44:59 +0530685static int apps_reset;
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530686static struct resource msm_csic0_resources[] = {
687 {
688 .name = "csic",
689 .start = 0xA0F00000,
690 .end = 0xA0F00000 + 0x00100000 - 1,
691 .flags = IORESOURCE_MEM,
692 },
693 {
694 .name = "csic",
695 .start = INT_CSI_IRQ_0,
696 .end = INT_CSI_IRQ_0,
697 .flags = IORESOURCE_IRQ,
698 },
699};
700
701static struct resource msm_csic1_resources[] = {
702 {
703 .name = "csic",
704 .start = 0xA1000000,
705 .end = 0xA1000000 + 0x00100000 - 1,
706 .flags = IORESOURCE_MEM,
707 },
708 {
709 .name = "csic",
710 .start = INT_CSI_IRQ_1,
711 .end = INT_CSI_IRQ_1,
712 .flags = IORESOURCE_IRQ,
713 },
714};
715
716struct platform_device msm7x27a_device_csic0 = {
717 .name = "msm_csic",
718 .id = 0,
719 .resource = msm_csic0_resources,
720 .num_resources = ARRAY_SIZE(msm_csic0_resources),
721};
722
723struct platform_device msm7x27a_device_csic1 = {
724 .name = "msm_csic",
725 .id = 1,
726 .resource = msm_csic1_resources,
727 .num_resources = ARRAY_SIZE(msm_csic1_resources),
728};
729
730static struct resource msm_clkctl_resources[] = {
731 {
732 .name = "clk_ctl",
Taniya Das13b811a2011-12-09 18:33:45 +0530733 .start = MSM7XXX_CLK_CTL_PHYS,
734 .end = MSM7XXX_CLK_CTL_PHYS + MSM7XXX_CLK_CTL_SIZE - 1,
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530735 .flags = IORESOURCE_MEM,
736 },
737};
738struct platform_device msm7x27a_device_clkctl = {
739 .name = "msm_clk_ctl",
740 .id = 0,
741 .resource = msm_clkctl_resources,
742 .num_resources = ARRAY_SIZE(msm_clkctl_resources),
Suresh Vankadara6050cef52012-04-16 21:44:59 +0530743 .dev = {
744 .platform_data = &apps_reset,
745 },
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530746};
747
748struct platform_device msm7x27a_device_vfe = {
749 .name = "msm_vfe",
750 .id = 0,
751};
752
753#endif
754
Murali Nalajala41786ab2012-03-06 10:47:32 +0530755/* Command sequence for simple WFI */
756static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Murali Nalajala2250a272012-03-13 15:56:59 +0530757 0x04, 0x03, 0x04, 0x0f,
Murali Nalajala41786ab2012-03-06 10:47:32 +0530758};
759
760/* Command sequence for GDFS, this won't send any interrupt to the modem */
761static uint8_t spm_pc_without_modem[] __initdata = {
762 0x20, 0x00, 0x30, 0x10,
Murali Nalajala2250a272012-03-13 15:56:59 +0530763 0x03, 0x1e, 0x0e, 0x3e,
764 0x4e, 0x4e, 0x4e, 0x4e,
765 0x4e, 0x4e, 0x4e, 0x4e,
766 0x4e, 0x4e, 0x4e, 0x4e,
767 0x4e, 0x4e, 0x4e, 0x4e,
768 0x2E, 0x0f,
Murali Nalajala41786ab2012-03-06 10:47:32 +0530769};
770
771static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
772 [0] = {
773 .mode = MSM_SPM_MODE_CLOCK_GATING,
774 .notify_rpm = false,
775 .cmd = spm_wfi_cmd_sequence,
776 },
777 [1] = {
778 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
779 .notify_rpm = false,
780 .cmd = spm_pc_without_modem,
781 },
782};
783
784static struct msm_spm_platform_data msm_spm_data[] __initdata = {
785 [0] = {
786 .reg_base_addr = MSM_SAW0_BASE,
787 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
788 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
789 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
790 .modes = msm_spm_seq_list,
791 },
792 [1] = {
793 .reg_base_addr = MSM_SAW1_BASE,
794 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
795 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
796 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
797 .modes = msm_spm_seq_list,
798 },
799};
800
801void __init msm8x25_spm_device_init(void)
802{
803 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
804}
805
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700806#define MDP_BASE 0xAA200000
807#define MIPI_DSI_HW_BASE 0xA1100000
808
809static struct resource msm_mipi_dsi_resources[] = {
810 {
811 .name = "mipi_dsi",
812 .start = MIPI_DSI_HW_BASE,
813 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
814 .flags = IORESOURCE_MEM,
815 },
816 {
817 .start = INT_DSI_IRQ,
818 .end = INT_DSI_IRQ,
819 .flags = IORESOURCE_IRQ,
820 },
821};
822
823static struct platform_device msm_mipi_dsi_device = {
824 .name = "mipi_dsi",
825 .id = 1,
826 .num_resources = ARRAY_SIZE(msm_mipi_dsi_resources),
827 .resource = msm_mipi_dsi_resources,
828};
829
830static struct resource msm_mdp_resources[] = {
831 {
832 .name = "mdp",
833 .start = MDP_BASE,
834 .end = MDP_BASE + 0x000F1008 - 1,
835 .flags = IORESOURCE_MEM,
836 },
837 {
838 .start = INT_MDP,
839 .end = INT_MDP,
840 .flags = IORESOURCE_IRQ,
841 },
842};
843
844static struct platform_device msm_mdp_device = {
845 .name = "mdp",
846 .id = 0,
847 .num_resources = ARRAY_SIZE(msm_mdp_resources),
848 .resource = msm_mdp_resources,
849};
850
Padmanabhan Komandurue77bcf52012-07-26 12:43:39 +0530851struct platform_device msm_lcdc_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700852 .name = "lcdc",
853 .id = 0,
854};
855
856static struct resource kgsl_3d0_resources[] = {
857 {
858 .name = KGSL_3D0_REG_MEMORY,
859 .start = 0xA0000000,
860 .end = 0xA001ffff,
861 .flags = IORESOURCE_MEM,
862 },
863 {
864 .name = KGSL_3D0_IRQ,
865 .start = INT_GRAPHICS,
866 .end = INT_GRAPHICS,
867 .flags = IORESOURCE_IRQ,
868 },
869};
870
871static struct kgsl_device_platform_data kgsl_3d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600872 .pwrlevel = {
873 {
874 .gpu_freq = 245760000,
875 .bus_freq = 200000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700876 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600877 {
Lynus Vazeaf0aac2012-01-05 12:28:47 +0530878 .gpu_freq = 192000000,
879 .bus_freq = 160000000,
880 },
881 {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600882 .gpu_freq = 133330000,
883 .bus_freq = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700884 },
885 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600886 .init_level = 0,
Lynus Vazeaf0aac2012-01-05 12:28:47 +0530887 .num_levels = 3,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600888 .set_grp_async = set_grp_xbar_async,
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700889 .idle_timeout = HZ,
Lynus Vazfe4bede2012-04-06 11:53:30 -0700890 .strtstp_sleepwake = true,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600891 .nap_allowed = false,
892 .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700893};
894
895struct platform_device msm_kgsl_3d0 = {
896 .name = "kgsl-3d0",
897 .id = 0,
898 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
899 .resource = kgsl_3d0_resources,
900 .dev = {
901 .platform_data = &kgsl_3d0_pdata,
902 },
903};
904
905void __init msm7x25a_kgsl_3d0_init(void)
906{
Pankaj Kumarfee56a82012-04-17 14:26:49 +0530907 if (cpu_is_msm7x25a() || cpu_is_msm7x25aa() || cpu_is_msm7x25ab()) {
Lynus Vaz971610e2012-01-06 11:00:32 +0530908 kgsl_3d0_pdata.num_levels = 2;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600909 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 133330000;
910 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 160000000;
911 kgsl_3d0_pdata.pwrlevel[1].gpu_freq = 96000000;
912 kgsl_3d0_pdata.pwrlevel[1].bus_freq = 0;
Rajesh Kemisettidf6e62f2012-03-12 14:02:30 +0530913 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700914}
915
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700916void __init msm8x25_kgsl_3d0_init(void)
917{
Lynus Vazfe4bede2012-04-06 11:53:30 -0700918 if (cpu_is_msm8625()) {
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700919 kgsl_3d0_pdata.idle_timeout = HZ/5;
Lynus Vazfe4bede2012-04-06 11:53:30 -0700920 kgsl_3d0_pdata.strtstp_sleepwake = false;
Ranjhith Kalisamy5fb30ef2012-08-12 16:26:36 +0530921
922 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
923 /* 8x25 v2.0 & above supports a higher GPU frequency */
924 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 320000000;
925 else
926 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 300000000;
927
Ranjhith Kalisamy24696322012-04-11 22:09:17 +0530928 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 200000000;
Lynus Vazfe4bede2012-04-06 11:53:30 -0700929 }
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700930}
931
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700932static void __init msm_register_device(struct platform_device *pdev, void *data)
933{
934 int ret;
935
936 pdev->dev.platform_data = data;
937
938 ret = platform_device_register(pdev);
939
940 if (ret)
941 dev_err(&pdev->dev,
942 "%s: platform_device_register() failed = %d\n",
943 __func__, ret);
944}
945
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700946
947#define PERPH_WEB_BLOCK_ADDR (0xA9D00040)
948#define PDM0_CTL_OFFSET (0x04)
949#define SIZE_8B (0x08)
950
951static struct resource resources_led[] = {
952 {
953 .start = PERPH_WEB_BLOCK_ADDR,
954 .end = PERPH_WEB_BLOCK_ADDR + (SIZE_8B) - 1,
955 .name = "led-gpio-pdm",
956 .flags = IORESOURCE_MEM,
957 },
958};
959
960static struct led_info msm_kpbl_pdm_led_pdata = {
961 .name = "keyboard-backlight",
962};
963
964struct platform_device led_pdev = {
965 .name = "leds-msm-pdm",
966 /* use pdev id to represent pdm id */
967 .id = 0,
968 .num_resources = ARRAY_SIZE(resources_led),
969 .resource = resources_led,
970 .dev = {
971 .platform_data = &msm_kpbl_pdm_led_pdata,
972 },
973};
974
Manish Dewangan3a260992011-06-24 18:01:34 +0530975struct platform_device asoc_msm_pcm = {
976 .name = "msm-dsp-audio",
977 .id = 0,
978};
979
980struct platform_device asoc_msm_dai0 = {
981 .name = "msm-codec-dai",
982 .id = 0,
983};
984
985struct platform_device asoc_msm_dai1 = {
986 .name = "msm-cpu-dai",
987 .id = 0,
988};
989
Taniya Das2e948192011-12-20 11:15:13 +0530990static struct resource gpio_resources[] = {
991 {
992 .start = INT_GPIO_GROUP1,
993 .flags = IORESOURCE_IRQ,
994 },
995 {
996 .start = INT_GPIO_GROUP2,
997 .flags = IORESOURCE_IRQ,
998 },
999};
1000
1001static struct platform_device msm_device_gpio = {
1002 .name = "msmgpio",
1003 .id = -1,
1004 .resource = gpio_resources,
1005 .num_resources = ARRAY_SIZE(gpio_resources),
1006};
1007
Taniya Das43bcdd62011-12-02 17:33:27 +05301008struct platform_device *msm_footswitch_devices[] = {
Matt Wagantalld6fbf232012-05-03 20:09:28 -07001009 FS_PCOM(FS_GFX3D, "vdd", "kgsl-3d0.0"),
Taniya Das43bcdd62011-12-02 17:33:27 +05301010};
1011unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);
1012
1013/* MSM8625 Devices */
1014
1015static struct resource msm8625_resources_uart1[] = {
1016 {
1017 .start = MSM8625_INT_UART1,
1018 .end = MSM8625_INT_UART1,
1019 .flags = IORESOURCE_IRQ,
1020 },
1021 {
Taniya Das13b811a2011-12-09 18:33:45 +05301022 .start = MSM7XXX_UART1_PHYS,
1023 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Taniya Das43bcdd62011-12-02 17:33:27 +05301024 .flags = IORESOURCE_MEM,
1025 },
1026};
1027
1028struct platform_device msm8625_device_uart1 = {
1029 .name = "msm_serial",
1030 .id = 0,
1031 .num_resources = ARRAY_SIZE(msm8625_resources_uart1),
1032 .resource = msm8625_resources_uart1,
1033};
1034
Trilok Soni269fff42012-02-13 20:35:30 +05301035static struct resource msm8625_uart1_dm_resources[] = {
1036 {
1037 .start = MSM_UART1DM_PHYS,
1038 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
1039 .flags = IORESOURCE_MEM,
1040 },
1041 {
1042 .start = MSM8625_INT_UART1DM_IRQ,
1043 .end = MSM8625_INT_UART1DM_IRQ,
1044 .flags = IORESOURCE_IRQ,
1045 },
1046 {
1047 .start = MSM8625_INT_UART1DM_RX,
1048 .end = MSM8625_INT_UART1DM_RX,
1049 .flags = IORESOURCE_IRQ,
1050 },
1051 {
1052 .start = DMOV_HSUART1_TX_CHAN,
1053 .end = DMOV_HSUART1_RX_CHAN,
1054 .name = "uartdm_channels",
1055 .flags = IORESOURCE_DMA,
1056 },
1057 {
1058 .start = DMOV_HSUART1_TX_CRCI,
1059 .end = DMOV_HSUART1_RX_CRCI,
1060 .name = "uartdm_crci",
1061 .flags = IORESOURCE_DMA,
1062 },
1063};
1064
1065struct platform_device msm8625_device_uart_dm1 = {
1066 .name = "msm_serial_hs",
1067 .id = 0,
1068 .num_resources = ARRAY_SIZE(msm8625_uart1_dm_resources),
1069 .resource = msm8625_uart1_dm_resources,
1070 .dev = {
1071 .dma_mask = &msm_uart_dm1_dma_mask,
1072 .coherent_dma_mask = DMA_BIT_MASK(32),
1073 },
1074};
1075
1076static struct resource msm8625_uart2dm_resources[] = {
1077 {
1078 .start = MSM_UART2DM_PHYS,
1079 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
1080 .name = "uartdm_resource",
1081 .flags = IORESOURCE_MEM,
1082 },
1083 {
1084 .start = MSM8625_INT_UART2DM_IRQ,
1085 .end = MSM8625_INT_UART2DM_IRQ,
1086 .flags = IORESOURCE_IRQ,
1087 },
1088};
1089
1090struct platform_device msm8625_device_uart_dm2 = {
1091 .name = "msm_serial_hsl",
1092 .id = 0,
1093 .num_resources = ARRAY_SIZE(msm8625_uart2dm_resources),
1094 .resource = msm8625_uart2dm_resources,
1095};
1096
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +05301097static struct resource msm8625_resources_adsp[] = {
1098 {
1099 .start = MSM8625_INT_ADSP_A9_A11,
1100 .end = MSM8625_INT_ADSP_A9_A11,
1101 .flags = IORESOURCE_IRQ,
1102 },
1103};
1104
1105struct platform_device msm8625_device_adsp = {
1106 .name = "msm_adsp",
1107 .id = -1,
1108 .num_resources = ARRAY_SIZE(msm8625_resources_adsp),
1109 .resource = msm8625_resources_adsp,
1110};
1111
Taniya Das43bcdd62011-12-02 17:33:27 +05301112static struct resource msm8625_dmov_resource[] = {
1113 {
1114 .start = MSM8625_INT_ADM_AARM,
1115 .flags = IORESOURCE_IRQ,
1116 },
1117 {
1118 .start = 0xA9700000,
1119 .end = 0xA9700000 + SZ_4K - 1,
1120 .flags = IORESOURCE_MEM,
1121 },
1122};
1123
1124struct platform_device msm8625_device_dmov = {
1125 .name = "msm_dmov",
1126 .id = -1,
1127 .resource = msm8625_dmov_resource,
1128 .num_resources = ARRAY_SIZE(msm8625_dmov_resource),
1129 .dev = {
1130 .platform_data = &msm_dmov_pdata,
1131 },
1132};
Taniya Das2e948192011-12-20 11:15:13 +05301133
Taniya Das9d187142011-12-02 15:53:25 +05301134static struct resource gsbi0_msm8625_qup_resources[] = {
1135 {
1136 .name = "qup_phys_addr",
1137 .start = MSM_GSBI0_QUP_PHYS,
1138 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
1139 .flags = IORESOURCE_MEM,
1140 },
1141 {
1142 .name = "gsbi_qup_i2c_addr",
1143 .start = MSM_GSBI0_PHYS,
1144 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
1145 .flags = IORESOURCE_MEM,
1146 },
1147 {
1148 .name = "qup_err_intr",
1149 .start = MSM8625_INT_PWB_I2C,
1150 .end = MSM8625_INT_PWB_I2C,
1151 .flags = IORESOURCE_IRQ,
1152 },
1153};
1154
1155/* Use GSBI0 QUP for /dev/i2c-0 */
Taniya Dase3027e22012-02-27 16:32:27 +05301156struct platform_device msm8625_gsbi0_qup_i2c_device = {
Taniya Das9d187142011-12-02 15:53:25 +05301157 .name = "qup_i2c",
1158 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
1159 .num_resources = ARRAY_SIZE(gsbi0_msm8625_qup_resources),
1160 .resource = gsbi0_msm8625_qup_resources,
1161};
1162
Trilok Soni633e59c2012-02-13 20:28:30 +05301163static struct resource gsbi1_msm8625_qup_i2c_resources[] = {
1164 {
1165 .name = "qup_phys_addr",
1166 .start = MSM_GSBI1_QUP_PHYS,
1167 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
1168 .flags = IORESOURCE_MEM,
1169 },
1170 {
1171 .name = "gsbi_qup_i2c_addr",
1172 .start = MSM_GSBI1_PHYS,
1173 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
1174 .flags = IORESOURCE_MEM,
1175 },
1176 {
1177 .name = "qup_err_intr",
1178 .start = MSM8625_INT_ARM11_DMA,
1179 .end = MSM8625_INT_ARM11_DMA,
1180 .flags = IORESOURCE_IRQ,
1181 },
1182};
1183
1184/* Use GSBI1 QUP for /dev/i2c-1 */
Taniya Dase3027e22012-02-27 16:32:27 +05301185struct platform_device msm8625_gsbi1_qup_i2c_device = {
Trilok Soni633e59c2012-02-13 20:28:30 +05301186 .name = "qup_i2c",
1187 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
1188 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
1189 .resource = gsbi1_msm8625_qup_i2c_resources,
1190};
1191
Taniya Das6684d622012-01-12 10:29:09 +05301192static struct resource msm8625_gpio_resources[] = {
1193 {
1194 .start = MSM8625_INT_GPIO_GROUP1,
1195 .flags = IORESOURCE_IRQ,
1196 },
1197 {
1198 .start = MSM8625_INT_GPIO_GROUP2,
1199 .flags = IORESOURCE_IRQ,
1200 },
1201};
1202
1203static struct platform_device msm8625_device_gpio = {
1204 .name = "msmgpio",
1205 .id = -1,
1206 .resource = msm8625_gpio_resources,
1207 .num_resources = ARRAY_SIZE(msm8625_gpio_resources),
1208};
1209
Trilok Soniee75f6c2012-02-13 20:45:07 +05301210static struct resource msm8625_resources_sdc1[] = {
1211 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301212 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301213 .start = MSM_SDC1_BASE,
1214 .end = MSM_SDC1_BASE + SZ_4K - 1,
1215 .flags = IORESOURCE_MEM,
1216 },
1217 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301218 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301219 .start = MSM8625_INT_SDC1_0,
1220 .end = MSM8625_INT_SDC1_1,
1221 .flags = IORESOURCE_IRQ,
1222 },
1223 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301224 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301225 .start = DMOV_SDC1_CHAN,
1226 .end = DMOV_SDC1_CHAN,
1227 .flags = IORESOURCE_DMA,
1228 },
1229 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301230 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301231 .start = DMOV_SDC1_CRCI,
1232 .end = DMOV_SDC1_CRCI,
1233 .flags = IORESOURCE_DMA,
1234 }
1235};
1236
1237static struct resource msm8625_resources_sdc2[] = {
1238 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301239 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301240 .start = MSM_SDC2_BASE,
1241 .end = MSM_SDC2_BASE + SZ_4K - 1,
1242 .flags = IORESOURCE_MEM,
1243 },
1244 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301245 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301246 .start = MSM8625_INT_SDC2_0,
1247 .end = MSM8625_INT_SDC2_1,
1248 .flags = IORESOURCE_IRQ,
1249 },
1250 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301251 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301252 .start = DMOV_SDC2_CHAN,
1253 .end = DMOV_SDC2_CHAN,
1254 .flags = IORESOURCE_DMA,
1255 },
1256 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301257 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301258 .start = DMOV_SDC2_CRCI,
1259 .end = DMOV_SDC2_CRCI,
1260 .flags = IORESOURCE_DMA,
1261 }
1262};
1263
1264static struct resource msm8625_resources_sdc3[] = {
1265 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301266 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301267 .start = MSM_SDC3_BASE,
1268 .end = MSM_SDC3_BASE + SZ_4K - 1,
1269 .flags = IORESOURCE_MEM,
1270 },
1271 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301272 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301273 .start = MSM8625_INT_SDC3_0,
1274 .end = MSM8625_INT_SDC3_1,
1275 .flags = IORESOURCE_IRQ,
1276 },
1277 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301278 .name = "dma_chnl",
Pratibhasagar Vc483d202012-08-21 14:37:17 +05301279 .start = DMOV_NAND_CHAN,
1280 .end = DMOV_NAND_CHAN,
Trilok Soniee75f6c2012-02-13 20:45:07 +05301281 .flags = IORESOURCE_DMA,
1282 },
1283 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301284 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301285 .start = DMOV_SDC3_CRCI,
1286 .end = DMOV_SDC3_CRCI,
1287 .flags = IORESOURCE_DMA,
1288 },
1289};
1290
1291static struct resource msm8625_resources_sdc4[] = {
1292 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301293 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301294 .start = MSM_SDC4_BASE,
1295 .end = MSM_SDC4_BASE + SZ_4K - 1,
1296 .flags = IORESOURCE_MEM,
1297 },
1298 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301299 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301300 .start = MSM8625_INT_SDC4_0,
1301 .end = MSM8625_INT_SDC4_1,
1302 .flags = IORESOURCE_IRQ,
1303 },
1304 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301305 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301306 .start = DMOV_SDC4_CHAN,
1307 .end = DMOV_SDC4_CHAN,
1308 .flags = IORESOURCE_DMA,
1309 },
1310 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301311 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301312 .start = DMOV_SDC4_CRCI,
1313 .end = DMOV_SDC4_CRCI,
1314 .flags = IORESOURCE_DMA,
1315 },
1316};
1317
1318struct platform_device msm8625_device_sdc1 = {
1319 .name = "msm_sdcc",
1320 .id = 1,
1321 .num_resources = ARRAY_SIZE(msm8625_resources_sdc1),
1322 .resource = msm8625_resources_sdc1,
1323 .dev = {
1324 .coherent_dma_mask = 0xffffffff,
1325 },
1326};
1327
1328struct platform_device msm8625_device_sdc2 = {
1329 .name = "msm_sdcc",
1330 .id = 2,
1331 .num_resources = ARRAY_SIZE(msm8625_resources_sdc2),
1332 .resource = msm8625_resources_sdc2,
1333 .dev = {
1334 .coherent_dma_mask = 0xffffffff,
1335 },
1336};
1337
1338struct platform_device msm8625_device_sdc3 = {
1339 .name = "msm_sdcc",
1340 .id = 3,
1341 .num_resources = ARRAY_SIZE(msm8625_resources_sdc3),
1342 .resource = msm8625_resources_sdc3,
1343 .dev = {
1344 .coherent_dma_mask = 0xffffffff,
1345 },
1346};
1347
1348struct platform_device msm8625_device_sdc4 = {
1349 .name = "msm_sdcc",
1350 .id = 4,
1351 .num_resources = ARRAY_SIZE(msm8625_resources_sdc4),
1352 .resource = msm8625_resources_sdc4,
1353 .dev = {
1354 .coherent_dma_mask = 0xffffffff,
1355 },
1356};
1357
1358static struct platform_device *msm8625_sdcc_devices[] __initdata = {
1359 &msm8625_device_sdc1,
1360 &msm8625_device_sdc2,
1361 &msm8625_device_sdc3,
1362 &msm8625_device_sdc4,
1363};
1364
1365int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
1366{
1367 struct platform_device *pdev;
1368
1369 if (controller < 1 || controller > 4)
1370 return -EINVAL;
1371
1372 if (cpu_is_msm8625())
1373 pdev = msm8625_sdcc_devices[controller-1];
1374 else
1375 pdev = msm_sdcc_devices[controller-1];
1376
1377 pdev->dev.platform_data = plat;
1378 return platform_device_register(pdev);
1379}
1380
Trilok Sonida63a8b2012-02-13 20:50:03 +05301381static struct resource msm8625_resources_hsusb_otg[] = {
1382 {
1383 .start = MSM_HSUSB_PHYS,
1384 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1385 .flags = IORESOURCE_MEM,
1386 },
1387 {
1388 .start = MSM8625_INT_USB_HS,
1389 .end = MSM8625_INT_USB_HS,
1390 .flags = IORESOURCE_IRQ,
1391 },
1392};
1393
1394struct platform_device msm8625_device_otg = {
1395 .name = "msm_otg",
1396 .id = -1,
1397 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_otg),
1398 .resource = msm8625_resources_hsusb_otg,
1399 .dev = {
1400 .dma_mask = &dma_mask,
1401 .coherent_dma_mask = 0xffffffffULL,
1402 },
1403};
1404
1405static struct resource msm8625_resources_gadget_peripheral[] = {
1406 {
1407 .start = MSM_HSUSB_PHYS,
1408 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1409 .flags = IORESOURCE_MEM,
1410 },
1411 {
1412 .start = MSM8625_INT_USB_HS,
1413 .end = MSM8625_INT_USB_HS,
1414 .flags = IORESOURCE_IRQ,
1415 },
1416};
1417
1418struct platform_device msm8625_device_gadget_peripheral = {
1419 .name = "msm_hsusb",
1420 .id = -1,
1421 .num_resources = ARRAY_SIZE(msm8625_resources_gadget_peripheral),
1422 .resource = msm8625_resources_gadget_peripheral,
1423 .dev = {
1424 .dma_mask = &dma_mask,
1425 .coherent_dma_mask = 0xffffffffULL,
1426 },
1427};
1428
1429static struct resource msm8625_resources_hsusb_host[] = {
1430 {
1431 .start = MSM_HSUSB_PHYS,
1432 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1433 .flags = IORESOURCE_MEM,
1434 },
1435 {
1436 .start = MSM8625_INT_USB_HS,
1437 .end = MSM8625_INT_USB_HS,
1438 .flags = IORESOURCE_IRQ,
1439 },
1440};
1441
1442struct platform_device msm8625_device_hsusb_host = {
1443 .name = "msm_hsusb_host",
1444 .id = 0,
1445 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_host),
1446 .resource = msm8625_resources_hsusb_host,
1447 .dev = {
1448 .dma_mask = &dma_mask,
1449 .coherent_dma_mask = 0xffffffffULL,
1450 },
1451};
1452
1453static struct platform_device *msm8625_host_devices[] = {
1454 &msm8625_device_hsusb_host,
1455};
1456
1457int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
1458{
1459 struct platform_device *pdev;
1460
1461 if (cpu_is_msm8625())
1462 pdev = msm8625_host_devices[host];
1463 else
1464 pdev = msm_host_devices[host];
1465 if (!pdev)
1466 return -ENODEV;
1467 pdev->dev.platform_data = plat;
1468 return platform_device_register(pdev);
1469}
1470
Trilok Soni88da2552012-02-13 21:01:24 +05301471#ifdef CONFIG_MSM_CAMERA_V4L2
1472static struct resource msm8625_csic0_resources[] = {
1473 {
1474 .name = "csic",
1475 .start = 0xA0F00000,
1476 .end = 0xA0F00000 + 0x00100000 - 1,
1477 .flags = IORESOURCE_MEM,
1478 },
1479 {
1480 .name = "csic",
1481 .start = MSM8625_INT_CSI_IRQ_0,
1482 .end = MSM8625_INT_CSI_IRQ_0,
1483 .flags = IORESOURCE_IRQ,
1484 },
1485};
1486
1487static struct resource msm8625_csic1_resources[] = {
1488 {
1489 .name = "csic",
1490 .start = 0xA1000000,
1491 .end = 0xA1000000 + 0x00100000 - 1,
1492 .flags = IORESOURCE_MEM,
1493 },
1494 {
1495 .name = "csic",
1496 .start = MSM8625_INT_CSI_IRQ_1,
1497 .end = MSM8625_INT_CSI_IRQ_1,
1498 .flags = IORESOURCE_IRQ,
1499 },
1500};
1501
1502struct platform_device msm8625_device_csic0 = {
1503 .name = "msm_csic",
1504 .id = 0,
1505 .resource = msm8625_csic0_resources,
1506 .num_resources = ARRAY_SIZE(msm8625_csic0_resources),
1507};
1508
1509struct platform_device msm8625_device_csic1 = {
1510 .name = "msm_csic",
1511 .id = 1,
1512 .resource = msm8625_csic1_resources,
1513 .num_resources = ARRAY_SIZE(msm8625_csic1_resources),
1514};
1515#endif
1516
Trilok Soniae4633d2012-02-13 21:08:32 +05301517static struct resource msm8625_mipi_dsi_resources[] = {
1518 {
1519 .name = "mipi_dsi",
1520 .start = MIPI_DSI_HW_BASE,
1521 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
1522 .flags = IORESOURCE_MEM,
1523 },
1524 {
1525 .start = MSM8625_INT_DSI_IRQ,
1526 .end = MSM8625_INT_DSI_IRQ,
1527 .flags = IORESOURCE_IRQ,
1528 },
1529};
1530
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301531static struct platform_device msm8625_mipi_dsi_device = {
Trilok Soniae4633d2012-02-13 21:08:32 +05301532 .name = "mipi_dsi",
1533 .id = 1,
1534 .num_resources = ARRAY_SIZE(msm8625_mipi_dsi_resources),
1535 .resource = msm8625_mipi_dsi_resources,
1536};
1537
1538static struct resource msm8625_mdp_resources[] = {
1539 {
1540 .name = "mdp",
1541 .start = MDP_BASE,
1542 .end = MDP_BASE + 0x000F1008 - 1,
1543 .flags = IORESOURCE_MEM,
1544 },
1545 {
1546 .start = MSM8625_INT_MDP,
1547 .end = MSM8625_INT_MDP,
1548 .flags = IORESOURCE_IRQ,
1549 },
1550};
1551
1552static struct platform_device msm8625_mdp_device = {
1553 .name = "mdp",
1554 .id = 0,
1555 .num_resources = ARRAY_SIZE(msm8625_mdp_resources),
1556 .resource = msm8625_mdp_resources,
1557};
1558
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301559struct platform_device mipi_dsi_device;
1560
Trilok Soniae4633d2012-02-13 21:08:32 +05301561void __init msm_fb_register_device(char *name, void *data)
1562{
1563 if (!strncmp(name, "mdp", 3)) {
1564 if (cpu_is_msm8625())
1565 msm_register_device(&msm8625_mdp_device, data);
1566 else
1567 msm_register_device(&msm_mdp_device, data);
1568 } else if (!strncmp(name, "mipi_dsi", 8)) {
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301569 if (cpu_is_msm8625()) {
Trilok Soniae4633d2012-02-13 21:08:32 +05301570 msm_register_device(&msm8625_mipi_dsi_device, data);
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301571 mipi_dsi_device = msm8625_mipi_dsi_device;
1572 } else {
Trilok Soniae4633d2012-02-13 21:08:32 +05301573 msm_register_device(&msm_mipi_dsi_device, data);
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301574 mipi_dsi_device = msm_mipi_dsi_device;
1575 }
Trilok Soniae4633d2012-02-13 21:08:32 +05301576 } else if (!strncmp(name, "lcdc", 4)) {
1577 msm_register_device(&msm_lcdc_device, data);
1578 } else {
1579 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
1580 }
1581}
1582
Trilok Soni664b95d2012-02-13 21:13:15 +05301583static struct resource msm8625_kgsl_3d0_resources[] = {
1584 {
1585 .name = KGSL_3D0_REG_MEMORY,
1586 .start = 0xA0000000,
1587 .end = 0xA001ffff,
1588 .flags = IORESOURCE_MEM,
1589 },
1590 {
1591 .name = KGSL_3D0_IRQ,
1592 .start = MSM8625_INT_GRAPHICS,
1593 .end = MSM8625_INT_GRAPHICS,
1594 .flags = IORESOURCE_IRQ,
1595 },
1596};
1597
1598struct platform_device msm8625_kgsl_3d0 = {
1599 .name = "kgsl-3d0",
1600 .id = 0,
1601 .num_resources = ARRAY_SIZE(msm8625_kgsl_3d0_resources),
1602 .resource = msm8625_kgsl_3d0_resources,
1603 .dev = {
1604 .platform_data = &kgsl_3d0_pdata,
1605 },
1606};
1607
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301608enum {
1609 MSM8625,
1610 MSM8625A,
1611 MSM8625AB,
1612};
1613
1614static int __init msm8625_cpu_id(void)
1615{
1616 int raw_id, cpu;
1617
1618 raw_id = socinfo_get_raw_id();
1619 switch (raw_id) {
1620 /* Part number for 1GHz part */
1621 case 0x770:
1622 case 0x771:
1623 case 0x77C:
1624 case 0x780:
1625 case 0x8D0:
1626 cpu = MSM8625;
1627 break;
1628 /* Part number for 1.2GHz part */
1629 case 0x773:
1630 case 0x774:
1631 case 0x781:
1632 case 0x8D1:
1633 cpu = MSM8625A;
1634 break;
1635 case 0x775:
1636 case 0x776:
Kaushal Kumar5b700f32012-09-05 16:50:19 +05301637 case 0x779:
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301638 case 0x77D:
1639 case 0x782:
1640 case 0x8D2:
1641 cpu = MSM8625AB;
1642 break;
1643 default:
1644 pr_err("Invalid Raw ID\n");
1645 return -ENODEV;
1646 }
1647 return cpu;
1648}
1649
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301650static struct resource cpr_resources[] = {
1651 {
1652 .start = MSM8625_INT_CPR_IRQ0,
1653 .flags = IORESOURCE_IRQ,
1654 },
1655 {
1656 .start = MSM8625_CPR_PHYS,
1657 .end = MSM8625_CPR_PHYS + SZ_4K - 1,
1658 .flags = IORESOURCE_MEM,
1659 },
1660};
1661
1662/**
1663 * These are various Vdd levels supported by PMIC
1664 */
1665static uint32_t msm_c2_pmic_mv[] __initdata = {
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301666 1300000, 1287500, 1275000, 1262500, 1250000,
1667 1237500, 1225000, 1212500, 1200000, 1187500,
1668 1175000, 1162500, 1150000, 1137500, 1125000,
1669 1112500, 1100000, 1087500, 1075000, 1062500,
1670 1050000, 1037500, 1025000, 1012500, 0, 0, 0,
1671 0, 0, 0, 0, 1000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301672};
1673
1674/**
1675 * This data will be based on CPR mode of operation
1676 */
1677static struct msm_cpr_mode msm_cpr_mode_data[] = {
1678 [NORMAL_MODE] = {
1679 .ring_osc_data = {
1680 {0, },
1681 {0, },
1682 {0, },
1683 {0, },
1684 {0, },
1685 {0, },
1686 {0, },
1687 {0, },
1688 },
1689 .ring_osc = 0,
1690 .step_quot = ~0,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301691 .tgt_volt_offset = 0,
Trilok Sonidb64ae92012-09-02 02:09:04 +05301692 .nom_Vmax = 1350000,
1693 .nom_Vmin = 1250000,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301694 .calibrated_uV = 1100000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301695 },
1696 [TURBO_MODE] = {
1697 .ring_osc_data = {
1698 {0, },
1699 {0, },
1700 {0, },
1701 {0, },
1702 {0, },
1703 {0, },
1704 {0, },
1705 {0, },
1706 },
1707 .ring_osc = 0,
1708 .step_quot = ~0,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301709 .tgt_volt_offset = 0,
Trilok Sonidb64ae92012-09-02 02:09:04 +05301710 .turbo_Vmax = 1350000,
Kaushal Kumarddd521c2012-09-18 19:50:53 +05301711 .turbo_Vmin = 1200000,
Trilok Sonidb64ae92012-09-02 02:09:04 +05301712 .nom_Vmax = 1350000,
Kaushal Kumarddd521c2012-09-18 19:50:53 +05301713 .nom_Vmin = 1050000,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301714 .calibrated_uV = 1300000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301715 },
1716};
1717
1718struct msm_cpr_vp_data vp_data = {
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301719 .min_volt = 1000000,
1720 .max_volt = 1350000,
1721 .default_volt = 1300000,
1722 .step_size = 12500,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301723};
1724
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301725static uint32_t
1726msm_cpr_get_quot(uint32_t max_quot, uint32_t max_freq, uint32_t new_freq)
1727{
1728 uint32_t quot;
1729
1730 /* This formula is as per chip characterization data */
Kaushal Kumarddd521c2012-09-18 19:50:53 +05301731 quot = max_quot - (((max_freq - new_freq) * 7) / 10);
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301732
1733 return quot;
1734}
1735
1736static void msm_cpr_clk_enable(void)
1737{
1738 uint32_t reg_val;
1739
1740 /* Select TCXO (19.2MHz) as clock source */
1741 reg_val = readl_relaxed(A11S_TEST_BUS_SEL_ADDR);
1742 reg_val |= RBCPR_CLK_MUX_SEL;
1743 writel_relaxed(reg_val, A11S_TEST_BUS_SEL_ADDR);
1744
1745 /* Get CPR out of reset */
1746 writel_relaxed(0x1, RBCPR_SW_RESET_N);
1747}
1748
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301749static struct msm_cpr_config msm_cpr_pdata = {
1750 .ref_clk_khz = 19200,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301751 .delay_us = 25000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301752 .irq_line = 0,
1753 .cpr_mode_data = msm_cpr_mode_data,
1754 .tgt_count_div_N = 1,
1755 .floor = 0,
1756 .ceiling = 40,
1757 .sw_vlevel = 20,
1758 .up_threshold = 1,
Kaushal Kumar210c2f32012-09-18 19:42:05 +05301759 .dn_threshold = 3,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301760 .up_margin = 0,
1761 .dn_margin = 0,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301762 .max_nom_freq = 700800,
1763 .max_freq = 1401600,
1764 .max_quot = 0,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301765 .vp_data = &vp_data,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301766 .get_quot = msm_cpr_get_quot,
1767 .clk_enable = msm_cpr_clk_enable,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301768};
1769
1770static struct platform_device msm8625_device_cpr = {
1771 .name = "msm-cpr",
1772 .id = -1,
1773 .num_resources = ARRAY_SIZE(cpr_resources),
1774 .resource = cpr_resources,
1775 .dev = {
1776 .platform_data = &msm_cpr_pdata,
1777 },
1778};
1779
1780static struct platform_device msm8625_vp_device = {
1781 .name = "vp-regulator",
1782 .id = -1,
1783};
1784
1785static void __init msm_cpr_init(void)
1786{
1787 struct cpr_info_type *cpr_info = NULL;
1788 uint8_t ring_osc = 0;
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301789
1790 cpr_info = kzalloc(sizeof(struct cpr_info_type), GFP_KERNEL);
1791 if (!cpr_info) {
1792 pr_err("%s: Out of memory %d\n", __func__, -ENOMEM);
1793 return;
1794 }
1795
1796 msm_smem_get_cpr_info(cpr_info);
1797
1798 /**
1799 * Set the ring_osc based on efuse BIT(0)
1800 * CPR_fuse[0] = 0 selects 2nd RO (010)
1801 * CPR_fuse[0] = 1 select 3rd RO (011)
1802 */
1803 if (cpr_info->ring_osc == 0x0)
1804 ring_osc = 0x2;
1805 else if (cpr_info->ring_osc == 0x1)
1806 ring_osc = 0x3;
1807
1808 msm_cpr_mode_data[TURBO_MODE].ring_osc = ring_osc;
1809 msm_cpr_mode_data[NORMAL_MODE].ring_osc = ring_osc;
1810
1811 /* GCNT = 1000 nsec/52nsec (@TCX0=19.2Mhz) = 19.2 */
1812 msm_cpr_mode_data[TURBO_MODE].ring_osc_data[ring_osc].gcnt = 19;
1813 msm_cpr_mode_data[NORMAL_MODE].ring_osc_data[ring_osc].gcnt = 19;
1814
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301815 /**
1816 * The scaling factor and offset are as per chip characterization data
1817 * This formula is used since available fuse bits in the chip are not
1818 * enough to represent the value of maximum quot
1819 */
Trilok Soni7f311172012-09-02 15:15:33 +05301820 msm_cpr_pdata.max_quot = cpr_info->turbo_quot * 10 + 600;
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301821
1822 /**
1823 * Bits 4:0 of pvs_fuse provide mapping to the safe boot up voltage.
1824 * Boot up mode is by default Turbo.
1825 */
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301826 msm_cpr_mode_data[TURBO_MODE].calibrated_uV =
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301827 msm_c2_pmic_mv[cpr_info->pvs_fuse & 0x1F];
1828
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301829 pr_debug("%s: cpr: ring_osc: 0x%x\n", __func__,
1830 msm_cpr_mode_data[TURBO_MODE].ring_osc);
1831 pr_debug("%s: cpr: turbo_quot: 0x%x\n", __func__, cpr_info->turbo_quot);
1832 pr_debug("%s: cpr: pvs_fuse: 0x%x\n", __func__, cpr_info->pvs_fuse);
1833 kfree(cpr_info);
1834
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301835 if (msm8625_cpu_id() == MSM8625A)
1836 msm_cpr_pdata.max_freq = 1209600;
1837 else if (msm8625_cpu_id() == MSM8625)
1838 msm_cpr_pdata.max_freq = 1008000;
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301839
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301840 msm_cpr_clk_enable();
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301841
1842 platform_device_register(&msm8625_vp_device);
1843 platform_device_register(&msm8625_device_cpr);
1844}
1845
Taniya Das7c9f0512011-12-02 14:26:46 +05301846static struct clk_lookup msm_clock_8625_dummy[] = {
1847 CLK_DUMMY("core_clk", adm_clk.c, "msm_dmov", 0),
1848 CLK_DUMMY("adsp_clk", adsp_clk.c, NULL, 0),
1849 CLK_DUMMY("ahb_m_clk", ahb_m_clk.c, NULL, 0),
1850 CLK_DUMMY("ahb_s_clk", ahb_s_clk.c, NULL, 0),
1851 CLK_DUMMY("cam_m_clk", cam_m_clk.c, NULL, 0),
1852 CLK_DUMMY("csi_clk", csi1_clk.c, NULL, 0),
1853 CLK_DUMMY("csi_pclk", csi1_p_clk.c, NULL, 0),
1854 CLK_DUMMY("csi_vfe_clk", csi1_vfe_clk.c, NULL, 0),
1855 CLK_DUMMY("dsi_byte_clk", dsi_byte_clk.c, NULL, 0),
1856 CLK_DUMMY("dsi_clk", dsi_clk.c, NULL, 0),
1857 CLK_DUMMY("dsi_esc_clk", dsi_esc_clk.c, NULL, 0),
1858 CLK_DUMMY("dsi_pixel_clk", dsi_pixel_clk.c, NULL, 0),
1859 CLK_DUMMY("dsi_ref_clk", dsi_ref_clk.c, NULL, 0),
1860 CLK_DUMMY("ebi1_clk", ebi1_clk.c, NULL, 0),
1861 CLK_DUMMY("ebi2_clk", ebi2_clk.c, NULL, 0),
1862 CLK_DUMMY("ecodec_clk", ecodec_clk.c, NULL, 0),
1863 CLK_DUMMY("gp_clk", gp_clk.c, NULL, 0),
1864 CLK_DUMMY("core_clk", gsbi1_qup_clk.c, "qup_i2c.0", 0),
1865 CLK_DUMMY("core_clk", gsbi2_qup_clk.c, "qup_i2c.1", 0),
1866 CLK_DUMMY("iface_clk", gsbi1_qup_p_clk.c, "qup_i2c.0", 0),
1867 CLK_DUMMY("iface_clk", gsbi2_qup_p_clk.c, "qup_i2c.1", 0),
1868 CLK_DUMMY("icodec_rx_clk", icodec_rx_clk.c, NULL, 0),
1869 CLK_DUMMY("icodec_tx_clk", icodec_tx_clk.c, NULL, 0),
1870 CLK_DUMMY("mem_clk", imem_clk.c, NULL, 0),
1871 CLK_DUMMY("mddi_clk", pmdh_clk.c, NULL, 0),
1872 CLK_DUMMY("mdp_clk", mdp_clk.c, NULL, 0),
1873 CLK_DUMMY("mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk.c, NULL, 0),
1874 CLK_DUMMY("mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk.c, NULL, 0),
1875 CLK_DUMMY("mdp_vsync_clk", mdp_vsync_clk.c, NULL, 0),
1876 CLK_DUMMY("mdp_dsi_pclk", mdp_dsi_p_clk.c, NULL, 0),
1877 CLK_DUMMY("pbus_clk", pbus_clk.c, NULL, 0),
1878 CLK_DUMMY("pcm_clk", pcm_clk.c, NULL, 0),
1879 CLK_DUMMY("sdac_clk", sdac_clk.c, NULL, 0),
1880 CLK_DUMMY("core_clk", sdc1_clk.c, "msm_sdcc.1", 0),
1881 CLK_DUMMY("iface_clk", sdc1_p_clk.c, "msm_sdcc.1", 0),
1882 CLK_DUMMY("core_clk", sdc2_clk.c, "msm_sdcc.2", 0),
1883 CLK_DUMMY("iface_clk", sdc2_p_clk.c, "msm_sdcc.2", 0),
1884 CLK_DUMMY("core_clk", sdc3_clk.c, "msm_sdcc.3", 0),
1885 CLK_DUMMY("iface_clk", sdc3_p_clk.c, "msm_sdcc.3", 0),
1886 CLK_DUMMY("core_clk", sdc4_clk.c, "msm_sdcc.4", 0),
1887 CLK_DUMMY("iface_clk", sdc4_p_clk.c, "msm_sdcc.4", 0),
1888 CLK_DUMMY("ref_clk", tsif_ref_clk.c, "msm_tsif.0", 0),
1889 CLK_DUMMY("iface_clk", tsif_p_clk.c, "msm_tsif.0", 0),
1890 CLK_DUMMY("core_clk", uart1_clk.c, "msm_serial.0", 0),
1891 CLK_DUMMY("core_clk", uart2_clk.c, "msm_serial.1", 0),
1892 CLK_DUMMY("core_clk", uart1dm_clk.c, "msm_serial_hs.0", 0),
1893 CLK_DUMMY("core_clk", uart2dm_clk.c, "msm_serial_hsl.0", 0),
1894 CLK_DUMMY("usb_hs_core_clk", usb_hs_core_clk.c, NULL, 0),
1895 CLK_DUMMY("usb_hs2_clk", usb_hs2_clk.c, NULL, 0),
1896 CLK_DUMMY("usb_hs_clk", usb_hs_clk.c, NULL, 0),
1897 CLK_DUMMY("usb_hs_pclk", usb_hs_p_clk.c, NULL, 0),
1898 CLK_DUMMY("usb_phy_clk", usb_phy_clk.c, NULL, 0),
1899 CLK_DUMMY("vdc_clk", vdc_clk.c, NULL, 0),
1900 CLK_DUMMY("ebi1_acpu_clk", ebi_acpu_clk.c, NULL, 0),
1901 CLK_DUMMY("ebi1_lcdc_clk", ebi_lcdc_clk.c, NULL, 0),
1902 CLK_DUMMY("ebi1_mddi_clk", ebi_mddi_clk.c, NULL, 0),
1903 CLK_DUMMY("ebi1_usb_clk", ebi_usb_clk.c, NULL, 0),
1904 CLK_DUMMY("ebi1_vfe_clk", ebi_vfe_clk.c, NULL, 0),
1905 CLK_DUMMY("mem_clk", ebi_adm_clk.c, "msm_dmov", 0),
1906};
1907
1908struct clock_init_data msm8625_dummy_clock_init_data __initdata = {
1909 .table = msm_clock_8625_dummy,
1910 .size = ARRAY_SIZE(msm_clock_8625_dummy),
1911};
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301912
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001913int __init msm7x2x_misc_init(void)
1914{
Taniya Das7c9f0512011-12-02 14:26:46 +05301915 if (machine_is_msm8625_rumi3()) {
1916 msm_clock_init(&msm8625_dummy_clock_init_data);
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301917 msm_cpr_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301918 return 0;
Taniya Das7c9f0512011-12-02 14:26:46 +05301919 }
Taniya Das43bcdd62011-12-02 17:33:27 +05301920
Stephen Boydbb600ae2011-08-02 20:11:40 -07001921 msm_clock_init(&msm7x27a_clock_init_data);
Pankaj Kumarfee56a82012-04-17 14:26:49 +05301922 if (cpu_is_msm7x27aa() || cpu_is_msm7x25ab())
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001923 platform_device_register(&msm7x27aa_device_acpuclk);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301924 else if (cpu_is_msm8625()) {
1925 if (msm8625_cpu_id() == MSM8625)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001926 platform_device_register(&msm7x27aa_device_acpuclk);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301927 else if (msm8625_cpu_id() == MSM8625A)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001928 platform_device_register(&msm8625_device_acpuclk);
Kaushal Kumar86473f02012-06-28 19:35:58 +05301929 else if (msm8625_cpu_id() == MSM8625AB)
1930 platform_device_register(&msm8625ab_device_acpuclk);
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001931 } else {
1932 platform_device_register(&msm7x27a_device_acpuclk);
1933 }
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301934
1935 if (cpu_is_msm8625() &&
1936 (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2))
1937 msm_cpr_init();
1938
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001939 return 0;
1940}
1941
1942#ifdef CONFIG_CACHE_L2X0
1943static int __init msm7x27x_cache_init(void)
1944{
1945 int aux_ctrl = 0;
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301946 int pctrl = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001947
1948 /* Way Size 010(0x2) 32KB */
1949 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
1950 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
1951 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
1952
Taniya Das379b5682011-12-02 14:53:46 +05301953 if (cpu_is_msm8625()) {
1954 /* Way Size 011(0x3) 64KB */
1955 aux_ctrl |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
1956 (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | \
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301957 (0X1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) | \
1958 (0x1 << L2X0_AUX_CTRL_L2_FORCE_NWA_SHIFT);
1959
1960 /* Write Prefetch Control settings */
1961 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
1962 pctrl |= (0x3 << L2X0_PREFETCH_CTRL_OFFSET_SHIFT) | \
1963 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_INC_SHIFT) | \
1964 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_SHIFT);
1965 writel_relaxed(pctrl , MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
Taniya Das379b5682011-12-02 14:53:46 +05301966 }
1967
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001968 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301969 if (cpu_is_msm8625()) {
1970 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
1971 pr_info("Prfetch Ctrl: 0x%08x\n", pctrl);
1972 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001973
1974 return 0;
1975}
1976#else
pankaj kumar80d7cb62011-08-23 13:37:55 +05301977static int __init msm7x27x_cache_init(void){ return 0; }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001978#endif
1979
1980void __init msm_common_io_init(void)
1981{
1982 msm_map_common_io();
Taniya Das43bcdd62011-12-02 17:33:27 +05301983 if (socinfo_init() < 0)
1984 pr_err("%s: socinfo_init() failed!\n", __func__);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001985 msm7x27x_cache_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301986}
1987
1988void __init msm8625_init_irq(void)
1989{
Trilok Soni1a9fdee2012-05-28 19:54:11 +05301990 msm_gic_irq_extn_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301991 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1992 (void *)MSM_QGIC_CPU_BASE);
Taniya Das43bcdd62011-12-02 17:33:27 +05301993}
1994
1995void __init msm8625_map_io(void)
1996{
1997 msm_map_msm8625_io();
1998
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001999 if (socinfo_init() < 0)
2000 pr_err("%s: socinfo_init() failed!\n", __func__);
Taniya Das379b5682011-12-02 14:53:46 +05302001 msm7x27x_cache_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002002}
2003
Taniya Das43bcdd62011-12-02 17:33:27 +05302004static int msm7627a_init_gpio(void)
2005{
Taniya Das6684d622012-01-12 10:29:09 +05302006 if (cpu_is_msm8625())
2007 platform_device_register(&msm8625_device_gpio);
2008 else
2009 platform_device_register(&msm_device_gpio);
Taniya Das43bcdd62011-12-02 17:33:27 +05302010 return 0;
2011}
2012postcore_initcall(msm7627a_init_gpio);
Taniya Das9d0c3c52012-05-04 14:40:55 +05302013
2014static int msm7627a_panic_handler(struct notifier_block *this,
2015 unsigned long event, void *ptr)
2016{
2017 flush_cache_all();
2018 outer_flush_all();
2019 return NOTIFY_DONE;
2020}
2021
2022static struct notifier_block panic_handler = {
2023 .notifier_call = msm7627a_panic_handler,
2024};
2025
2026static int __init panic_register(void)
2027{
2028 atomic_notifier_chain_register(&panic_notifier_list,
2029 &panic_handler);
2030 return 0;
2031}
2032module_init(panic_register);