blob: 2e5f89243005ccab155c5962337e1e4714b20446 [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 Kumar622828f2012-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 Kumar622828f2012-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 Nalajala0ac89b42012-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 Vankadara20cd3be2012-01-18 00:34:06 +0530684#ifdef CONFIG_MSM_CAMERA_V4L2
Suresh Vankadara6050cef52012-04-16 21:44:59 +0530685static int apps_reset;
Suresh Vankadara20cd3be2012-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 Vankadara20cd3be2012-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 Vankadara20cd3be2012-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
851static struct platform_device msm_lcdc_device = {
852 .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 Kalisamy24696322012-04-11 22:09:17 +0530921 /* 8x25 supports a higher GPU frequency */
Rajesh Kemisettid41dd802012-07-24 11:31:47 +0530922 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 320000000;
Ranjhith Kalisamy24696322012-04-11 22:09:17 +0530923 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 200000000;
Lynus Vazfe4bede2012-04-06 11:53:30 -0700924 }
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700925}
926
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700927static void __init msm_register_device(struct platform_device *pdev, void *data)
928{
929 int ret;
930
931 pdev->dev.platform_data = data;
932
933 ret = platform_device_register(pdev);
934
935 if (ret)
936 dev_err(&pdev->dev,
937 "%s: platform_device_register() failed = %d\n",
938 __func__, ret);
939}
940
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700941
942#define PERPH_WEB_BLOCK_ADDR (0xA9D00040)
943#define PDM0_CTL_OFFSET (0x04)
944#define SIZE_8B (0x08)
945
946static struct resource resources_led[] = {
947 {
948 .start = PERPH_WEB_BLOCK_ADDR,
949 .end = PERPH_WEB_BLOCK_ADDR + (SIZE_8B) - 1,
950 .name = "led-gpio-pdm",
951 .flags = IORESOURCE_MEM,
952 },
953};
954
955static struct led_info msm_kpbl_pdm_led_pdata = {
956 .name = "keyboard-backlight",
957};
958
959struct platform_device led_pdev = {
960 .name = "leds-msm-pdm",
961 /* use pdev id to represent pdm id */
962 .id = 0,
963 .num_resources = ARRAY_SIZE(resources_led),
964 .resource = resources_led,
965 .dev = {
966 .platform_data = &msm_kpbl_pdm_led_pdata,
967 },
968};
969
Manish Dewangan3a260992011-06-24 18:01:34 +0530970struct platform_device asoc_msm_pcm = {
971 .name = "msm-dsp-audio",
972 .id = 0,
973};
974
975struct platform_device asoc_msm_dai0 = {
976 .name = "msm-codec-dai",
977 .id = 0,
978};
979
980struct platform_device asoc_msm_dai1 = {
981 .name = "msm-cpu-dai",
982 .id = 0,
983};
984
Taniya Das2e948192011-12-20 11:15:13 +0530985static struct resource gpio_resources[] = {
986 {
987 .start = INT_GPIO_GROUP1,
988 .flags = IORESOURCE_IRQ,
989 },
990 {
991 .start = INT_GPIO_GROUP2,
992 .flags = IORESOURCE_IRQ,
993 },
994};
995
996static struct platform_device msm_device_gpio = {
997 .name = "msmgpio",
998 .id = -1,
999 .resource = gpio_resources,
1000 .num_resources = ARRAY_SIZE(gpio_resources),
1001};
1002
Taniya Das43bcdd62011-12-02 17:33:27 +05301003struct platform_device *msm_footswitch_devices[] = {
Matt Wagantalld6fbf232012-05-03 20:09:28 -07001004 FS_PCOM(FS_GFX3D, "vdd", "kgsl-3d0.0"),
Taniya Das43bcdd62011-12-02 17:33:27 +05301005};
1006unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);
1007
1008/* MSM8625 Devices */
1009
1010static struct resource msm8625_resources_uart1[] = {
1011 {
1012 .start = MSM8625_INT_UART1,
1013 .end = MSM8625_INT_UART1,
1014 .flags = IORESOURCE_IRQ,
1015 },
1016 {
Taniya Das13b811a2011-12-09 18:33:45 +05301017 .start = MSM7XXX_UART1_PHYS,
1018 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Taniya Das43bcdd62011-12-02 17:33:27 +05301019 .flags = IORESOURCE_MEM,
1020 },
1021};
1022
1023struct platform_device msm8625_device_uart1 = {
1024 .name = "msm_serial",
1025 .id = 0,
1026 .num_resources = ARRAY_SIZE(msm8625_resources_uart1),
1027 .resource = msm8625_resources_uart1,
1028};
1029
Trilok Soni269fff42012-02-13 20:35:30 +05301030static struct resource msm8625_uart1_dm_resources[] = {
1031 {
1032 .start = MSM_UART1DM_PHYS,
1033 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
1034 .flags = IORESOURCE_MEM,
1035 },
1036 {
1037 .start = MSM8625_INT_UART1DM_IRQ,
1038 .end = MSM8625_INT_UART1DM_IRQ,
1039 .flags = IORESOURCE_IRQ,
1040 },
1041 {
1042 .start = MSM8625_INT_UART1DM_RX,
1043 .end = MSM8625_INT_UART1DM_RX,
1044 .flags = IORESOURCE_IRQ,
1045 },
1046 {
1047 .start = DMOV_HSUART1_TX_CHAN,
1048 .end = DMOV_HSUART1_RX_CHAN,
1049 .name = "uartdm_channels",
1050 .flags = IORESOURCE_DMA,
1051 },
1052 {
1053 .start = DMOV_HSUART1_TX_CRCI,
1054 .end = DMOV_HSUART1_RX_CRCI,
1055 .name = "uartdm_crci",
1056 .flags = IORESOURCE_DMA,
1057 },
1058};
1059
1060struct platform_device msm8625_device_uart_dm1 = {
1061 .name = "msm_serial_hs",
1062 .id = 0,
1063 .num_resources = ARRAY_SIZE(msm8625_uart1_dm_resources),
1064 .resource = msm8625_uart1_dm_resources,
1065 .dev = {
1066 .dma_mask = &msm_uart_dm1_dma_mask,
1067 .coherent_dma_mask = DMA_BIT_MASK(32),
1068 },
1069};
1070
1071static struct resource msm8625_uart2dm_resources[] = {
1072 {
1073 .start = MSM_UART2DM_PHYS,
1074 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
1075 .name = "uartdm_resource",
1076 .flags = IORESOURCE_MEM,
1077 },
1078 {
1079 .start = MSM8625_INT_UART2DM_IRQ,
1080 .end = MSM8625_INT_UART2DM_IRQ,
1081 .flags = IORESOURCE_IRQ,
1082 },
1083};
1084
1085struct platform_device msm8625_device_uart_dm2 = {
1086 .name = "msm_serial_hsl",
1087 .id = 0,
1088 .num_resources = ARRAY_SIZE(msm8625_uart2dm_resources),
1089 .resource = msm8625_uart2dm_resources,
1090};
1091
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +05301092static struct resource msm8625_resources_adsp[] = {
1093 {
1094 .start = MSM8625_INT_ADSP_A9_A11,
1095 .end = MSM8625_INT_ADSP_A9_A11,
1096 .flags = IORESOURCE_IRQ,
1097 },
1098};
1099
1100struct platform_device msm8625_device_adsp = {
1101 .name = "msm_adsp",
1102 .id = -1,
1103 .num_resources = ARRAY_SIZE(msm8625_resources_adsp),
1104 .resource = msm8625_resources_adsp,
1105};
1106
Taniya Das43bcdd62011-12-02 17:33:27 +05301107static struct resource msm8625_dmov_resource[] = {
1108 {
1109 .start = MSM8625_INT_ADM_AARM,
1110 .flags = IORESOURCE_IRQ,
1111 },
1112 {
1113 .start = 0xA9700000,
1114 .end = 0xA9700000 + SZ_4K - 1,
1115 .flags = IORESOURCE_MEM,
1116 },
1117};
1118
1119struct platform_device msm8625_device_dmov = {
1120 .name = "msm_dmov",
1121 .id = -1,
1122 .resource = msm8625_dmov_resource,
1123 .num_resources = ARRAY_SIZE(msm8625_dmov_resource),
1124 .dev = {
1125 .platform_data = &msm_dmov_pdata,
1126 },
1127};
Taniya Das2e948192011-12-20 11:15:13 +05301128
Taniya Das9d187142011-12-02 15:53:25 +05301129static struct resource gsbi0_msm8625_qup_resources[] = {
1130 {
1131 .name = "qup_phys_addr",
1132 .start = MSM_GSBI0_QUP_PHYS,
1133 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
1134 .flags = IORESOURCE_MEM,
1135 },
1136 {
1137 .name = "gsbi_qup_i2c_addr",
1138 .start = MSM_GSBI0_PHYS,
1139 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
1140 .flags = IORESOURCE_MEM,
1141 },
1142 {
1143 .name = "qup_err_intr",
1144 .start = MSM8625_INT_PWB_I2C,
1145 .end = MSM8625_INT_PWB_I2C,
1146 .flags = IORESOURCE_IRQ,
1147 },
1148};
1149
1150/* Use GSBI0 QUP for /dev/i2c-0 */
Taniya Dase3027e22012-02-27 16:32:27 +05301151struct platform_device msm8625_gsbi0_qup_i2c_device = {
Taniya Das9d187142011-12-02 15:53:25 +05301152 .name = "qup_i2c",
1153 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
1154 .num_resources = ARRAY_SIZE(gsbi0_msm8625_qup_resources),
1155 .resource = gsbi0_msm8625_qup_resources,
1156};
1157
Trilok Soni633e59c2012-02-13 20:28:30 +05301158static struct resource gsbi1_msm8625_qup_i2c_resources[] = {
1159 {
1160 .name = "qup_phys_addr",
1161 .start = MSM_GSBI1_QUP_PHYS,
1162 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
1163 .flags = IORESOURCE_MEM,
1164 },
1165 {
1166 .name = "gsbi_qup_i2c_addr",
1167 .start = MSM_GSBI1_PHYS,
1168 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
1169 .flags = IORESOURCE_MEM,
1170 },
1171 {
1172 .name = "qup_err_intr",
1173 .start = MSM8625_INT_ARM11_DMA,
1174 .end = MSM8625_INT_ARM11_DMA,
1175 .flags = IORESOURCE_IRQ,
1176 },
1177};
1178
1179/* Use GSBI1 QUP for /dev/i2c-1 */
Taniya Dase3027e22012-02-27 16:32:27 +05301180struct platform_device msm8625_gsbi1_qup_i2c_device = {
Trilok Soni633e59c2012-02-13 20:28:30 +05301181 .name = "qup_i2c",
1182 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
1183 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
1184 .resource = gsbi1_msm8625_qup_i2c_resources,
1185};
1186
Taniya Das6684d622012-01-12 10:29:09 +05301187static struct resource msm8625_gpio_resources[] = {
1188 {
1189 .start = MSM8625_INT_GPIO_GROUP1,
1190 .flags = IORESOURCE_IRQ,
1191 },
1192 {
1193 .start = MSM8625_INT_GPIO_GROUP2,
1194 .flags = IORESOURCE_IRQ,
1195 },
1196};
1197
1198static struct platform_device msm8625_device_gpio = {
1199 .name = "msmgpio",
1200 .id = -1,
1201 .resource = msm8625_gpio_resources,
1202 .num_resources = ARRAY_SIZE(msm8625_gpio_resources),
1203};
1204
Trilok Soniee75f6c2012-02-13 20:45:07 +05301205static struct resource msm8625_resources_sdc1[] = {
1206 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301207 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301208 .start = MSM_SDC1_BASE,
1209 .end = MSM_SDC1_BASE + SZ_4K - 1,
1210 .flags = IORESOURCE_MEM,
1211 },
1212 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301213 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301214 .start = MSM8625_INT_SDC1_0,
1215 .end = MSM8625_INT_SDC1_1,
1216 .flags = IORESOURCE_IRQ,
1217 },
1218 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301219 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301220 .start = DMOV_SDC1_CHAN,
1221 .end = DMOV_SDC1_CHAN,
1222 .flags = IORESOURCE_DMA,
1223 },
1224 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301225 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301226 .start = DMOV_SDC1_CRCI,
1227 .end = DMOV_SDC1_CRCI,
1228 .flags = IORESOURCE_DMA,
1229 }
1230};
1231
1232static struct resource msm8625_resources_sdc2[] = {
1233 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301234 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301235 .start = MSM_SDC2_BASE,
1236 .end = MSM_SDC2_BASE + SZ_4K - 1,
1237 .flags = IORESOURCE_MEM,
1238 },
1239 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301240 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301241 .start = MSM8625_INT_SDC2_0,
1242 .end = MSM8625_INT_SDC2_1,
1243 .flags = IORESOURCE_IRQ,
1244 },
1245 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301246 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301247 .start = DMOV_SDC2_CHAN,
1248 .end = DMOV_SDC2_CHAN,
1249 .flags = IORESOURCE_DMA,
1250 },
1251 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301252 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301253 .start = DMOV_SDC2_CRCI,
1254 .end = DMOV_SDC2_CRCI,
1255 .flags = IORESOURCE_DMA,
1256 }
1257};
1258
1259static struct resource msm8625_resources_sdc3[] = {
1260 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301261 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301262 .start = MSM_SDC3_BASE,
1263 .end = MSM_SDC3_BASE + SZ_4K - 1,
1264 .flags = IORESOURCE_MEM,
1265 },
1266 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301267 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301268 .start = MSM8625_INT_SDC3_0,
1269 .end = MSM8625_INT_SDC3_1,
1270 .flags = IORESOURCE_IRQ,
1271 },
1272 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301273 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301274 .start = DMOV_SDC3_CHAN,
1275 .end = DMOV_SDC3_CHAN,
1276 .flags = IORESOURCE_DMA,
1277 },
1278 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301279 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301280 .start = DMOV_SDC3_CRCI,
1281 .end = DMOV_SDC3_CRCI,
1282 .flags = IORESOURCE_DMA,
1283 },
1284};
1285
1286static struct resource msm8625_resources_sdc4[] = {
1287 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301288 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301289 .start = MSM_SDC4_BASE,
1290 .end = MSM_SDC4_BASE + SZ_4K - 1,
1291 .flags = IORESOURCE_MEM,
1292 },
1293 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301294 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301295 .start = MSM8625_INT_SDC4_0,
1296 .end = MSM8625_INT_SDC4_1,
1297 .flags = IORESOURCE_IRQ,
1298 },
1299 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301300 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301301 .start = DMOV_SDC4_CHAN,
1302 .end = DMOV_SDC4_CHAN,
1303 .flags = IORESOURCE_DMA,
1304 },
1305 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301306 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301307 .start = DMOV_SDC4_CRCI,
1308 .end = DMOV_SDC4_CRCI,
1309 .flags = IORESOURCE_DMA,
1310 },
1311};
1312
1313struct platform_device msm8625_device_sdc1 = {
1314 .name = "msm_sdcc",
1315 .id = 1,
1316 .num_resources = ARRAY_SIZE(msm8625_resources_sdc1),
1317 .resource = msm8625_resources_sdc1,
1318 .dev = {
1319 .coherent_dma_mask = 0xffffffff,
1320 },
1321};
1322
1323struct platform_device msm8625_device_sdc2 = {
1324 .name = "msm_sdcc",
1325 .id = 2,
1326 .num_resources = ARRAY_SIZE(msm8625_resources_sdc2),
1327 .resource = msm8625_resources_sdc2,
1328 .dev = {
1329 .coherent_dma_mask = 0xffffffff,
1330 },
1331};
1332
1333struct platform_device msm8625_device_sdc3 = {
1334 .name = "msm_sdcc",
1335 .id = 3,
1336 .num_resources = ARRAY_SIZE(msm8625_resources_sdc3),
1337 .resource = msm8625_resources_sdc3,
1338 .dev = {
1339 .coherent_dma_mask = 0xffffffff,
1340 },
1341};
1342
1343struct platform_device msm8625_device_sdc4 = {
1344 .name = "msm_sdcc",
1345 .id = 4,
1346 .num_resources = ARRAY_SIZE(msm8625_resources_sdc4),
1347 .resource = msm8625_resources_sdc4,
1348 .dev = {
1349 .coherent_dma_mask = 0xffffffff,
1350 },
1351};
1352
1353static struct platform_device *msm8625_sdcc_devices[] __initdata = {
1354 &msm8625_device_sdc1,
1355 &msm8625_device_sdc2,
1356 &msm8625_device_sdc3,
1357 &msm8625_device_sdc4,
1358};
1359
1360int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
1361{
1362 struct platform_device *pdev;
1363
1364 if (controller < 1 || controller > 4)
1365 return -EINVAL;
1366
1367 if (cpu_is_msm8625())
1368 pdev = msm8625_sdcc_devices[controller-1];
1369 else
1370 pdev = msm_sdcc_devices[controller-1];
1371
1372 pdev->dev.platform_data = plat;
1373 return platform_device_register(pdev);
1374}
1375
Trilok Sonida63a8b2012-02-13 20:50:03 +05301376static struct resource msm8625_resources_hsusb_otg[] = {
1377 {
1378 .start = MSM_HSUSB_PHYS,
1379 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1380 .flags = IORESOURCE_MEM,
1381 },
1382 {
1383 .start = MSM8625_INT_USB_HS,
1384 .end = MSM8625_INT_USB_HS,
1385 .flags = IORESOURCE_IRQ,
1386 },
1387};
1388
1389struct platform_device msm8625_device_otg = {
1390 .name = "msm_otg",
1391 .id = -1,
1392 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_otg),
1393 .resource = msm8625_resources_hsusb_otg,
1394 .dev = {
1395 .dma_mask = &dma_mask,
1396 .coherent_dma_mask = 0xffffffffULL,
1397 },
1398};
1399
1400static struct resource msm8625_resources_gadget_peripheral[] = {
1401 {
1402 .start = MSM_HSUSB_PHYS,
1403 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1404 .flags = IORESOURCE_MEM,
1405 },
1406 {
1407 .start = MSM8625_INT_USB_HS,
1408 .end = MSM8625_INT_USB_HS,
1409 .flags = IORESOURCE_IRQ,
1410 },
1411};
1412
1413struct platform_device msm8625_device_gadget_peripheral = {
1414 .name = "msm_hsusb",
1415 .id = -1,
1416 .num_resources = ARRAY_SIZE(msm8625_resources_gadget_peripheral),
1417 .resource = msm8625_resources_gadget_peripheral,
1418 .dev = {
1419 .dma_mask = &dma_mask,
1420 .coherent_dma_mask = 0xffffffffULL,
1421 },
1422};
1423
1424static struct resource msm8625_resources_hsusb_host[] = {
1425 {
1426 .start = MSM_HSUSB_PHYS,
1427 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1428 .flags = IORESOURCE_MEM,
1429 },
1430 {
1431 .start = MSM8625_INT_USB_HS,
1432 .end = MSM8625_INT_USB_HS,
1433 .flags = IORESOURCE_IRQ,
1434 },
1435};
1436
1437struct platform_device msm8625_device_hsusb_host = {
1438 .name = "msm_hsusb_host",
1439 .id = 0,
1440 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_host),
1441 .resource = msm8625_resources_hsusb_host,
1442 .dev = {
1443 .dma_mask = &dma_mask,
1444 .coherent_dma_mask = 0xffffffffULL,
1445 },
1446};
1447
1448static struct platform_device *msm8625_host_devices[] = {
1449 &msm8625_device_hsusb_host,
1450};
1451
1452int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
1453{
1454 struct platform_device *pdev;
1455
1456 if (cpu_is_msm8625())
1457 pdev = msm8625_host_devices[host];
1458 else
1459 pdev = msm_host_devices[host];
1460 if (!pdev)
1461 return -ENODEV;
1462 pdev->dev.platform_data = plat;
1463 return platform_device_register(pdev);
1464}
1465
Trilok Soni88da2552012-02-13 21:01:24 +05301466#ifdef CONFIG_MSM_CAMERA_V4L2
1467static struct resource msm8625_csic0_resources[] = {
1468 {
1469 .name = "csic",
1470 .start = 0xA0F00000,
1471 .end = 0xA0F00000 + 0x00100000 - 1,
1472 .flags = IORESOURCE_MEM,
1473 },
1474 {
1475 .name = "csic",
1476 .start = MSM8625_INT_CSI_IRQ_0,
1477 .end = MSM8625_INT_CSI_IRQ_0,
1478 .flags = IORESOURCE_IRQ,
1479 },
1480};
1481
1482static struct resource msm8625_csic1_resources[] = {
1483 {
1484 .name = "csic",
1485 .start = 0xA1000000,
1486 .end = 0xA1000000 + 0x00100000 - 1,
1487 .flags = IORESOURCE_MEM,
1488 },
1489 {
1490 .name = "csic",
1491 .start = MSM8625_INT_CSI_IRQ_1,
1492 .end = MSM8625_INT_CSI_IRQ_1,
1493 .flags = IORESOURCE_IRQ,
1494 },
1495};
1496
1497struct platform_device msm8625_device_csic0 = {
1498 .name = "msm_csic",
1499 .id = 0,
1500 .resource = msm8625_csic0_resources,
1501 .num_resources = ARRAY_SIZE(msm8625_csic0_resources),
1502};
1503
1504struct platform_device msm8625_device_csic1 = {
1505 .name = "msm_csic",
1506 .id = 1,
1507 .resource = msm8625_csic1_resources,
1508 .num_resources = ARRAY_SIZE(msm8625_csic1_resources),
1509};
1510#endif
1511
Trilok Soniae4633d2012-02-13 21:08:32 +05301512static struct resource msm8625_mipi_dsi_resources[] = {
1513 {
1514 .name = "mipi_dsi",
1515 .start = MIPI_DSI_HW_BASE,
1516 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
1517 .flags = IORESOURCE_MEM,
1518 },
1519 {
1520 .start = MSM8625_INT_DSI_IRQ,
1521 .end = MSM8625_INT_DSI_IRQ,
1522 .flags = IORESOURCE_IRQ,
1523 },
1524};
1525
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301526static struct platform_device msm8625_mipi_dsi_device = {
Trilok Soniae4633d2012-02-13 21:08:32 +05301527 .name = "mipi_dsi",
1528 .id = 1,
1529 .num_resources = ARRAY_SIZE(msm8625_mipi_dsi_resources),
1530 .resource = msm8625_mipi_dsi_resources,
1531};
1532
1533static struct resource msm8625_mdp_resources[] = {
1534 {
1535 .name = "mdp",
1536 .start = MDP_BASE,
1537 .end = MDP_BASE + 0x000F1008 - 1,
1538 .flags = IORESOURCE_MEM,
1539 },
1540 {
1541 .start = MSM8625_INT_MDP,
1542 .end = MSM8625_INT_MDP,
1543 .flags = IORESOURCE_IRQ,
1544 },
1545};
1546
1547static struct platform_device msm8625_mdp_device = {
1548 .name = "mdp",
1549 .id = 0,
1550 .num_resources = ARRAY_SIZE(msm8625_mdp_resources),
1551 .resource = msm8625_mdp_resources,
1552};
1553
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301554struct platform_device mipi_dsi_device;
1555
Trilok Soniae4633d2012-02-13 21:08:32 +05301556void __init msm_fb_register_device(char *name, void *data)
1557{
1558 if (!strncmp(name, "mdp", 3)) {
1559 if (cpu_is_msm8625())
1560 msm_register_device(&msm8625_mdp_device, data);
1561 else
1562 msm_register_device(&msm_mdp_device, data);
1563 } else if (!strncmp(name, "mipi_dsi", 8)) {
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301564 if (cpu_is_msm8625()) {
Trilok Soniae4633d2012-02-13 21:08:32 +05301565 msm_register_device(&msm8625_mipi_dsi_device, data);
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301566 mipi_dsi_device = msm8625_mipi_dsi_device;
1567 } else {
Trilok Soniae4633d2012-02-13 21:08:32 +05301568 msm_register_device(&msm_mipi_dsi_device, data);
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301569 mipi_dsi_device = msm_mipi_dsi_device;
1570 }
Trilok Soniae4633d2012-02-13 21:08:32 +05301571 } else if (!strncmp(name, "lcdc", 4)) {
1572 msm_register_device(&msm_lcdc_device, data);
1573 } else {
1574 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
1575 }
1576}
1577
Trilok Soni664b95d2012-02-13 21:13:15 +05301578static struct resource msm8625_kgsl_3d0_resources[] = {
1579 {
1580 .name = KGSL_3D0_REG_MEMORY,
1581 .start = 0xA0000000,
1582 .end = 0xA001ffff,
1583 .flags = IORESOURCE_MEM,
1584 },
1585 {
1586 .name = KGSL_3D0_IRQ,
1587 .start = MSM8625_INT_GRAPHICS,
1588 .end = MSM8625_INT_GRAPHICS,
1589 .flags = IORESOURCE_IRQ,
1590 },
1591};
1592
1593struct platform_device msm8625_kgsl_3d0 = {
1594 .name = "kgsl-3d0",
1595 .id = 0,
1596 .num_resources = ARRAY_SIZE(msm8625_kgsl_3d0_resources),
1597 .resource = msm8625_kgsl_3d0_resources,
1598 .dev = {
1599 .platform_data = &kgsl_3d0_pdata,
1600 },
1601};
1602
Kaushal Kumar622828f2012-07-31 16:07:49 +05301603static struct resource cpr_resources[] = {
1604 {
1605 .start = MSM8625_INT_CPR_IRQ0,
1606 .flags = IORESOURCE_IRQ,
1607 },
1608 {
1609 .start = MSM8625_CPR_PHYS,
1610 .end = MSM8625_CPR_PHYS + SZ_4K - 1,
1611 .flags = IORESOURCE_MEM,
1612 },
1613};
1614
1615/**
1616 * These are various Vdd levels supported by PMIC
1617 */
1618static uint32_t msm_c2_pmic_mv[] __initdata = {
1619 1300, 12875 / 10, 1275, 12625 / 10, 1250,
1620 12375 / 10, 1225, 12125 / 10, 1200, 11875 / 10,
1621 1175, 11625 / 10, 1150, 11375 / 10, 1125,
1622 11125 / 10, 1100, 10875 / 10, 1075, 10625 / 10,
1623 1050, 10375 / 10, 1025, 10125 / 10, 0, 0, 0, 0,
1624 0, 0, 0, 1000,
1625};
1626
1627/**
1628 * This data will be based on CPR mode of operation
1629 */
1630static struct msm_cpr_mode msm_cpr_mode_data[] = {
1631 [NORMAL_MODE] = {
1632 .ring_osc_data = {
1633 {0, },
1634 {0, },
1635 {0, },
1636 {0, },
1637 {0, },
1638 {0, },
1639 {0, },
1640 {0, },
1641 },
1642 .ring_osc = 0,
1643 .step_quot = ~0,
1644 .tgt_volt_offset = 1,
1645 .Vmax = 1200,
1646 .Vmin = 1000,
1647 .calibrated_mV = 1100,
1648 },
1649 [TURBO_MODE] = {
1650 .ring_osc_data = {
1651 {0, },
1652 {0, },
1653 {0, },
1654 {0, },
1655 {0, },
1656 {0, },
1657 {0, },
1658 {0, },
1659 },
1660 .ring_osc = 0,
1661 .step_quot = ~0,
1662 .tgt_volt_offset = 1,
1663 .Vmax = 1350,
1664 .Vmin = 1250,
1665 .calibrated_mV = 1300,
1666 },
1667};
1668
1669struct msm_cpr_vp_data vp_data = {
1670 .min_volt = 1000,
1671 .max_volt = 1350,
1672 .default_volt = 1300,
1673 .step_size = (12500 / 1000),
1674};
1675
1676static struct msm_cpr_config msm_cpr_pdata = {
1677 .ref_clk_khz = 19200,
1678 .delay_us = 10000,
1679 .irq_line = 0,
1680 .cpr_mode_data = msm_cpr_mode_data,
1681 .tgt_count_div_N = 1,
1682 .floor = 0,
1683 .ceiling = 40,
1684 .sw_vlevel = 20,
1685 .up_threshold = 1,
1686 .dn_threshold = 2,
1687 .up_margin = 0,
1688 .dn_margin = 0,
1689 .nom_freq_limit = 1008000,
1690 .vp_data = &vp_data,
1691};
1692
1693static struct platform_device msm8625_device_cpr = {
1694 .name = "msm-cpr",
1695 .id = -1,
1696 .num_resources = ARRAY_SIZE(cpr_resources),
1697 .resource = cpr_resources,
1698 .dev = {
1699 .platform_data = &msm_cpr_pdata,
1700 },
1701};
1702
1703static struct platform_device msm8625_vp_device = {
1704 .name = "vp-regulator",
1705 .id = -1,
1706};
1707
1708static void __init msm_cpr_init(void)
1709{
1710 struct cpr_info_type *cpr_info = NULL;
1711 uint8_t ring_osc = 0;
1712 uint32_t reg_val;
1713
1714 cpr_info = kzalloc(sizeof(struct cpr_info_type), GFP_KERNEL);
1715 if (!cpr_info) {
1716 pr_err("%s: Out of memory %d\n", __func__, -ENOMEM);
1717 return;
1718 }
1719
1720 msm_smem_get_cpr_info(cpr_info);
1721
1722 /**
1723 * Set the ring_osc based on efuse BIT(0)
1724 * CPR_fuse[0] = 0 selects 2nd RO (010)
1725 * CPR_fuse[0] = 1 select 3rd RO (011)
1726 */
1727 if (cpr_info->ring_osc == 0x0)
1728 ring_osc = 0x2;
1729 else if (cpr_info->ring_osc == 0x1)
1730 ring_osc = 0x3;
1731
1732 msm_cpr_mode_data[TURBO_MODE].ring_osc = ring_osc;
1733 msm_cpr_mode_data[NORMAL_MODE].ring_osc = ring_osc;
1734
1735 /* GCNT = 1000 nsec/52nsec (@TCX0=19.2Mhz) = 19.2 */
1736 msm_cpr_mode_data[TURBO_MODE].ring_osc_data[ring_osc].gcnt = 19;
1737 msm_cpr_mode_data[NORMAL_MODE].ring_osc_data[ring_osc].gcnt = 19;
1738
1739 /* The multiplier and offset are as per PTE data */
1740 msm_cpr_mode_data[TURBO_MODE].ring_osc_data[ring_osc].target_count =
1741 cpr_info->turbo_quot * 10 + 440;
1742 msm_cpr_mode_data[NORMAL_MODE].ring_osc_data[ring_osc].target_count =
1743 cpr_info->turbo_quot / msm_cpr_pdata.tgt_count_div_N;
1744
1745 /**
1746 * Bits 4:0 of pvs_fuse provide mapping to the safe boot up voltage.
1747 * Boot up mode is by default Turbo.
1748 */
1749 msm_cpr_mode_data[TURBO_MODE].calibrated_mV =
1750 msm_c2_pmic_mv[cpr_info->pvs_fuse & 0x1F];
1751
1752 /* TODO: Store the tgt_volt_offset values for the modes from PTE */
1753
1754
1755 pr_debug("%s: cpr: ring_osc: 0x%x\n", __func__,
1756 msm_cpr_mode_data[TURBO_MODE].ring_osc);
1757 pr_debug("%s: cpr: turbo_quot: 0x%x\n", __func__, cpr_info->turbo_quot);
1758 pr_debug("%s: cpr: pvs_fuse: 0x%x\n", __func__, cpr_info->pvs_fuse);
1759 kfree(cpr_info);
1760
1761 /* Select TCXO (19.2MHz) as clock source */
1762 reg_val = readl_relaxed(A11S_TEST_BUS_SEL_ADDR);
1763 reg_val |= RBCPR_CLK_MUX_SEL;
1764 writel_relaxed(reg_val, A11S_TEST_BUS_SEL_ADDR);
1765
1766 /* Get CPR out of reset */
1767 writel_relaxed(0x1, RBCPR_SW_RESET_N);
1768
1769 platform_device_register(&msm8625_vp_device);
1770 platform_device_register(&msm8625_device_cpr);
1771}
1772
Taniya Das7c9f0512011-12-02 14:26:46 +05301773static struct clk_lookup msm_clock_8625_dummy[] = {
1774 CLK_DUMMY("core_clk", adm_clk.c, "msm_dmov", 0),
1775 CLK_DUMMY("adsp_clk", adsp_clk.c, NULL, 0),
1776 CLK_DUMMY("ahb_m_clk", ahb_m_clk.c, NULL, 0),
1777 CLK_DUMMY("ahb_s_clk", ahb_s_clk.c, NULL, 0),
1778 CLK_DUMMY("cam_m_clk", cam_m_clk.c, NULL, 0),
1779 CLK_DUMMY("csi_clk", csi1_clk.c, NULL, 0),
1780 CLK_DUMMY("csi_pclk", csi1_p_clk.c, NULL, 0),
1781 CLK_DUMMY("csi_vfe_clk", csi1_vfe_clk.c, NULL, 0),
1782 CLK_DUMMY("dsi_byte_clk", dsi_byte_clk.c, NULL, 0),
1783 CLK_DUMMY("dsi_clk", dsi_clk.c, NULL, 0),
1784 CLK_DUMMY("dsi_esc_clk", dsi_esc_clk.c, NULL, 0),
1785 CLK_DUMMY("dsi_pixel_clk", dsi_pixel_clk.c, NULL, 0),
1786 CLK_DUMMY("dsi_ref_clk", dsi_ref_clk.c, NULL, 0),
1787 CLK_DUMMY("ebi1_clk", ebi1_clk.c, NULL, 0),
1788 CLK_DUMMY("ebi2_clk", ebi2_clk.c, NULL, 0),
1789 CLK_DUMMY("ecodec_clk", ecodec_clk.c, NULL, 0),
1790 CLK_DUMMY("gp_clk", gp_clk.c, NULL, 0),
1791 CLK_DUMMY("core_clk", gsbi1_qup_clk.c, "qup_i2c.0", 0),
1792 CLK_DUMMY("core_clk", gsbi2_qup_clk.c, "qup_i2c.1", 0),
1793 CLK_DUMMY("iface_clk", gsbi1_qup_p_clk.c, "qup_i2c.0", 0),
1794 CLK_DUMMY("iface_clk", gsbi2_qup_p_clk.c, "qup_i2c.1", 0),
1795 CLK_DUMMY("icodec_rx_clk", icodec_rx_clk.c, NULL, 0),
1796 CLK_DUMMY("icodec_tx_clk", icodec_tx_clk.c, NULL, 0),
1797 CLK_DUMMY("mem_clk", imem_clk.c, NULL, 0),
1798 CLK_DUMMY("mddi_clk", pmdh_clk.c, NULL, 0),
1799 CLK_DUMMY("mdp_clk", mdp_clk.c, NULL, 0),
1800 CLK_DUMMY("mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk.c, NULL, 0),
1801 CLK_DUMMY("mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk.c, NULL, 0),
1802 CLK_DUMMY("mdp_vsync_clk", mdp_vsync_clk.c, NULL, 0),
1803 CLK_DUMMY("mdp_dsi_pclk", mdp_dsi_p_clk.c, NULL, 0),
1804 CLK_DUMMY("pbus_clk", pbus_clk.c, NULL, 0),
1805 CLK_DUMMY("pcm_clk", pcm_clk.c, NULL, 0),
1806 CLK_DUMMY("sdac_clk", sdac_clk.c, NULL, 0),
1807 CLK_DUMMY("core_clk", sdc1_clk.c, "msm_sdcc.1", 0),
1808 CLK_DUMMY("iface_clk", sdc1_p_clk.c, "msm_sdcc.1", 0),
1809 CLK_DUMMY("core_clk", sdc2_clk.c, "msm_sdcc.2", 0),
1810 CLK_DUMMY("iface_clk", sdc2_p_clk.c, "msm_sdcc.2", 0),
1811 CLK_DUMMY("core_clk", sdc3_clk.c, "msm_sdcc.3", 0),
1812 CLK_DUMMY("iface_clk", sdc3_p_clk.c, "msm_sdcc.3", 0),
1813 CLK_DUMMY("core_clk", sdc4_clk.c, "msm_sdcc.4", 0),
1814 CLK_DUMMY("iface_clk", sdc4_p_clk.c, "msm_sdcc.4", 0),
1815 CLK_DUMMY("ref_clk", tsif_ref_clk.c, "msm_tsif.0", 0),
1816 CLK_DUMMY("iface_clk", tsif_p_clk.c, "msm_tsif.0", 0),
1817 CLK_DUMMY("core_clk", uart1_clk.c, "msm_serial.0", 0),
1818 CLK_DUMMY("core_clk", uart2_clk.c, "msm_serial.1", 0),
1819 CLK_DUMMY("core_clk", uart1dm_clk.c, "msm_serial_hs.0", 0),
1820 CLK_DUMMY("core_clk", uart2dm_clk.c, "msm_serial_hsl.0", 0),
1821 CLK_DUMMY("usb_hs_core_clk", usb_hs_core_clk.c, NULL, 0),
1822 CLK_DUMMY("usb_hs2_clk", usb_hs2_clk.c, NULL, 0),
1823 CLK_DUMMY("usb_hs_clk", usb_hs_clk.c, NULL, 0),
1824 CLK_DUMMY("usb_hs_pclk", usb_hs_p_clk.c, NULL, 0),
1825 CLK_DUMMY("usb_phy_clk", usb_phy_clk.c, NULL, 0),
1826 CLK_DUMMY("vdc_clk", vdc_clk.c, NULL, 0),
1827 CLK_DUMMY("ebi1_acpu_clk", ebi_acpu_clk.c, NULL, 0),
1828 CLK_DUMMY("ebi1_lcdc_clk", ebi_lcdc_clk.c, NULL, 0),
1829 CLK_DUMMY("ebi1_mddi_clk", ebi_mddi_clk.c, NULL, 0),
1830 CLK_DUMMY("ebi1_usb_clk", ebi_usb_clk.c, NULL, 0),
1831 CLK_DUMMY("ebi1_vfe_clk", ebi_vfe_clk.c, NULL, 0),
1832 CLK_DUMMY("mem_clk", ebi_adm_clk.c, "msm_dmov", 0),
1833};
1834
1835struct clock_init_data msm8625_dummy_clock_init_data __initdata = {
1836 .table = msm_clock_8625_dummy,
1837 .size = ARRAY_SIZE(msm_clock_8625_dummy),
1838};
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301839enum {
1840 MSM8625,
1841 MSM8625A,
Kaushal Kumar86473f02012-06-28 19:35:58 +05301842 MSM8625AB,
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301843};
1844
1845static int __init msm8625_cpu_id(void)
1846{
1847 int raw_id, cpu;
1848
1849 raw_id = socinfo_get_raw_id();
1850 switch (raw_id) {
1851 /* Part number for 1GHz part */
1852 case 0x770:
1853 case 0x771:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301854 case 0x77C:
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301855 case 0x780:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301856 case 0x8D0:
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301857 cpu = MSM8625;
1858 break;
1859 /* Part number for 1.2GHz part */
1860 case 0x773:
1861 case 0x774:
1862 case 0x781:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301863 case 0x8D1:
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301864 cpu = MSM8625A;
1865 break;
Kaushal Kumar86473f02012-06-28 19:35:58 +05301866 case 0x775:
1867 case 0x776:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301868 case 0x77D:
Kaushal Kumar86473f02012-06-28 19:35:58 +05301869 case 0x782:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301870 case 0x8D2:
Kaushal Kumar86473f02012-06-28 19:35:58 +05301871 cpu = MSM8625AB;
1872 break;
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301873 default:
1874 pr_err("Invalid Raw ID\n");
1875 return -ENODEV;
1876 }
1877 return cpu;
1878}
1879
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001880int __init msm7x2x_misc_init(void)
1881{
Taniya Das7c9f0512011-12-02 14:26:46 +05301882 if (machine_is_msm8625_rumi3()) {
1883 msm_clock_init(&msm8625_dummy_clock_init_data);
Kaushal Kumar622828f2012-07-31 16:07:49 +05301884 msm_cpr_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301885 return 0;
Taniya Das7c9f0512011-12-02 14:26:46 +05301886 }
Taniya Das43bcdd62011-12-02 17:33:27 +05301887
Stephen Boydbb600ae2011-08-02 20:11:40 -07001888 msm_clock_init(&msm7x27a_clock_init_data);
Pankaj Kumarfee56a82012-04-17 14:26:49 +05301889 if (cpu_is_msm7x27aa() || cpu_is_msm7x25ab())
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001890 platform_device_register(&msm7x27aa_device_acpuclk);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301891 else if (cpu_is_msm8625()) {
1892 if (msm8625_cpu_id() == MSM8625)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001893 platform_device_register(&msm7x27aa_device_acpuclk);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301894 else if (msm8625_cpu_id() == MSM8625A)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001895 platform_device_register(&msm8625_device_acpuclk);
Kaushal Kumar86473f02012-06-28 19:35:58 +05301896 else if (msm8625_cpu_id() == MSM8625AB)
1897 platform_device_register(&msm8625ab_device_acpuclk);
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001898 } else {
1899 platform_device_register(&msm7x27a_device_acpuclk);
1900 }
Kaushal Kumar622828f2012-07-31 16:07:49 +05301901
1902 if (cpu_is_msm8625() &&
1903 (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2))
1904 msm_cpr_init();
1905
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001906 return 0;
1907}
1908
1909#ifdef CONFIG_CACHE_L2X0
1910static int __init msm7x27x_cache_init(void)
1911{
1912 int aux_ctrl = 0;
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301913 int pctrl = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001914
1915 /* Way Size 010(0x2) 32KB */
1916 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
1917 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
1918 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
1919
Taniya Das379b5682011-12-02 14:53:46 +05301920 if (cpu_is_msm8625()) {
1921 /* Way Size 011(0x3) 64KB */
1922 aux_ctrl |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
1923 (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | \
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301924 (0X1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) | \
1925 (0x1 << L2X0_AUX_CTRL_L2_FORCE_NWA_SHIFT);
1926
1927 /* Write Prefetch Control settings */
1928 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
1929 pctrl |= (0x3 << L2X0_PREFETCH_CTRL_OFFSET_SHIFT) | \
1930 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_INC_SHIFT) | \
1931 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_SHIFT);
1932 writel_relaxed(pctrl , MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
Taniya Das379b5682011-12-02 14:53:46 +05301933 }
1934
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001935 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301936 if (cpu_is_msm8625()) {
1937 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
1938 pr_info("Prfetch Ctrl: 0x%08x\n", pctrl);
1939 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001940
1941 return 0;
1942}
1943#else
pankaj kumar80d7cb62011-08-23 13:37:55 +05301944static int __init msm7x27x_cache_init(void){ return 0; }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001945#endif
1946
1947void __init msm_common_io_init(void)
1948{
1949 msm_map_common_io();
Taniya Das43bcdd62011-12-02 17:33:27 +05301950 if (socinfo_init() < 0)
1951 pr_err("%s: socinfo_init() failed!\n", __func__);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001952 msm7x27x_cache_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301953}
1954
1955void __init msm8625_init_irq(void)
1956{
Trilok Soni1a9fdee2012-05-28 19:54:11 +05301957 msm_gic_irq_extn_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301958 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1959 (void *)MSM_QGIC_CPU_BASE);
Taniya Das43bcdd62011-12-02 17:33:27 +05301960}
1961
1962void __init msm8625_map_io(void)
1963{
1964 msm_map_msm8625_io();
1965
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001966 if (socinfo_init() < 0)
1967 pr_err("%s: socinfo_init() failed!\n", __func__);
Taniya Das379b5682011-12-02 14:53:46 +05301968 msm7x27x_cache_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001969}
1970
Taniya Das43bcdd62011-12-02 17:33:27 +05301971static int msm7627a_init_gpio(void)
1972{
Taniya Das6684d622012-01-12 10:29:09 +05301973 if (cpu_is_msm8625())
1974 platform_device_register(&msm8625_device_gpio);
1975 else
1976 platform_device_register(&msm_device_gpio);
Taniya Das43bcdd62011-12-02 17:33:27 +05301977 return 0;
1978}
1979postcore_initcall(msm7627a_init_gpio);
Taniya Das9d0c3c52012-05-04 14:40:55 +05301980
1981static int msm7627a_panic_handler(struct notifier_block *this,
1982 unsigned long event, void *ptr)
1983{
1984 flush_cache_all();
1985 outer_flush_all();
1986 return NOTIFY_DONE;
1987}
1988
1989static struct notifier_block panic_handler = {
1990 .notifier_call = msm7627a_panic_handler,
1991};
1992
1993static int __init panic_register(void)
1994{
1995 atomic_notifier_chain_register(&panic_notifier_list,
1996 &panic_handler);
1997 return 0;
1998}
1999module_init(panic_register);