blob: 2de0215a8b97554e363b74d9ea5f35faf9600ea2 [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
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 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:
1637 case 0x77D:
1638 case 0x782:
1639 case 0x8D2:
1640 cpu = MSM8625AB;
1641 break;
1642 default:
1643 pr_err("Invalid Raw ID\n");
1644 return -ENODEV;
1645 }
1646 return cpu;
1647}
1648
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301649static struct resource cpr_resources[] = {
1650 {
1651 .start = MSM8625_INT_CPR_IRQ0,
1652 .flags = IORESOURCE_IRQ,
1653 },
1654 {
1655 .start = MSM8625_CPR_PHYS,
1656 .end = MSM8625_CPR_PHYS + SZ_4K - 1,
1657 .flags = IORESOURCE_MEM,
1658 },
1659};
1660
1661/**
1662 * These are various Vdd levels supported by PMIC
1663 */
1664static uint32_t msm_c2_pmic_mv[] __initdata = {
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301665 1300000, 1287500, 1275000, 1262500, 1250000,
1666 1237500, 1225000, 1212500, 1200000, 1187500,
1667 1175000, 1162500, 1150000, 1137500, 1125000,
1668 1112500, 1100000, 1087500, 1075000, 1062500,
1669 1050000, 1037500, 1025000, 1012500, 0, 0, 0,
1670 0, 0, 0, 0, 1000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301671};
1672
1673/**
1674 * This data will be based on CPR mode of operation
1675 */
1676static struct msm_cpr_mode msm_cpr_mode_data[] = {
1677 [NORMAL_MODE] = {
1678 .ring_osc_data = {
1679 {0, },
1680 {0, },
1681 {0, },
1682 {0, },
1683 {0, },
1684 {0, },
1685 {0, },
1686 {0, },
1687 },
1688 .ring_osc = 0,
1689 .step_quot = ~0,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301690 .tgt_volt_offset = 0,
1691 .Vmax = 1200000,
1692 .Vmin = 1000000,
1693 .calibrated_uV = 1100000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301694 },
1695 [TURBO_MODE] = {
1696 .ring_osc_data = {
1697 {0, },
1698 {0, },
1699 {0, },
1700 {0, },
1701 {0, },
1702 {0, },
1703 {0, },
1704 {0, },
1705 },
1706 .ring_osc = 0,
1707 .step_quot = ~0,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301708 .tgt_volt_offset = 0,
1709 .Vmax = 1350000,
1710 .Vmin = 1150000,
1711 .calibrated_uV = 1300000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301712 },
1713};
1714
1715struct msm_cpr_vp_data vp_data = {
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301716 .min_volt = 1000000,
1717 .max_volt = 1350000,
1718 .default_volt = 1300000,
1719 .step_size = 12500,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301720};
1721
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301722static uint32_t
1723msm_cpr_get_quot(uint32_t max_quot, uint32_t max_freq, uint32_t new_freq)
1724{
1725 uint32_t quot;
1726
1727 /* This formula is as per chip characterization data */
1728 quot = max_quot - ((max_freq / 10 - new_freq / 10) * 9) + 20;
1729
1730 return quot;
1731}
1732
1733static void msm_cpr_clk_enable(void)
1734{
1735 uint32_t reg_val;
1736
1737 /* Select TCXO (19.2MHz) as clock source */
1738 reg_val = readl_relaxed(A11S_TEST_BUS_SEL_ADDR);
1739 reg_val |= RBCPR_CLK_MUX_SEL;
1740 writel_relaxed(reg_val, A11S_TEST_BUS_SEL_ADDR);
1741
1742 /* Get CPR out of reset */
1743 writel_relaxed(0x1, RBCPR_SW_RESET_N);
1744}
1745
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301746static struct msm_cpr_config msm_cpr_pdata = {
1747 .ref_clk_khz = 19200,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301748 .delay_us = 25000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301749 .irq_line = 0,
1750 .cpr_mode_data = msm_cpr_mode_data,
1751 .tgt_count_div_N = 1,
1752 .floor = 0,
1753 .ceiling = 40,
1754 .sw_vlevel = 20,
1755 .up_threshold = 1,
1756 .dn_threshold = 2,
1757 .up_margin = 0,
1758 .dn_margin = 0,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301759 .max_nom_freq = 700800,
1760 .max_freq = 1401600,
1761 .max_quot = 0,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301762 .vp_data = &vp_data,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301763 .get_quot = msm_cpr_get_quot,
1764 .clk_enable = msm_cpr_clk_enable,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301765};
1766
1767static struct platform_device msm8625_device_cpr = {
1768 .name = "msm-cpr",
1769 .id = -1,
1770 .num_resources = ARRAY_SIZE(cpr_resources),
1771 .resource = cpr_resources,
1772 .dev = {
1773 .platform_data = &msm_cpr_pdata,
1774 },
1775};
1776
1777static struct platform_device msm8625_vp_device = {
1778 .name = "vp-regulator",
1779 .id = -1,
1780};
1781
1782static void __init msm_cpr_init(void)
1783{
1784 struct cpr_info_type *cpr_info = NULL;
1785 uint8_t ring_osc = 0;
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301786
1787 cpr_info = kzalloc(sizeof(struct cpr_info_type), GFP_KERNEL);
1788 if (!cpr_info) {
1789 pr_err("%s: Out of memory %d\n", __func__, -ENOMEM);
1790 return;
1791 }
1792
1793 msm_smem_get_cpr_info(cpr_info);
1794
1795 /**
1796 * Set the ring_osc based on efuse BIT(0)
1797 * CPR_fuse[0] = 0 selects 2nd RO (010)
1798 * CPR_fuse[0] = 1 select 3rd RO (011)
1799 */
1800 if (cpr_info->ring_osc == 0x0)
1801 ring_osc = 0x2;
1802 else if (cpr_info->ring_osc == 0x1)
1803 ring_osc = 0x3;
1804
1805 msm_cpr_mode_data[TURBO_MODE].ring_osc = ring_osc;
1806 msm_cpr_mode_data[NORMAL_MODE].ring_osc = ring_osc;
1807
1808 /* GCNT = 1000 nsec/52nsec (@TCX0=19.2Mhz) = 19.2 */
1809 msm_cpr_mode_data[TURBO_MODE].ring_osc_data[ring_osc].gcnt = 19;
1810 msm_cpr_mode_data[NORMAL_MODE].ring_osc_data[ring_osc].gcnt = 19;
1811
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301812 /**
1813 * The scaling factor and offset are as per chip characterization data
1814 * This formula is used since available fuse bits in the chip are not
1815 * enough to represent the value of maximum quot
1816 */
1817 msm_cpr_pdata.max_quot = cpr_info->turbo_quot * 10 + 610;
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301818
1819 /**
1820 * Bits 4:0 of pvs_fuse provide mapping to the safe boot up voltage.
1821 * Boot up mode is by default Turbo.
1822 */
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301823 msm_cpr_mode_data[TURBO_MODE].calibrated_uV =
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301824 msm_c2_pmic_mv[cpr_info->pvs_fuse & 0x1F];
1825
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301826 pr_debug("%s: cpr: ring_osc: 0x%x\n", __func__,
1827 msm_cpr_mode_data[TURBO_MODE].ring_osc);
1828 pr_debug("%s: cpr: turbo_quot: 0x%x\n", __func__, cpr_info->turbo_quot);
1829 pr_debug("%s: cpr: pvs_fuse: 0x%x\n", __func__, cpr_info->pvs_fuse);
1830 kfree(cpr_info);
1831
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301832 if (msm8625_cpu_id() == MSM8625A)
1833 msm_cpr_pdata.max_freq = 1209600;
1834 else if (msm8625_cpu_id() == MSM8625)
1835 msm_cpr_pdata.max_freq = 1008000;
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301836
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301837 msm_cpr_clk_enable();
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301838
1839 platform_device_register(&msm8625_vp_device);
1840 platform_device_register(&msm8625_device_cpr);
1841}
1842
Taniya Das7c9f0512011-12-02 14:26:46 +05301843static struct clk_lookup msm_clock_8625_dummy[] = {
1844 CLK_DUMMY("core_clk", adm_clk.c, "msm_dmov", 0),
1845 CLK_DUMMY("adsp_clk", adsp_clk.c, NULL, 0),
1846 CLK_DUMMY("ahb_m_clk", ahb_m_clk.c, NULL, 0),
1847 CLK_DUMMY("ahb_s_clk", ahb_s_clk.c, NULL, 0),
1848 CLK_DUMMY("cam_m_clk", cam_m_clk.c, NULL, 0),
1849 CLK_DUMMY("csi_clk", csi1_clk.c, NULL, 0),
1850 CLK_DUMMY("csi_pclk", csi1_p_clk.c, NULL, 0),
1851 CLK_DUMMY("csi_vfe_clk", csi1_vfe_clk.c, NULL, 0),
1852 CLK_DUMMY("dsi_byte_clk", dsi_byte_clk.c, NULL, 0),
1853 CLK_DUMMY("dsi_clk", dsi_clk.c, NULL, 0),
1854 CLK_DUMMY("dsi_esc_clk", dsi_esc_clk.c, NULL, 0),
1855 CLK_DUMMY("dsi_pixel_clk", dsi_pixel_clk.c, NULL, 0),
1856 CLK_DUMMY("dsi_ref_clk", dsi_ref_clk.c, NULL, 0),
1857 CLK_DUMMY("ebi1_clk", ebi1_clk.c, NULL, 0),
1858 CLK_DUMMY("ebi2_clk", ebi2_clk.c, NULL, 0),
1859 CLK_DUMMY("ecodec_clk", ecodec_clk.c, NULL, 0),
1860 CLK_DUMMY("gp_clk", gp_clk.c, NULL, 0),
1861 CLK_DUMMY("core_clk", gsbi1_qup_clk.c, "qup_i2c.0", 0),
1862 CLK_DUMMY("core_clk", gsbi2_qup_clk.c, "qup_i2c.1", 0),
1863 CLK_DUMMY("iface_clk", gsbi1_qup_p_clk.c, "qup_i2c.0", 0),
1864 CLK_DUMMY("iface_clk", gsbi2_qup_p_clk.c, "qup_i2c.1", 0),
1865 CLK_DUMMY("icodec_rx_clk", icodec_rx_clk.c, NULL, 0),
1866 CLK_DUMMY("icodec_tx_clk", icodec_tx_clk.c, NULL, 0),
1867 CLK_DUMMY("mem_clk", imem_clk.c, NULL, 0),
1868 CLK_DUMMY("mddi_clk", pmdh_clk.c, NULL, 0),
1869 CLK_DUMMY("mdp_clk", mdp_clk.c, NULL, 0),
1870 CLK_DUMMY("mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk.c, NULL, 0),
1871 CLK_DUMMY("mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk.c, NULL, 0),
1872 CLK_DUMMY("mdp_vsync_clk", mdp_vsync_clk.c, NULL, 0),
1873 CLK_DUMMY("mdp_dsi_pclk", mdp_dsi_p_clk.c, NULL, 0),
1874 CLK_DUMMY("pbus_clk", pbus_clk.c, NULL, 0),
1875 CLK_DUMMY("pcm_clk", pcm_clk.c, NULL, 0),
1876 CLK_DUMMY("sdac_clk", sdac_clk.c, NULL, 0),
1877 CLK_DUMMY("core_clk", sdc1_clk.c, "msm_sdcc.1", 0),
1878 CLK_DUMMY("iface_clk", sdc1_p_clk.c, "msm_sdcc.1", 0),
1879 CLK_DUMMY("core_clk", sdc2_clk.c, "msm_sdcc.2", 0),
1880 CLK_DUMMY("iface_clk", sdc2_p_clk.c, "msm_sdcc.2", 0),
1881 CLK_DUMMY("core_clk", sdc3_clk.c, "msm_sdcc.3", 0),
1882 CLK_DUMMY("iface_clk", sdc3_p_clk.c, "msm_sdcc.3", 0),
1883 CLK_DUMMY("core_clk", sdc4_clk.c, "msm_sdcc.4", 0),
1884 CLK_DUMMY("iface_clk", sdc4_p_clk.c, "msm_sdcc.4", 0),
1885 CLK_DUMMY("ref_clk", tsif_ref_clk.c, "msm_tsif.0", 0),
1886 CLK_DUMMY("iface_clk", tsif_p_clk.c, "msm_tsif.0", 0),
1887 CLK_DUMMY("core_clk", uart1_clk.c, "msm_serial.0", 0),
1888 CLK_DUMMY("core_clk", uart2_clk.c, "msm_serial.1", 0),
1889 CLK_DUMMY("core_clk", uart1dm_clk.c, "msm_serial_hs.0", 0),
1890 CLK_DUMMY("core_clk", uart2dm_clk.c, "msm_serial_hsl.0", 0),
1891 CLK_DUMMY("usb_hs_core_clk", usb_hs_core_clk.c, NULL, 0),
1892 CLK_DUMMY("usb_hs2_clk", usb_hs2_clk.c, NULL, 0),
1893 CLK_DUMMY("usb_hs_clk", usb_hs_clk.c, NULL, 0),
1894 CLK_DUMMY("usb_hs_pclk", usb_hs_p_clk.c, NULL, 0),
1895 CLK_DUMMY("usb_phy_clk", usb_phy_clk.c, NULL, 0),
1896 CLK_DUMMY("vdc_clk", vdc_clk.c, NULL, 0),
1897 CLK_DUMMY("ebi1_acpu_clk", ebi_acpu_clk.c, NULL, 0),
1898 CLK_DUMMY("ebi1_lcdc_clk", ebi_lcdc_clk.c, NULL, 0),
1899 CLK_DUMMY("ebi1_mddi_clk", ebi_mddi_clk.c, NULL, 0),
1900 CLK_DUMMY("ebi1_usb_clk", ebi_usb_clk.c, NULL, 0),
1901 CLK_DUMMY("ebi1_vfe_clk", ebi_vfe_clk.c, NULL, 0),
1902 CLK_DUMMY("mem_clk", ebi_adm_clk.c, "msm_dmov", 0),
1903};
1904
1905struct clock_init_data msm8625_dummy_clock_init_data __initdata = {
1906 .table = msm_clock_8625_dummy,
1907 .size = ARRAY_SIZE(msm_clock_8625_dummy),
1908};
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301909
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001910int __init msm7x2x_misc_init(void)
1911{
Taniya Das7c9f0512011-12-02 14:26:46 +05301912 if (machine_is_msm8625_rumi3()) {
1913 msm_clock_init(&msm8625_dummy_clock_init_data);
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301914 msm_cpr_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301915 return 0;
Taniya Das7c9f0512011-12-02 14:26:46 +05301916 }
Taniya Das43bcdd62011-12-02 17:33:27 +05301917
Stephen Boydbb600ae2011-08-02 20:11:40 -07001918 msm_clock_init(&msm7x27a_clock_init_data);
Pankaj Kumarfee56a82012-04-17 14:26:49 +05301919 if (cpu_is_msm7x27aa() || cpu_is_msm7x25ab())
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001920 platform_device_register(&msm7x27aa_device_acpuclk);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301921 else if (cpu_is_msm8625()) {
1922 if (msm8625_cpu_id() == MSM8625)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001923 platform_device_register(&msm7x27aa_device_acpuclk);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301924 else if (msm8625_cpu_id() == MSM8625A)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001925 platform_device_register(&msm8625_device_acpuclk);
Kaushal Kumar86473f02012-06-28 19:35:58 +05301926 else if (msm8625_cpu_id() == MSM8625AB)
1927 platform_device_register(&msm8625ab_device_acpuclk);
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001928 } else {
1929 platform_device_register(&msm7x27a_device_acpuclk);
1930 }
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301931
1932 if (cpu_is_msm8625() &&
1933 (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2))
1934 msm_cpr_init();
1935
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001936 return 0;
1937}
1938
1939#ifdef CONFIG_CACHE_L2X0
1940static int __init msm7x27x_cache_init(void)
1941{
1942 int aux_ctrl = 0;
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301943 int pctrl = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001944
1945 /* Way Size 010(0x2) 32KB */
1946 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
1947 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
1948 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
1949
Taniya Das379b5682011-12-02 14:53:46 +05301950 if (cpu_is_msm8625()) {
1951 /* Way Size 011(0x3) 64KB */
1952 aux_ctrl |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
1953 (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | \
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301954 (0X1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) | \
1955 (0x1 << L2X0_AUX_CTRL_L2_FORCE_NWA_SHIFT);
1956
1957 /* Write Prefetch Control settings */
1958 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
1959 pctrl |= (0x3 << L2X0_PREFETCH_CTRL_OFFSET_SHIFT) | \
1960 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_INC_SHIFT) | \
1961 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_SHIFT);
1962 writel_relaxed(pctrl , MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
Taniya Das379b5682011-12-02 14:53:46 +05301963 }
1964
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001965 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301966 if (cpu_is_msm8625()) {
1967 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
1968 pr_info("Prfetch Ctrl: 0x%08x\n", pctrl);
1969 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001970
1971 return 0;
1972}
1973#else
pankaj kumar80d7cb62011-08-23 13:37:55 +05301974static int __init msm7x27x_cache_init(void){ return 0; }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001975#endif
1976
1977void __init msm_common_io_init(void)
1978{
1979 msm_map_common_io();
Taniya Das43bcdd62011-12-02 17:33:27 +05301980 if (socinfo_init() < 0)
1981 pr_err("%s: socinfo_init() failed!\n", __func__);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001982 msm7x27x_cache_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301983}
1984
1985void __init msm8625_init_irq(void)
1986{
Trilok Soni1a9fdee2012-05-28 19:54:11 +05301987 msm_gic_irq_extn_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301988 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1989 (void *)MSM_QGIC_CPU_BASE);
Taniya Das43bcdd62011-12-02 17:33:27 +05301990}
1991
1992void __init msm8625_map_io(void)
1993{
1994 msm_map_msm8625_io();
1995
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001996 if (socinfo_init() < 0)
1997 pr_err("%s: socinfo_init() failed!\n", __func__);
Taniya Das379b5682011-12-02 14:53:46 +05301998 msm7x27x_cache_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001999}
2000
Taniya Das43bcdd62011-12-02 17:33:27 +05302001static int msm7627a_init_gpio(void)
2002{
Taniya Das6684d622012-01-12 10:29:09 +05302003 if (cpu_is_msm8625())
2004 platform_device_register(&msm8625_device_gpio);
2005 else
2006 platform_device_register(&msm_device_gpio);
Taniya Das43bcdd62011-12-02 17:33:27 +05302007 return 0;
2008}
2009postcore_initcall(msm7627a_init_gpio);
Taniya Das9d0c3c52012-05-04 14:40:55 +05302010
2011static int msm7627a_panic_handler(struct notifier_block *this,
2012 unsigned long event, void *ptr)
2013{
2014 flush_cache_all();
2015 outer_flush_all();
2016 return NOTIFY_DONE;
2017}
2018
2019static struct notifier_block panic_handler = {
2020 .notifier_call = msm7627a_panic_handler,
2021};
2022
2023static int __init panic_register(void)
2024{
2025 atomic_notifier_chain_register(&panic_notifier_list,
2026 &panic_handler);
2027 return 0;
2028}
2029module_init(panic_register);