blob: c08de763bf304c75e92426072a925c64ec81bf14 [file] [log] [blame]
Duy Truonge833aca2013-02-12 13:35:08 -08001/* Copyright (c) 2011-2012, The Linux Foundation. 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>
Matt Wagantalld55b90f2012-02-23 23:27:44 -080033#include <mach/clk-provider.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070034
35#include "devices.h"
36#include "devices-msm7x2xa.h"
37#include "footswitch.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070038#include "acpuclock.h"
Murali Nalajala41786ab2012-03-06 10:47:32 +053039#include "spm.h"
Taniya Dasfcb35002012-03-09 15:28:12 +053040#include "mpm-8625.h"
Murali Nalajala2a0bbda2012-03-28 12:12:54 +053041#include "irq.h"
42#include "pm.h"
Kaushal Kumar622828f2012-07-31 16:07:49 +053043#include "msm_cpr.h"
44#include "msm_smem_iface.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070045
46/* Address of GSBI blocks */
47#define MSM_GSBI0_PHYS 0xA1200000
48#define MSM_GSBI1_PHYS 0xA1300000
49
50/* GSBI QUPe devices */
51#define MSM_GSBI0_QUP_PHYS (MSM_GSBI0_PHYS + 0x80000)
52#define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000)
53
Kaushal Kumar622828f2012-07-31 16:07:49 +053054#define A11S_TEST_BUS_SEL_ADDR (MSM_CSR_BASE + 0x518)
55#define RBCPR_CLK_MUX_SEL (1 << 13)
56
57/* Reset Address of RBCPR (Active Low)*/
58#define RBCPR_SW_RESET_N (MSM_CSR_BASE + 0x64)
59
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070060static struct resource gsbi0_qup_i2c_resources[] = {
61 {
62 .name = "qup_phys_addr",
63 .start = MSM_GSBI0_QUP_PHYS,
64 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
65 .flags = IORESOURCE_MEM,
66 },
67 {
68 .name = "gsbi_qup_i2c_addr",
69 .start = MSM_GSBI0_PHYS,
70 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
71 .flags = IORESOURCE_MEM,
72 },
73 {
74 .name = "qup_err_intr",
75 .start = INT_PWB_I2C,
76 .end = INT_PWB_I2C,
77 .flags = IORESOURCE_IRQ,
78 },
79};
80
81/* Use GSBI0 QUP for /dev/i2c-0 */
82struct platform_device msm_gsbi0_qup_i2c_device = {
83 .name = "qup_i2c",
84 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
85 .num_resources = ARRAY_SIZE(gsbi0_qup_i2c_resources),
86 .resource = gsbi0_qup_i2c_resources,
87};
88
89static struct resource gsbi1_qup_i2c_resources[] = {
90 {
91 .name = "qup_phys_addr",
92 .start = MSM_GSBI1_QUP_PHYS,
93 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
94 .flags = IORESOURCE_MEM,
95 },
96 {
97 .name = "gsbi_qup_i2c_addr",
98 .start = MSM_GSBI1_PHYS,
99 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
100 .flags = IORESOURCE_MEM,
101 },
102 {
103 .name = "qup_err_intr",
104 .start = INT_ARM11_DMA,
105 .end = INT_ARM11_DMA,
106 .flags = IORESOURCE_IRQ,
107 },
108};
109
110/* Use GSBI1 QUP for /dev/i2c-1 */
111struct platform_device msm_gsbi1_qup_i2c_device = {
112 .name = "qup_i2c",
113 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
114 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
115 .resource = gsbi1_qup_i2c_resources,
116};
117
118#define MSM_HSUSB_PHYS 0xA0800000
119static struct resource resources_hsusb_otg[] = {
120 {
121 .start = MSM_HSUSB_PHYS,
122 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
123 .flags = IORESOURCE_MEM,
124 },
125 {
126 .start = INT_USB_HS,
127 .end = INT_USB_HS,
128 .flags = IORESOURCE_IRQ,
129 },
130};
131
132static u64 dma_mask = 0xffffffffULL;
133struct platform_device msm_device_otg = {
134 .name = "msm_otg",
135 .id = -1,
136 .num_resources = ARRAY_SIZE(resources_hsusb_otg),
137 .resource = resources_hsusb_otg,
138 .dev = {
139 .dma_mask = &dma_mask,
140 .coherent_dma_mask = 0xffffffffULL,
141 },
142};
143
144static struct resource resources_gadget_peripheral[] = {
145 {
146 .start = MSM_HSUSB_PHYS,
147 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
148 .flags = IORESOURCE_MEM,
149 },
150 {
151 .start = INT_USB_HS,
152 .end = INT_USB_HS,
153 .flags = IORESOURCE_IRQ,
154 },
155};
156
157struct platform_device msm_device_gadget_peripheral = {
158 .name = "msm_hsusb",
159 .id = -1,
160 .num_resources = ARRAY_SIZE(resources_gadget_peripheral),
161 .resource = resources_gadget_peripheral,
162 .dev = {
163 .dma_mask = &dma_mask,
164 .coherent_dma_mask = 0xffffffffULL,
165 },
166};
167
168static struct resource resources_hsusb_host[] = {
169 {
170 .start = MSM_HSUSB_PHYS,
171 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
172 .flags = IORESOURCE_MEM,
173 },
174 {
175 .start = INT_USB_HS,
176 .end = INT_USB_HS,
177 .flags = IORESOURCE_IRQ,
178 },
179};
180
181struct platform_device msm_device_hsusb_host = {
182 .name = "msm_hsusb_host",
183 .id = 0,
184 .num_resources = ARRAY_SIZE(resources_hsusb_host),
185 .resource = resources_hsusb_host,
186 .dev = {
187 .dma_mask = &dma_mask,
188 .coherent_dma_mask = 0xffffffffULL,
189 },
190};
191
192static struct platform_device *msm_host_devices[] = {
193 &msm_device_hsusb_host,
194};
195
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700196static struct resource msm_dmov_resource[] = {
197 {
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700198 .start = INT_ADM_AARM,
199 .flags = IORESOURCE_IRQ,
200 },
201 {
202 .start = 0xA9700000,
203 .end = 0xA9700000 + SZ_4K - 1,
204 .flags = IORESOURCE_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700205 },
206};
207
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700208static struct msm_dmov_pdata msm_dmov_pdata = {
209 .sd = 3,
210 .sd_size = 0x400,
211};
212
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700213struct platform_device msm_device_dmov = {
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700214 .name = "msm_dmov",
215 .id = -1,
216 .resource = msm_dmov_resource,
217 .num_resources = ARRAY_SIZE(msm_dmov_resource),
218 .dev = {
219 .platform_data = &msm_dmov_pdata,
220 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700221};
222
Matt Wagantallbf430eb2012-03-22 11:45:49 -0700223static struct acpuclk_pdata msm7x27a_acpuclk_pdata = {
224 .max_speed_delta_khz = 400000,
225};
226
227struct platform_device msm7x27a_device_acpuclk = {
228 .name = "acpuclk-7627",
229 .id = -1,
230 .dev.platform_data = &msm7x27a_acpuclk_pdata,
231};
232
233static struct acpuclk_pdata msm7x27aa_acpuclk_pdata = {
234 .max_speed_delta_khz = 504000,
235};
236
237struct platform_device msm7x27aa_device_acpuclk = {
238 .name = "acpuclk-7627",
239 .id = -1,
240 .dev.platform_data = &msm7x27aa_acpuclk_pdata,
241};
242
243static struct acpuclk_pdata msm8625_acpuclk_pdata = {
244 /* TODO: Need to update speed delta from H/w Team */
245 .max_speed_delta_khz = 604800,
246};
247
Kaushal Kumar86473f02012-06-28 19:35:58 +0530248static struct acpuclk_pdata msm8625ab_acpuclk_pdata = {
249 .max_speed_delta_khz = 801600,
250};
251
Matt Wagantallbf430eb2012-03-22 11:45:49 -0700252struct platform_device msm8625_device_acpuclk = {
253 .name = "acpuclk-7627",
254 .id = -1,
255 .dev.platform_data = &msm8625_acpuclk_pdata,
256};
257
Kaushal Kumar86473f02012-06-28 19:35:58 +0530258struct platform_device msm8625ab_device_acpuclk = {
259 .name = "acpuclk-7627",
260 .id = -1,
261 .dev.platform_data = &msm8625ab_acpuclk_pdata,
262};
263
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700264struct platform_device msm_device_smd = {
265 .name = "msm_smd",
266 .id = -1,
267};
268
Angshuman Sarkarfb1cce92012-02-21 15:20:43 +0530269static struct resource smd_8625_resource[] = {
270 {
271 .name = "a9_m2a_0",
272 .start = MSM8625_INT_A9_M2A_0,
273 .flags = IORESOURCE_IRQ,
274 },
275 {
276 .name = "a9_m2a_5",
277 .start = MSM8625_INT_A9_M2A_5,
278 .flags = IORESOURCE_IRQ,
279 },
280};
281
282static struct smd_subsystem_config smd_8625_config_list[] = {
283 {
284 .irq_config_id = SMD_MODEM,
285 .subsys_name = "modem",
286 .edge = SMD_APPS_MODEM,
287
288 .smd_int.irq_name = "a9_m2a_0",
289 .smd_int.flags = IRQF_TRIGGER_RISING,
290 .smd_int.irq_id = -1,
291 .smd_int.device_name = "smd_dev",
292 .smd_int.dev_id = 0,
293
294 .smd_int.out_bit_pos = 1,
295 .smd_int.out_base = (void __iomem *)MSM_CSR_BASE,
296 .smd_int.out_offset = 0x400 + (0) * 4,
297
298 .smsm_int.irq_name = "a9_m2a_5",
299 .smsm_int.flags = IRQF_TRIGGER_RISING,
300 .smsm_int.irq_id = -1,
301 .smsm_int.device_name = "smsm_dev",
302 .smsm_int.dev_id = 0,
303
304 .smsm_int.out_bit_pos = 1,
305 .smsm_int.out_base = (void __iomem *)MSM_CSR_BASE,
306 .smsm_int.out_offset = 0x400 + (5) * 4,
307
308 }
309};
310
311static struct smd_platform smd_8625_platform_data = {
312 .num_ss_configs = ARRAY_SIZE(smd_8625_config_list),
313 .smd_ss_configs = smd_8625_config_list,
314};
315
316struct platform_device msm8625_device_smd = {
317 .name = "msm_smd",
318 .id = -1,
319 .resource = smd_8625_resource,
320 .num_resources = ARRAY_SIZE(smd_8625_resource),
321 .dev = {
322 .platform_data = &smd_8625_platform_data,
323 }
324};
325
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +0530326static struct resource resources_adsp[] = {
327 {
328 .start = INT_ADSP_A9_A11,
329 .end = INT_ADSP_A9_A11,
330 .flags = IORESOURCE_IRQ,
331 },
332};
333
334struct platform_device msm_adsp_device = {
335 .name = "msm_adsp",
336 .id = -1,
337 .num_resources = ARRAY_SIZE(resources_adsp),
338 .resource = resources_adsp,
339};
340
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700341static struct resource resources_uart1[] = {
342 {
343 .start = INT_UART1,
344 .end = INT_UART1,
345 .flags = IORESOURCE_IRQ,
346 },
347 {
Taniya Das13b811a2011-12-09 18:33:45 +0530348 .start = MSM7XXX_UART1_PHYS,
349 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700350 .flags = IORESOURCE_MEM,
351 },
352};
353
354struct platform_device msm_device_uart1 = {
355 .name = "msm_serial",
356 .id = 0,
357 .num_resources = ARRAY_SIZE(resources_uart1),
358 .resource = resources_uart1,
359};
360
361#define MSM_UART1DM_PHYS 0xA0200000
362static struct resource msm_uart1_dm_resources[] = {
363 {
364 .start = MSM_UART1DM_PHYS,
365 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
366 .flags = IORESOURCE_MEM,
367 },
368 {
369 .start = INT_UART1DM_IRQ,
370 .end = INT_UART1DM_IRQ,
371 .flags = IORESOURCE_IRQ,
372 },
373 {
374 .start = INT_UART1DM_RX,
375 .end = INT_UART1DM_RX,
376 .flags = IORESOURCE_IRQ,
377 },
378 {
379 .start = DMOV_HSUART1_TX_CHAN,
380 .end = DMOV_HSUART1_RX_CHAN,
381 .name = "uartdm_channels",
382 .flags = IORESOURCE_DMA,
383 },
384 {
385 .start = DMOV_HSUART1_TX_CRCI,
386 .end = DMOV_HSUART1_RX_CRCI,
387 .name = "uartdm_crci",
388 .flags = IORESOURCE_DMA,
389 },
390};
391
392static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32);
393struct platform_device msm_device_uart_dm1 = {
394 .name = "msm_serial_hs",
395 .id = 0,
396 .num_resources = ARRAY_SIZE(msm_uart1_dm_resources),
397 .resource = msm_uart1_dm_resources,
398 .dev = {
399 .dma_mask = &msm_uart_dm1_dma_mask,
400 .coherent_dma_mask = DMA_BIT_MASK(32),
401 },
402};
403
404#define MSM_UART2DM_PHYS 0xA0300000
405static struct resource msm_uart2dm_resources[] = {
406 {
407 .start = MSM_UART2DM_PHYS,
408 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
409 .name = "uartdm_resource",
410 .flags = IORESOURCE_MEM,
411 },
412 {
413 .start = INT_UART2DM_IRQ,
414 .end = INT_UART2DM_IRQ,
415 .flags = IORESOURCE_IRQ,
416 },
417};
418
419struct platform_device msm_device_uart_dm2 = {
420 .name = "msm_serial_hsl",
421 .id = 0,
422 .num_resources = ARRAY_SIZE(msm_uart2dm_resources),
423 .resource = msm_uart2dm_resources,
424};
425
426#define MSM_NAND_PHYS 0xA0A00000
427#define MSM_NANDC01_PHYS 0xA0A40000
428#define MSM_NANDC10_PHYS 0xA0A80000
429#define MSM_NANDC11_PHYS 0xA0AC0000
430#define EBI2_REG_BASE 0xA0D00000
431static struct resource resources_nand[] = {
432 [0] = {
433 .name = "msm_nand_dmac",
434 .start = DMOV_NAND_CHAN,
435 .end = DMOV_NAND_CHAN,
436 .flags = IORESOURCE_DMA,
437 },
438 [1] = {
439 .name = "msm_nand_phys",
440 .start = MSM_NAND_PHYS,
441 .end = MSM_NAND_PHYS + 0x7FF,
442 .flags = IORESOURCE_MEM,
443 },
444 [2] = {
445 .name = "msm_nandc01_phys",
446 .start = MSM_NANDC01_PHYS,
447 .end = MSM_NANDC01_PHYS + 0x7FF,
448 .flags = IORESOURCE_MEM,
449 },
450 [3] = {
451 .name = "msm_nandc10_phys",
452 .start = MSM_NANDC10_PHYS,
453 .end = MSM_NANDC10_PHYS + 0x7FF,
454 .flags = IORESOURCE_MEM,
455 },
456 [4] = {
457 .name = "msm_nandc11_phys",
458 .start = MSM_NANDC11_PHYS,
459 .end = MSM_NANDC11_PHYS + 0x7FF,
460 .flags = IORESOURCE_MEM,
461 },
462 [5] = {
463 .name = "ebi2_reg_base",
464 .start = EBI2_REG_BASE,
465 .end = EBI2_REG_BASE + 0x60,
466 .flags = IORESOURCE_MEM,
467 },
468};
469
Sujit Reddy Thummaec9b3252012-04-23 15:53:45 +0530470struct flash_platform_data msm_nand_data = {
471 .version = VERSION_2,
472};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700473
474struct platform_device msm_device_nand = {
475 .name = "msm_nand",
476 .id = -1,
477 .num_resources = ARRAY_SIZE(resources_nand),
478 .resource = resources_nand,
479 .dev = {
480 .platform_data = &msm_nand_data,
481 },
482};
483
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530484static struct msm_pm_irq_calls msm7x27a_pm_irq_calls = {
485 .irq_pending = msm_irq_pending,
486 .idle_sleep_allowed = msm_irq_idle_sleep_allowed,
487 .enter_sleep1 = msm_irq_enter_sleep1,
488 .enter_sleep2 = msm_irq_enter_sleep2,
489 .exit_sleep1 = msm_irq_exit_sleep1,
490 .exit_sleep2 = msm_irq_exit_sleep2,
491 .exit_sleep3 = msm_irq_exit_sleep3,
492};
493
494static struct msm_pm_irq_calls msm8625_pm_irq_calls = {
495 .irq_pending = msm_gic_spi_ppi_pending,
496 .idle_sleep_allowed = msm_gic_irq_idle_sleep_allowed,
497 .enter_sleep1 = msm_gic_irq_enter_sleep1,
498 .enter_sleep2 = msm_gic_irq_enter_sleep2,
499 .exit_sleep1 = msm_gic_irq_exit_sleep1,
500 .exit_sleep2 = msm_gic_irq_exit_sleep2,
501 .exit_sleep3 = msm_gic_irq_exit_sleep3,
502};
503
Stephen Boyd986c9632012-04-24 16:31:45 -0700504void __init msm_pm_register_irqs(void)
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530505{
506 if (cpu_is_msm8625())
507 msm_pm_set_irq_extns(&msm8625_pm_irq_calls);
508 else
509 msm_pm_set_irq_extns(&msm7x27a_pm_irq_calls);
510
511}
512
Murali Nalajala0ac89b42012-07-13 16:54:40 +0530513static struct msm_pm_cpr_ops msm8625_pm_cpr_ops = {
514 .cpr_suspend = msm_cpr_pm_suspend,
515 .cpr_resume = msm_cpr_pm_resume,
516};
517
518void __init msm_pm_register_cpr_ops(void)
519{
520 /* CPR presents on revision >= v2.0 chipsets */
521 if (cpu_is_msm8625() &&
522 SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
523 msm_pm_set_cpr_ops(&msm8625_pm_cpr_ops);
524}
525
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700526#define MSM_SDC1_BASE 0xA0400000
527#define MSM_SDC2_BASE 0xA0500000
528#define MSM_SDC3_BASE 0xA0600000
529#define MSM_SDC4_BASE 0xA0700000
530static struct resource resources_sdc1[] = {
531 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530532 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700533 .start = MSM_SDC1_BASE,
534 .end = MSM_SDC1_BASE + SZ_4K - 1,
535 .flags = IORESOURCE_MEM,
536 },
537 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530538 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700539 .start = INT_SDC1_0,
540 .end = INT_SDC1_1,
541 .flags = IORESOURCE_IRQ,
542 },
543 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530544 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700545 .start = DMOV_SDC1_CHAN,
546 .end = DMOV_SDC1_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700547 .flags = IORESOURCE_DMA,
548 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700549 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530550 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700551 .start = DMOV_SDC1_CRCI,
552 .end = DMOV_SDC1_CRCI,
553 .flags = IORESOURCE_DMA,
554 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700555};
556
557static struct resource resources_sdc2[] = {
558 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530559 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700560 .start = MSM_SDC2_BASE,
561 .end = MSM_SDC2_BASE + SZ_4K - 1,
562 .flags = IORESOURCE_MEM,
563 },
564 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530565 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700566 .start = INT_SDC2_0,
567 .end = INT_SDC2_1,
568 .flags = IORESOURCE_IRQ,
569 },
570 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530571 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700572 .start = DMOV_SDC2_CHAN,
573 .end = DMOV_SDC2_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700574 .flags = IORESOURCE_DMA,
575 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700576 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530577 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700578 .start = DMOV_SDC2_CRCI,
579 .end = DMOV_SDC2_CRCI,
580 .flags = IORESOURCE_DMA,
581 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700582};
583
584static struct resource resources_sdc3[] = {
585 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530586 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700587 .start = MSM_SDC3_BASE,
588 .end = MSM_SDC3_BASE + SZ_4K - 1,
589 .flags = IORESOURCE_MEM,
590 },
591 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530592 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700593 .start = INT_SDC3_0,
594 .end = INT_SDC3_1,
595 .flags = IORESOURCE_IRQ,
596 },
597 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530598 .name = "dma_chnl",
Subhash Jadavanif29aefd2012-06-21 00:43:15 +0530599 .start = DMOV_NAND_CHAN,
600 .end = DMOV_NAND_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700601 .flags = IORESOURCE_DMA,
602 },
603 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530604 .name = "dma_crci",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530605 .start = DMOV_SDC3_CRCI,
606 .end = DMOV_SDC3_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700607 .flags = IORESOURCE_DMA,
608 },
609};
610
611static struct resource resources_sdc4[] = {
612 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530613 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700614 .start = MSM_SDC4_BASE,
615 .end = MSM_SDC4_BASE + SZ_4K - 1,
616 .flags = IORESOURCE_MEM,
617 },
618 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530619 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700620 .start = INT_SDC4_0,
621 .end = INT_SDC4_1,
622 .flags = IORESOURCE_IRQ,
623 },
624 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530625 .name = "dma_chnl",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530626 .start = DMOV_SDC4_CHAN,
627 .end = DMOV_SDC4_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700628 .flags = IORESOURCE_DMA,
629 },
630 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530631 .name = "dma_crci",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530632 .start = DMOV_SDC4_CRCI,
633 .end = DMOV_SDC4_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700634 .flags = IORESOURCE_DMA,
635 },
636};
637
638struct platform_device msm_device_sdc1 = {
639 .name = "msm_sdcc",
640 .id = 1,
641 .num_resources = ARRAY_SIZE(resources_sdc1),
642 .resource = resources_sdc1,
643 .dev = {
644 .coherent_dma_mask = 0xffffffff,
645 },
646};
647
648struct platform_device msm_device_sdc2 = {
649 .name = "msm_sdcc",
650 .id = 2,
651 .num_resources = ARRAY_SIZE(resources_sdc2),
652 .resource = resources_sdc2,
653 .dev = {
654 .coherent_dma_mask = 0xffffffff,
655 },
656};
657
658struct platform_device msm_device_sdc3 = {
659 .name = "msm_sdcc",
660 .id = 3,
661 .num_resources = ARRAY_SIZE(resources_sdc3),
662 .resource = resources_sdc3,
663 .dev = {
664 .coherent_dma_mask = 0xffffffff,
665 },
666};
667
668struct platform_device msm_device_sdc4 = {
669 .name = "msm_sdcc",
670 .id = 4,
671 .num_resources = ARRAY_SIZE(resources_sdc4),
672 .resource = resources_sdc4,
673 .dev = {
674 .coherent_dma_mask = 0xffffffff,
675 },
676};
677
678static struct platform_device *msm_sdcc_devices[] __initdata = {
679 &msm_device_sdc1,
680 &msm_device_sdc2,
681 &msm_device_sdc3,
682 &msm_device_sdc4,
683};
684
Suresh Vankadara20cd3be2012-01-18 00:34:06 +0530685#ifdef CONFIG_MSM_CAMERA_V4L2
Suresh Vankadara6050cef52012-04-16 21:44:59 +0530686static int apps_reset;
Suresh Vankadara20cd3be2012-01-18 00:34:06 +0530687static struct resource msm_csic0_resources[] = {
688 {
689 .name = "csic",
690 .start = 0xA0F00000,
691 .end = 0xA0F00000 + 0x00100000 - 1,
692 .flags = IORESOURCE_MEM,
693 },
694 {
695 .name = "csic",
696 .start = INT_CSI_IRQ_0,
697 .end = INT_CSI_IRQ_0,
698 .flags = IORESOURCE_IRQ,
699 },
700};
701
702static struct resource msm_csic1_resources[] = {
703 {
704 .name = "csic",
705 .start = 0xA1000000,
706 .end = 0xA1000000 + 0x00100000 - 1,
707 .flags = IORESOURCE_MEM,
708 },
709 {
710 .name = "csic",
711 .start = INT_CSI_IRQ_1,
712 .end = INT_CSI_IRQ_1,
713 .flags = IORESOURCE_IRQ,
714 },
715};
716
717struct platform_device msm7x27a_device_csic0 = {
718 .name = "msm_csic",
719 .id = 0,
720 .resource = msm_csic0_resources,
721 .num_resources = ARRAY_SIZE(msm_csic0_resources),
722};
723
724struct platform_device msm7x27a_device_csic1 = {
725 .name = "msm_csic",
726 .id = 1,
727 .resource = msm_csic1_resources,
728 .num_resources = ARRAY_SIZE(msm_csic1_resources),
729};
730
731static struct resource msm_clkctl_resources[] = {
732 {
733 .name = "clk_ctl",
Taniya Das13b811a2011-12-09 18:33:45 +0530734 .start = MSM7XXX_CLK_CTL_PHYS,
735 .end = MSM7XXX_CLK_CTL_PHYS + MSM7XXX_CLK_CTL_SIZE - 1,
Suresh Vankadara20cd3be2012-01-18 00:34:06 +0530736 .flags = IORESOURCE_MEM,
737 },
738};
739struct platform_device msm7x27a_device_clkctl = {
740 .name = "msm_clk_ctl",
741 .id = 0,
742 .resource = msm_clkctl_resources,
743 .num_resources = ARRAY_SIZE(msm_clkctl_resources),
Suresh Vankadara6050cef52012-04-16 21:44:59 +0530744 .dev = {
745 .platform_data = &apps_reset,
746 },
Suresh Vankadara20cd3be2012-01-18 00:34:06 +0530747};
748
749struct platform_device msm7x27a_device_vfe = {
750 .name = "msm_vfe",
751 .id = 0,
752};
753
754#endif
755
Murali Nalajala41786ab2012-03-06 10:47:32 +0530756/* Command sequence for simple WFI */
757static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Murali Nalajala2250a272012-03-13 15:56:59 +0530758 0x04, 0x03, 0x04, 0x0f,
Murali Nalajala41786ab2012-03-06 10:47:32 +0530759};
760
761/* Command sequence for GDFS, this won't send any interrupt to the modem */
762static uint8_t spm_pc_without_modem[] __initdata = {
763 0x20, 0x00, 0x30, 0x10,
Murali Nalajala2250a272012-03-13 15:56:59 +0530764 0x03, 0x1e, 0x0e, 0x3e,
765 0x4e, 0x4e, 0x4e, 0x4e,
766 0x4e, 0x4e, 0x4e, 0x4e,
767 0x4e, 0x4e, 0x4e, 0x4e,
768 0x4e, 0x4e, 0x4e, 0x4e,
769 0x2E, 0x0f,
Murali Nalajala41786ab2012-03-06 10:47:32 +0530770};
771
772static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
773 [0] = {
774 .mode = MSM_SPM_MODE_CLOCK_GATING,
775 .notify_rpm = false,
776 .cmd = spm_wfi_cmd_sequence,
777 },
778 [1] = {
779 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
780 .notify_rpm = false,
781 .cmd = spm_pc_without_modem,
782 },
783};
784
785static struct msm_spm_platform_data msm_spm_data[] __initdata = {
786 [0] = {
787 .reg_base_addr = MSM_SAW0_BASE,
788 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
789 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
790 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
791 .modes = msm_spm_seq_list,
792 },
793 [1] = {
794 .reg_base_addr = MSM_SAW1_BASE,
795 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
796 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
797 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
798 .modes = msm_spm_seq_list,
799 },
800};
801
802void __init msm8x25_spm_device_init(void)
803{
804 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
805}
806
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700807#define MDP_BASE 0xAA200000
808#define MIPI_DSI_HW_BASE 0xA1100000
809
810static struct resource msm_mipi_dsi_resources[] = {
811 {
812 .name = "mipi_dsi",
813 .start = MIPI_DSI_HW_BASE,
814 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
815 .flags = IORESOURCE_MEM,
816 },
817 {
818 .start = INT_DSI_IRQ,
819 .end = INT_DSI_IRQ,
820 .flags = IORESOURCE_IRQ,
821 },
822};
823
824static struct platform_device msm_mipi_dsi_device = {
825 .name = "mipi_dsi",
826 .id = 1,
827 .num_resources = ARRAY_SIZE(msm_mipi_dsi_resources),
828 .resource = msm_mipi_dsi_resources,
829};
830
831static struct resource msm_mdp_resources[] = {
832 {
833 .name = "mdp",
834 .start = MDP_BASE,
835 .end = MDP_BASE + 0x000F1008 - 1,
836 .flags = IORESOURCE_MEM,
837 },
838 {
839 .start = INT_MDP,
840 .end = INT_MDP,
841 .flags = IORESOURCE_IRQ,
842 },
843};
844
845static struct platform_device msm_mdp_device = {
846 .name = "mdp",
847 .id = 0,
848 .num_resources = ARRAY_SIZE(msm_mdp_resources),
849 .resource = msm_mdp_resources,
850};
851
852static struct platform_device msm_lcdc_device = {
853 .name = "lcdc",
854 .id = 0,
855};
856
857static struct resource kgsl_3d0_resources[] = {
858 {
859 .name = KGSL_3D0_REG_MEMORY,
860 .start = 0xA0000000,
861 .end = 0xA001ffff,
862 .flags = IORESOURCE_MEM,
863 },
864 {
865 .name = KGSL_3D0_IRQ,
866 .start = INT_GRAPHICS,
867 .end = INT_GRAPHICS,
868 .flags = IORESOURCE_IRQ,
869 },
870};
871
872static struct kgsl_device_platform_data kgsl_3d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600873 .pwrlevel = {
874 {
875 .gpu_freq = 245760000,
876 .bus_freq = 200000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700877 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600878 {
Lynus Vazeaf0aac2012-01-05 12:28:47 +0530879 .gpu_freq = 192000000,
880 .bus_freq = 160000000,
881 },
882 {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600883 .gpu_freq = 133330000,
884 .bus_freq = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700885 },
886 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600887 .init_level = 0,
Lynus Vazeaf0aac2012-01-05 12:28:47 +0530888 .num_levels = 3,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600889 .set_grp_async = set_grp_xbar_async,
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700890 .idle_timeout = HZ,
Lynus Vazfe4bede2012-04-06 11:53:30 -0700891 .strtstp_sleepwake = true,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600892 .nap_allowed = false,
893 .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700894};
895
896struct platform_device msm_kgsl_3d0 = {
897 .name = "kgsl-3d0",
898 .id = 0,
899 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
900 .resource = kgsl_3d0_resources,
901 .dev = {
902 .platform_data = &kgsl_3d0_pdata,
903 },
904};
905
906void __init msm7x25a_kgsl_3d0_init(void)
907{
Pankaj Kumarfee56a82012-04-17 14:26:49 +0530908 if (cpu_is_msm7x25a() || cpu_is_msm7x25aa() || cpu_is_msm7x25ab()) {
Lynus Vaz971610e2012-01-06 11:00:32 +0530909 kgsl_3d0_pdata.num_levels = 2;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600910 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 133330000;
911 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 160000000;
912 kgsl_3d0_pdata.pwrlevel[1].gpu_freq = 96000000;
913 kgsl_3d0_pdata.pwrlevel[1].bus_freq = 0;
Rajesh Kemisettidf6e62f2012-03-12 14:02:30 +0530914 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700915}
916
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700917void __init msm8x25_kgsl_3d0_init(void)
918{
Lynus Vazfe4bede2012-04-06 11:53:30 -0700919 if (cpu_is_msm8625()) {
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700920 kgsl_3d0_pdata.idle_timeout = HZ/5;
Lynus Vazfe4bede2012-04-06 11:53:30 -0700921 kgsl_3d0_pdata.strtstp_sleepwake = false;
Ranjhith Kalisamy24696322012-04-11 22:09:17 +0530922 /* 8x25 supports a higher GPU frequency */
Rajesh Kemisettid41dd802012-07-24 11:31:47 +0530923 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 320000000;
Ranjhith Kalisamy24696322012-04-11 22:09:17 +0530924 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 200000000;
Lynus Vazfe4bede2012-04-06 11:53:30 -0700925 }
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700926}
927
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700928static void __init msm_register_device(struct platform_device *pdev, void *data)
929{
930 int ret;
931
932 pdev->dev.platform_data = data;
933
934 ret = platform_device_register(pdev);
935
936 if (ret)
937 dev_err(&pdev->dev,
938 "%s: platform_device_register() failed = %d\n",
939 __func__, ret);
940}
941
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700942
943#define PERPH_WEB_BLOCK_ADDR (0xA9D00040)
944#define PDM0_CTL_OFFSET (0x04)
945#define SIZE_8B (0x08)
946
947static struct resource resources_led[] = {
948 {
949 .start = PERPH_WEB_BLOCK_ADDR,
950 .end = PERPH_WEB_BLOCK_ADDR + (SIZE_8B) - 1,
951 .name = "led-gpio-pdm",
952 .flags = IORESOURCE_MEM,
953 },
954};
955
956static struct led_info msm_kpbl_pdm_led_pdata = {
957 .name = "keyboard-backlight",
958};
959
960struct platform_device led_pdev = {
961 .name = "leds-msm-pdm",
962 /* use pdev id to represent pdm id */
963 .id = 0,
964 .num_resources = ARRAY_SIZE(resources_led),
965 .resource = resources_led,
966 .dev = {
967 .platform_data = &msm_kpbl_pdm_led_pdata,
968 },
969};
970
Manish Dewangan3a260992011-06-24 18:01:34 +0530971struct platform_device asoc_msm_pcm = {
972 .name = "msm-dsp-audio",
973 .id = 0,
974};
975
976struct platform_device asoc_msm_dai0 = {
977 .name = "msm-codec-dai",
978 .id = 0,
979};
980
981struct platform_device asoc_msm_dai1 = {
982 .name = "msm-cpu-dai",
983 .id = 0,
984};
985
Taniya Das2e948192011-12-20 11:15:13 +0530986static struct resource gpio_resources[] = {
987 {
988 .start = INT_GPIO_GROUP1,
989 .flags = IORESOURCE_IRQ,
990 },
991 {
992 .start = INT_GPIO_GROUP2,
993 .flags = IORESOURCE_IRQ,
994 },
995};
996
997static struct platform_device msm_device_gpio = {
998 .name = "msmgpio",
999 .id = -1,
1000 .resource = gpio_resources,
1001 .num_resources = ARRAY_SIZE(gpio_resources),
1002};
1003
Taniya Das43bcdd62011-12-02 17:33:27 +05301004struct platform_device *msm_footswitch_devices[] = {
Matt Wagantalld6fbf232012-05-03 20:09:28 -07001005 FS_PCOM(FS_GFX3D, "vdd", "kgsl-3d0.0"),
Taniya Das43bcdd62011-12-02 17:33:27 +05301006};
1007unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);
1008
1009/* MSM8625 Devices */
1010
1011static struct resource msm8625_resources_uart1[] = {
1012 {
1013 .start = MSM8625_INT_UART1,
1014 .end = MSM8625_INT_UART1,
1015 .flags = IORESOURCE_IRQ,
1016 },
1017 {
Taniya Das13b811a2011-12-09 18:33:45 +05301018 .start = MSM7XXX_UART1_PHYS,
1019 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Taniya Das43bcdd62011-12-02 17:33:27 +05301020 .flags = IORESOURCE_MEM,
1021 },
1022};
1023
1024struct platform_device msm8625_device_uart1 = {
1025 .name = "msm_serial",
1026 .id = 0,
1027 .num_resources = ARRAY_SIZE(msm8625_resources_uart1),
1028 .resource = msm8625_resources_uart1,
1029};
1030
Trilok Soni269fff42012-02-13 20:35:30 +05301031static struct resource msm8625_uart1_dm_resources[] = {
1032 {
1033 .start = MSM_UART1DM_PHYS,
1034 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
1035 .flags = IORESOURCE_MEM,
1036 },
1037 {
1038 .start = MSM8625_INT_UART1DM_IRQ,
1039 .end = MSM8625_INT_UART1DM_IRQ,
1040 .flags = IORESOURCE_IRQ,
1041 },
1042 {
1043 .start = MSM8625_INT_UART1DM_RX,
1044 .end = MSM8625_INT_UART1DM_RX,
1045 .flags = IORESOURCE_IRQ,
1046 },
1047 {
1048 .start = DMOV_HSUART1_TX_CHAN,
1049 .end = DMOV_HSUART1_RX_CHAN,
1050 .name = "uartdm_channels",
1051 .flags = IORESOURCE_DMA,
1052 },
1053 {
1054 .start = DMOV_HSUART1_TX_CRCI,
1055 .end = DMOV_HSUART1_RX_CRCI,
1056 .name = "uartdm_crci",
1057 .flags = IORESOURCE_DMA,
1058 },
1059};
1060
1061struct platform_device msm8625_device_uart_dm1 = {
1062 .name = "msm_serial_hs",
1063 .id = 0,
1064 .num_resources = ARRAY_SIZE(msm8625_uart1_dm_resources),
1065 .resource = msm8625_uart1_dm_resources,
1066 .dev = {
1067 .dma_mask = &msm_uart_dm1_dma_mask,
1068 .coherent_dma_mask = DMA_BIT_MASK(32),
1069 },
1070};
1071
1072static struct resource msm8625_uart2dm_resources[] = {
1073 {
1074 .start = MSM_UART2DM_PHYS,
1075 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
1076 .name = "uartdm_resource",
1077 .flags = IORESOURCE_MEM,
1078 },
1079 {
1080 .start = MSM8625_INT_UART2DM_IRQ,
1081 .end = MSM8625_INT_UART2DM_IRQ,
1082 .flags = IORESOURCE_IRQ,
1083 },
1084};
1085
1086struct platform_device msm8625_device_uart_dm2 = {
1087 .name = "msm_serial_hsl",
1088 .id = 0,
1089 .num_resources = ARRAY_SIZE(msm8625_uart2dm_resources),
1090 .resource = msm8625_uart2dm_resources,
1091};
1092
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +05301093static struct resource msm8625_resources_adsp[] = {
1094 {
1095 .start = MSM8625_INT_ADSP_A9_A11,
1096 .end = MSM8625_INT_ADSP_A9_A11,
1097 .flags = IORESOURCE_IRQ,
1098 },
1099};
1100
1101struct platform_device msm8625_device_adsp = {
1102 .name = "msm_adsp",
1103 .id = -1,
1104 .num_resources = ARRAY_SIZE(msm8625_resources_adsp),
1105 .resource = msm8625_resources_adsp,
1106};
1107
Taniya Das43bcdd62011-12-02 17:33:27 +05301108static struct resource msm8625_dmov_resource[] = {
1109 {
1110 .start = MSM8625_INT_ADM_AARM,
1111 .flags = IORESOURCE_IRQ,
1112 },
1113 {
1114 .start = 0xA9700000,
1115 .end = 0xA9700000 + SZ_4K - 1,
1116 .flags = IORESOURCE_MEM,
1117 },
1118};
1119
1120struct platform_device msm8625_device_dmov = {
1121 .name = "msm_dmov",
1122 .id = -1,
1123 .resource = msm8625_dmov_resource,
1124 .num_resources = ARRAY_SIZE(msm8625_dmov_resource),
1125 .dev = {
1126 .platform_data = &msm_dmov_pdata,
1127 },
1128};
Taniya Das2e948192011-12-20 11:15:13 +05301129
Taniya Das9d187142011-12-02 15:53:25 +05301130static struct resource gsbi0_msm8625_qup_resources[] = {
1131 {
1132 .name = "qup_phys_addr",
1133 .start = MSM_GSBI0_QUP_PHYS,
1134 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
1135 .flags = IORESOURCE_MEM,
1136 },
1137 {
1138 .name = "gsbi_qup_i2c_addr",
1139 .start = MSM_GSBI0_PHYS,
1140 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
1141 .flags = IORESOURCE_MEM,
1142 },
1143 {
1144 .name = "qup_err_intr",
1145 .start = MSM8625_INT_PWB_I2C,
1146 .end = MSM8625_INT_PWB_I2C,
1147 .flags = IORESOURCE_IRQ,
1148 },
1149};
1150
1151/* Use GSBI0 QUP for /dev/i2c-0 */
Taniya Dase3027e22012-02-27 16:32:27 +05301152struct platform_device msm8625_gsbi0_qup_i2c_device = {
Taniya Das9d187142011-12-02 15:53:25 +05301153 .name = "qup_i2c",
1154 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
1155 .num_resources = ARRAY_SIZE(gsbi0_msm8625_qup_resources),
1156 .resource = gsbi0_msm8625_qup_resources,
1157};
1158
Trilok Soni633e59c2012-02-13 20:28:30 +05301159static struct resource gsbi1_msm8625_qup_i2c_resources[] = {
1160 {
1161 .name = "qup_phys_addr",
1162 .start = MSM_GSBI1_QUP_PHYS,
1163 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
1164 .flags = IORESOURCE_MEM,
1165 },
1166 {
1167 .name = "gsbi_qup_i2c_addr",
1168 .start = MSM_GSBI1_PHYS,
1169 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
1170 .flags = IORESOURCE_MEM,
1171 },
1172 {
1173 .name = "qup_err_intr",
1174 .start = MSM8625_INT_ARM11_DMA,
1175 .end = MSM8625_INT_ARM11_DMA,
1176 .flags = IORESOURCE_IRQ,
1177 },
1178};
1179
1180/* Use GSBI1 QUP for /dev/i2c-1 */
Taniya Dase3027e22012-02-27 16:32:27 +05301181struct platform_device msm8625_gsbi1_qup_i2c_device = {
Trilok Soni633e59c2012-02-13 20:28:30 +05301182 .name = "qup_i2c",
1183 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
1184 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
1185 .resource = gsbi1_msm8625_qup_i2c_resources,
1186};
1187
Taniya Das6684d622012-01-12 10:29:09 +05301188static struct resource msm8625_gpio_resources[] = {
1189 {
1190 .start = MSM8625_INT_GPIO_GROUP1,
1191 .flags = IORESOURCE_IRQ,
1192 },
1193 {
1194 .start = MSM8625_INT_GPIO_GROUP2,
1195 .flags = IORESOURCE_IRQ,
1196 },
1197};
1198
1199static struct platform_device msm8625_device_gpio = {
1200 .name = "msmgpio",
1201 .id = -1,
1202 .resource = msm8625_gpio_resources,
1203 .num_resources = ARRAY_SIZE(msm8625_gpio_resources),
1204};
1205
Trilok Soniee75f6c2012-02-13 20:45:07 +05301206static struct resource msm8625_resources_sdc1[] = {
1207 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301208 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301209 .start = MSM_SDC1_BASE,
1210 .end = MSM_SDC1_BASE + SZ_4K - 1,
1211 .flags = IORESOURCE_MEM,
1212 },
1213 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301214 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301215 .start = MSM8625_INT_SDC1_0,
1216 .end = MSM8625_INT_SDC1_1,
1217 .flags = IORESOURCE_IRQ,
1218 },
1219 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301220 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301221 .start = DMOV_SDC1_CHAN,
1222 .end = DMOV_SDC1_CHAN,
1223 .flags = IORESOURCE_DMA,
1224 },
1225 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301226 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301227 .start = DMOV_SDC1_CRCI,
1228 .end = DMOV_SDC1_CRCI,
1229 .flags = IORESOURCE_DMA,
1230 }
1231};
1232
1233static struct resource msm8625_resources_sdc2[] = {
1234 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301235 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301236 .start = MSM_SDC2_BASE,
1237 .end = MSM_SDC2_BASE + SZ_4K - 1,
1238 .flags = IORESOURCE_MEM,
1239 },
1240 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301241 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301242 .start = MSM8625_INT_SDC2_0,
1243 .end = MSM8625_INT_SDC2_1,
1244 .flags = IORESOURCE_IRQ,
1245 },
1246 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301247 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301248 .start = DMOV_SDC2_CHAN,
1249 .end = DMOV_SDC2_CHAN,
1250 .flags = IORESOURCE_DMA,
1251 },
1252 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301253 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301254 .start = DMOV_SDC2_CRCI,
1255 .end = DMOV_SDC2_CRCI,
1256 .flags = IORESOURCE_DMA,
1257 }
1258};
1259
1260static struct resource msm8625_resources_sdc3[] = {
1261 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301262 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301263 .start = MSM_SDC3_BASE,
1264 .end = MSM_SDC3_BASE + SZ_4K - 1,
1265 .flags = IORESOURCE_MEM,
1266 },
1267 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301268 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301269 .start = MSM8625_INT_SDC3_0,
1270 .end = MSM8625_INT_SDC3_1,
1271 .flags = IORESOURCE_IRQ,
1272 },
1273 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301274 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301275 .start = DMOV_SDC3_CHAN,
1276 .end = DMOV_SDC3_CHAN,
1277 .flags = IORESOURCE_DMA,
1278 },
1279 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301280 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301281 .start = DMOV_SDC3_CRCI,
1282 .end = DMOV_SDC3_CRCI,
1283 .flags = IORESOURCE_DMA,
1284 },
1285};
1286
1287static struct resource msm8625_resources_sdc4[] = {
1288 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301289 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301290 .start = MSM_SDC4_BASE,
1291 .end = MSM_SDC4_BASE + SZ_4K - 1,
1292 .flags = IORESOURCE_MEM,
1293 },
1294 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301295 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301296 .start = MSM8625_INT_SDC4_0,
1297 .end = MSM8625_INT_SDC4_1,
1298 .flags = IORESOURCE_IRQ,
1299 },
1300 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301301 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301302 .start = DMOV_SDC4_CHAN,
1303 .end = DMOV_SDC4_CHAN,
1304 .flags = IORESOURCE_DMA,
1305 },
1306 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301307 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301308 .start = DMOV_SDC4_CRCI,
1309 .end = DMOV_SDC4_CRCI,
1310 .flags = IORESOURCE_DMA,
1311 },
1312};
1313
1314struct platform_device msm8625_device_sdc1 = {
1315 .name = "msm_sdcc",
1316 .id = 1,
1317 .num_resources = ARRAY_SIZE(msm8625_resources_sdc1),
1318 .resource = msm8625_resources_sdc1,
1319 .dev = {
1320 .coherent_dma_mask = 0xffffffff,
1321 },
1322};
1323
1324struct platform_device msm8625_device_sdc2 = {
1325 .name = "msm_sdcc",
1326 .id = 2,
1327 .num_resources = ARRAY_SIZE(msm8625_resources_sdc2),
1328 .resource = msm8625_resources_sdc2,
1329 .dev = {
1330 .coherent_dma_mask = 0xffffffff,
1331 },
1332};
1333
1334struct platform_device msm8625_device_sdc3 = {
1335 .name = "msm_sdcc",
1336 .id = 3,
1337 .num_resources = ARRAY_SIZE(msm8625_resources_sdc3),
1338 .resource = msm8625_resources_sdc3,
1339 .dev = {
1340 .coherent_dma_mask = 0xffffffff,
1341 },
1342};
1343
1344struct platform_device msm8625_device_sdc4 = {
1345 .name = "msm_sdcc",
1346 .id = 4,
1347 .num_resources = ARRAY_SIZE(msm8625_resources_sdc4),
1348 .resource = msm8625_resources_sdc4,
1349 .dev = {
1350 .coherent_dma_mask = 0xffffffff,
1351 },
1352};
1353
1354static struct platform_device *msm8625_sdcc_devices[] __initdata = {
1355 &msm8625_device_sdc1,
1356 &msm8625_device_sdc2,
1357 &msm8625_device_sdc3,
1358 &msm8625_device_sdc4,
1359};
1360
1361int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
1362{
1363 struct platform_device *pdev;
1364
1365 if (controller < 1 || controller > 4)
1366 return -EINVAL;
1367
1368 if (cpu_is_msm8625())
1369 pdev = msm8625_sdcc_devices[controller-1];
1370 else
1371 pdev = msm_sdcc_devices[controller-1];
1372
1373 pdev->dev.platform_data = plat;
1374 return platform_device_register(pdev);
1375}
1376
Trilok Sonida63a8b2012-02-13 20:50:03 +05301377static struct resource msm8625_resources_hsusb_otg[] = {
1378 {
1379 .start = MSM_HSUSB_PHYS,
1380 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1381 .flags = IORESOURCE_MEM,
1382 },
1383 {
1384 .start = MSM8625_INT_USB_HS,
1385 .end = MSM8625_INT_USB_HS,
1386 .flags = IORESOURCE_IRQ,
1387 },
1388};
1389
1390struct platform_device msm8625_device_otg = {
1391 .name = "msm_otg",
1392 .id = -1,
1393 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_otg),
1394 .resource = msm8625_resources_hsusb_otg,
1395 .dev = {
1396 .dma_mask = &dma_mask,
1397 .coherent_dma_mask = 0xffffffffULL,
1398 },
1399};
1400
1401static struct resource msm8625_resources_gadget_peripheral[] = {
1402 {
1403 .start = MSM_HSUSB_PHYS,
1404 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1405 .flags = IORESOURCE_MEM,
1406 },
1407 {
1408 .start = MSM8625_INT_USB_HS,
1409 .end = MSM8625_INT_USB_HS,
1410 .flags = IORESOURCE_IRQ,
1411 },
1412};
1413
1414struct platform_device msm8625_device_gadget_peripheral = {
1415 .name = "msm_hsusb",
1416 .id = -1,
1417 .num_resources = ARRAY_SIZE(msm8625_resources_gadget_peripheral),
1418 .resource = msm8625_resources_gadget_peripheral,
1419 .dev = {
1420 .dma_mask = &dma_mask,
1421 .coherent_dma_mask = 0xffffffffULL,
1422 },
1423};
1424
1425static struct resource msm8625_resources_hsusb_host[] = {
1426 {
1427 .start = MSM_HSUSB_PHYS,
1428 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1429 .flags = IORESOURCE_MEM,
1430 },
1431 {
1432 .start = MSM8625_INT_USB_HS,
1433 .end = MSM8625_INT_USB_HS,
1434 .flags = IORESOURCE_IRQ,
1435 },
1436};
1437
1438struct platform_device msm8625_device_hsusb_host = {
1439 .name = "msm_hsusb_host",
1440 .id = 0,
1441 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_host),
1442 .resource = msm8625_resources_hsusb_host,
1443 .dev = {
1444 .dma_mask = &dma_mask,
1445 .coherent_dma_mask = 0xffffffffULL,
1446 },
1447};
1448
1449static struct platform_device *msm8625_host_devices[] = {
1450 &msm8625_device_hsusb_host,
1451};
1452
1453int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
1454{
1455 struct platform_device *pdev;
1456
1457 if (cpu_is_msm8625())
1458 pdev = msm8625_host_devices[host];
1459 else
1460 pdev = msm_host_devices[host];
1461 if (!pdev)
1462 return -ENODEV;
1463 pdev->dev.platform_data = plat;
1464 return platform_device_register(pdev);
1465}
1466
Trilok Soni88da2552012-02-13 21:01:24 +05301467#ifdef CONFIG_MSM_CAMERA_V4L2
1468static struct resource msm8625_csic0_resources[] = {
1469 {
1470 .name = "csic",
1471 .start = 0xA0F00000,
1472 .end = 0xA0F00000 + 0x00100000 - 1,
1473 .flags = IORESOURCE_MEM,
1474 },
1475 {
1476 .name = "csic",
1477 .start = MSM8625_INT_CSI_IRQ_0,
1478 .end = MSM8625_INT_CSI_IRQ_0,
1479 .flags = IORESOURCE_IRQ,
1480 },
1481};
1482
1483static struct resource msm8625_csic1_resources[] = {
1484 {
1485 .name = "csic",
1486 .start = 0xA1000000,
1487 .end = 0xA1000000 + 0x00100000 - 1,
1488 .flags = IORESOURCE_MEM,
1489 },
1490 {
1491 .name = "csic",
1492 .start = MSM8625_INT_CSI_IRQ_1,
1493 .end = MSM8625_INT_CSI_IRQ_1,
1494 .flags = IORESOURCE_IRQ,
1495 },
1496};
1497
1498struct platform_device msm8625_device_csic0 = {
1499 .name = "msm_csic",
1500 .id = 0,
1501 .resource = msm8625_csic0_resources,
1502 .num_resources = ARRAY_SIZE(msm8625_csic0_resources),
1503};
1504
1505struct platform_device msm8625_device_csic1 = {
1506 .name = "msm_csic",
1507 .id = 1,
1508 .resource = msm8625_csic1_resources,
1509 .num_resources = ARRAY_SIZE(msm8625_csic1_resources),
1510};
1511#endif
1512
Trilok Soniae4633d2012-02-13 21:08:32 +05301513static struct resource msm8625_mipi_dsi_resources[] = {
1514 {
1515 .name = "mipi_dsi",
1516 .start = MIPI_DSI_HW_BASE,
1517 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
1518 .flags = IORESOURCE_MEM,
1519 },
1520 {
1521 .start = MSM8625_INT_DSI_IRQ,
1522 .end = MSM8625_INT_DSI_IRQ,
1523 .flags = IORESOURCE_IRQ,
1524 },
1525};
1526
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301527static struct platform_device msm8625_mipi_dsi_device = {
Trilok Soniae4633d2012-02-13 21:08:32 +05301528 .name = "mipi_dsi",
1529 .id = 1,
1530 .num_resources = ARRAY_SIZE(msm8625_mipi_dsi_resources),
1531 .resource = msm8625_mipi_dsi_resources,
1532};
1533
1534static struct resource msm8625_mdp_resources[] = {
1535 {
1536 .name = "mdp",
1537 .start = MDP_BASE,
1538 .end = MDP_BASE + 0x000F1008 - 1,
1539 .flags = IORESOURCE_MEM,
1540 },
1541 {
1542 .start = MSM8625_INT_MDP,
1543 .end = MSM8625_INT_MDP,
1544 .flags = IORESOURCE_IRQ,
1545 },
1546};
1547
1548static struct platform_device msm8625_mdp_device = {
1549 .name = "mdp",
1550 .id = 0,
1551 .num_resources = ARRAY_SIZE(msm8625_mdp_resources),
1552 .resource = msm8625_mdp_resources,
1553};
1554
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301555struct platform_device mipi_dsi_device;
1556
Trilok Soniae4633d2012-02-13 21:08:32 +05301557void __init msm_fb_register_device(char *name, void *data)
1558{
1559 if (!strncmp(name, "mdp", 3)) {
1560 if (cpu_is_msm8625())
1561 msm_register_device(&msm8625_mdp_device, data);
1562 else
1563 msm_register_device(&msm_mdp_device, data);
1564 } else if (!strncmp(name, "mipi_dsi", 8)) {
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301565 if (cpu_is_msm8625()) {
Trilok Soniae4633d2012-02-13 21:08:32 +05301566 msm_register_device(&msm8625_mipi_dsi_device, data);
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301567 mipi_dsi_device = msm8625_mipi_dsi_device;
1568 } else {
Trilok Soniae4633d2012-02-13 21:08:32 +05301569 msm_register_device(&msm_mipi_dsi_device, data);
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301570 mipi_dsi_device = msm_mipi_dsi_device;
1571 }
Trilok Soniae4633d2012-02-13 21:08:32 +05301572 } else if (!strncmp(name, "lcdc", 4)) {
1573 msm_register_device(&msm_lcdc_device, data);
1574 } else {
1575 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
1576 }
1577}
1578
Trilok Soni664b95d2012-02-13 21:13:15 +05301579static struct resource msm8625_kgsl_3d0_resources[] = {
1580 {
1581 .name = KGSL_3D0_REG_MEMORY,
1582 .start = 0xA0000000,
1583 .end = 0xA001ffff,
1584 .flags = IORESOURCE_MEM,
1585 },
1586 {
1587 .name = KGSL_3D0_IRQ,
1588 .start = MSM8625_INT_GRAPHICS,
1589 .end = MSM8625_INT_GRAPHICS,
1590 .flags = IORESOURCE_IRQ,
1591 },
1592};
1593
1594struct platform_device msm8625_kgsl_3d0 = {
1595 .name = "kgsl-3d0",
1596 .id = 0,
1597 .num_resources = ARRAY_SIZE(msm8625_kgsl_3d0_resources),
1598 .resource = msm8625_kgsl_3d0_resources,
1599 .dev = {
1600 .platform_data = &kgsl_3d0_pdata,
1601 },
1602};
1603
Kaushal Kumar622828f2012-07-31 16:07:49 +05301604static struct resource cpr_resources[] = {
1605 {
1606 .start = MSM8625_INT_CPR_IRQ0,
1607 .flags = IORESOURCE_IRQ,
1608 },
1609 {
1610 .start = MSM8625_CPR_PHYS,
1611 .end = MSM8625_CPR_PHYS + SZ_4K - 1,
1612 .flags = IORESOURCE_MEM,
1613 },
1614};
1615
1616/**
1617 * These are various Vdd levels supported by PMIC
1618 */
1619static uint32_t msm_c2_pmic_mv[] __initdata = {
1620 1300, 12875 / 10, 1275, 12625 / 10, 1250,
1621 12375 / 10, 1225, 12125 / 10, 1200, 11875 / 10,
1622 1175, 11625 / 10, 1150, 11375 / 10, 1125,
1623 11125 / 10, 1100, 10875 / 10, 1075, 10625 / 10,
1624 1050, 10375 / 10, 1025, 10125 / 10, 0, 0, 0, 0,
1625 0, 0, 0, 1000,
1626};
1627
1628/**
1629 * This data will be based on CPR mode of operation
1630 */
1631static struct msm_cpr_mode msm_cpr_mode_data[] = {
1632 [NORMAL_MODE] = {
1633 .ring_osc_data = {
1634 {0, },
1635 {0, },
1636 {0, },
1637 {0, },
1638 {0, },
1639 {0, },
1640 {0, },
1641 {0, },
1642 },
1643 .ring_osc = 0,
1644 .step_quot = ~0,
1645 .tgt_volt_offset = 1,
1646 .Vmax = 1200,
1647 .Vmin = 1000,
1648 .calibrated_mV = 1100,
1649 },
1650 [TURBO_MODE] = {
1651 .ring_osc_data = {
1652 {0, },
1653 {0, },
1654 {0, },
1655 {0, },
1656 {0, },
1657 {0, },
1658 {0, },
1659 {0, },
1660 },
1661 .ring_osc = 0,
1662 .step_quot = ~0,
1663 .tgt_volt_offset = 1,
1664 .Vmax = 1350,
1665 .Vmin = 1250,
1666 .calibrated_mV = 1300,
1667 },
1668};
1669
1670struct msm_cpr_vp_data vp_data = {
1671 .min_volt = 1000,
1672 .max_volt = 1350,
1673 .default_volt = 1300,
1674 .step_size = (12500 / 1000),
1675};
1676
1677static struct msm_cpr_config msm_cpr_pdata = {
1678 .ref_clk_khz = 19200,
1679 .delay_us = 10000,
1680 .irq_line = 0,
1681 .cpr_mode_data = msm_cpr_mode_data,
1682 .tgt_count_div_N = 1,
1683 .floor = 0,
1684 .ceiling = 40,
1685 .sw_vlevel = 20,
1686 .up_threshold = 1,
1687 .dn_threshold = 2,
1688 .up_margin = 0,
1689 .dn_margin = 0,
1690 .nom_freq_limit = 1008000,
1691 .vp_data = &vp_data,
1692};
1693
1694static struct platform_device msm8625_device_cpr = {
1695 .name = "msm-cpr",
1696 .id = -1,
1697 .num_resources = ARRAY_SIZE(cpr_resources),
1698 .resource = cpr_resources,
1699 .dev = {
1700 .platform_data = &msm_cpr_pdata,
1701 },
1702};
1703
1704static struct platform_device msm8625_vp_device = {
1705 .name = "vp-regulator",
1706 .id = -1,
1707};
1708
1709static void __init msm_cpr_init(void)
1710{
1711 struct cpr_info_type *cpr_info = NULL;
1712 uint8_t ring_osc = 0;
1713 uint32_t reg_val;
1714
1715 cpr_info = kzalloc(sizeof(struct cpr_info_type), GFP_KERNEL);
1716 if (!cpr_info) {
1717 pr_err("%s: Out of memory %d\n", __func__, -ENOMEM);
1718 return;
1719 }
1720
1721 msm_smem_get_cpr_info(cpr_info);
1722
1723 /**
1724 * Set the ring_osc based on efuse BIT(0)
1725 * CPR_fuse[0] = 0 selects 2nd RO (010)
1726 * CPR_fuse[0] = 1 select 3rd RO (011)
1727 */
1728 if (cpr_info->ring_osc == 0x0)
1729 ring_osc = 0x2;
1730 else if (cpr_info->ring_osc == 0x1)
1731 ring_osc = 0x3;
1732
1733 msm_cpr_mode_data[TURBO_MODE].ring_osc = ring_osc;
1734 msm_cpr_mode_data[NORMAL_MODE].ring_osc = ring_osc;
1735
1736 /* GCNT = 1000 nsec/52nsec (@TCX0=19.2Mhz) = 19.2 */
1737 msm_cpr_mode_data[TURBO_MODE].ring_osc_data[ring_osc].gcnt = 19;
1738 msm_cpr_mode_data[NORMAL_MODE].ring_osc_data[ring_osc].gcnt = 19;
1739
1740 /* The multiplier and offset are as per PTE data */
1741 msm_cpr_mode_data[TURBO_MODE].ring_osc_data[ring_osc].target_count =
1742 cpr_info->turbo_quot * 10 + 440;
1743 msm_cpr_mode_data[NORMAL_MODE].ring_osc_data[ring_osc].target_count =
1744 cpr_info->turbo_quot / msm_cpr_pdata.tgt_count_div_N;
1745
1746 /**
1747 * Bits 4:0 of pvs_fuse provide mapping to the safe boot up voltage.
1748 * Boot up mode is by default Turbo.
1749 */
1750 msm_cpr_mode_data[TURBO_MODE].calibrated_mV =
1751 msm_c2_pmic_mv[cpr_info->pvs_fuse & 0x1F];
1752
1753 /* TODO: Store the tgt_volt_offset values for the modes from PTE */
1754
1755
1756 pr_debug("%s: cpr: ring_osc: 0x%x\n", __func__,
1757 msm_cpr_mode_data[TURBO_MODE].ring_osc);
1758 pr_debug("%s: cpr: turbo_quot: 0x%x\n", __func__, cpr_info->turbo_quot);
1759 pr_debug("%s: cpr: pvs_fuse: 0x%x\n", __func__, cpr_info->pvs_fuse);
1760 kfree(cpr_info);
1761
1762 /* Select TCXO (19.2MHz) as clock source */
1763 reg_val = readl_relaxed(A11S_TEST_BUS_SEL_ADDR);
1764 reg_val |= RBCPR_CLK_MUX_SEL;
1765 writel_relaxed(reg_val, A11S_TEST_BUS_SEL_ADDR);
1766
1767 /* Get CPR out of reset */
1768 writel_relaxed(0x1, RBCPR_SW_RESET_N);
1769
1770 platform_device_register(&msm8625_vp_device);
1771 platform_device_register(&msm8625_device_cpr);
1772}
1773
Taniya Das7c9f0512011-12-02 14:26:46 +05301774static struct clk_lookup msm_clock_8625_dummy[] = {
1775 CLK_DUMMY("core_clk", adm_clk.c, "msm_dmov", 0),
1776 CLK_DUMMY("adsp_clk", adsp_clk.c, NULL, 0),
1777 CLK_DUMMY("ahb_m_clk", ahb_m_clk.c, NULL, 0),
1778 CLK_DUMMY("ahb_s_clk", ahb_s_clk.c, NULL, 0),
1779 CLK_DUMMY("cam_m_clk", cam_m_clk.c, NULL, 0),
1780 CLK_DUMMY("csi_clk", csi1_clk.c, NULL, 0),
1781 CLK_DUMMY("csi_pclk", csi1_p_clk.c, NULL, 0),
1782 CLK_DUMMY("csi_vfe_clk", csi1_vfe_clk.c, NULL, 0),
1783 CLK_DUMMY("dsi_byte_clk", dsi_byte_clk.c, NULL, 0),
1784 CLK_DUMMY("dsi_clk", dsi_clk.c, NULL, 0),
1785 CLK_DUMMY("dsi_esc_clk", dsi_esc_clk.c, NULL, 0),
1786 CLK_DUMMY("dsi_pixel_clk", dsi_pixel_clk.c, NULL, 0),
1787 CLK_DUMMY("dsi_ref_clk", dsi_ref_clk.c, NULL, 0),
1788 CLK_DUMMY("ebi1_clk", ebi1_clk.c, NULL, 0),
1789 CLK_DUMMY("ebi2_clk", ebi2_clk.c, NULL, 0),
1790 CLK_DUMMY("ecodec_clk", ecodec_clk.c, NULL, 0),
1791 CLK_DUMMY("gp_clk", gp_clk.c, NULL, 0),
1792 CLK_DUMMY("core_clk", gsbi1_qup_clk.c, "qup_i2c.0", 0),
1793 CLK_DUMMY("core_clk", gsbi2_qup_clk.c, "qup_i2c.1", 0),
1794 CLK_DUMMY("iface_clk", gsbi1_qup_p_clk.c, "qup_i2c.0", 0),
1795 CLK_DUMMY("iface_clk", gsbi2_qup_p_clk.c, "qup_i2c.1", 0),
1796 CLK_DUMMY("icodec_rx_clk", icodec_rx_clk.c, NULL, 0),
1797 CLK_DUMMY("icodec_tx_clk", icodec_tx_clk.c, NULL, 0),
1798 CLK_DUMMY("mem_clk", imem_clk.c, NULL, 0),
1799 CLK_DUMMY("mddi_clk", pmdh_clk.c, NULL, 0),
1800 CLK_DUMMY("mdp_clk", mdp_clk.c, NULL, 0),
1801 CLK_DUMMY("mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk.c, NULL, 0),
1802 CLK_DUMMY("mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk.c, NULL, 0),
1803 CLK_DUMMY("mdp_vsync_clk", mdp_vsync_clk.c, NULL, 0),
1804 CLK_DUMMY("mdp_dsi_pclk", mdp_dsi_p_clk.c, NULL, 0),
1805 CLK_DUMMY("pbus_clk", pbus_clk.c, NULL, 0),
1806 CLK_DUMMY("pcm_clk", pcm_clk.c, NULL, 0),
1807 CLK_DUMMY("sdac_clk", sdac_clk.c, NULL, 0),
1808 CLK_DUMMY("core_clk", sdc1_clk.c, "msm_sdcc.1", 0),
1809 CLK_DUMMY("iface_clk", sdc1_p_clk.c, "msm_sdcc.1", 0),
1810 CLK_DUMMY("core_clk", sdc2_clk.c, "msm_sdcc.2", 0),
1811 CLK_DUMMY("iface_clk", sdc2_p_clk.c, "msm_sdcc.2", 0),
1812 CLK_DUMMY("core_clk", sdc3_clk.c, "msm_sdcc.3", 0),
1813 CLK_DUMMY("iface_clk", sdc3_p_clk.c, "msm_sdcc.3", 0),
1814 CLK_DUMMY("core_clk", sdc4_clk.c, "msm_sdcc.4", 0),
1815 CLK_DUMMY("iface_clk", sdc4_p_clk.c, "msm_sdcc.4", 0),
1816 CLK_DUMMY("ref_clk", tsif_ref_clk.c, "msm_tsif.0", 0),
1817 CLK_DUMMY("iface_clk", tsif_p_clk.c, "msm_tsif.0", 0),
1818 CLK_DUMMY("core_clk", uart1_clk.c, "msm_serial.0", 0),
1819 CLK_DUMMY("core_clk", uart2_clk.c, "msm_serial.1", 0),
1820 CLK_DUMMY("core_clk", uart1dm_clk.c, "msm_serial_hs.0", 0),
1821 CLK_DUMMY("core_clk", uart2dm_clk.c, "msm_serial_hsl.0", 0),
1822 CLK_DUMMY("usb_hs_core_clk", usb_hs_core_clk.c, NULL, 0),
1823 CLK_DUMMY("usb_hs2_clk", usb_hs2_clk.c, NULL, 0),
1824 CLK_DUMMY("usb_hs_clk", usb_hs_clk.c, NULL, 0),
1825 CLK_DUMMY("usb_hs_pclk", usb_hs_p_clk.c, NULL, 0),
1826 CLK_DUMMY("usb_phy_clk", usb_phy_clk.c, NULL, 0),
1827 CLK_DUMMY("vdc_clk", vdc_clk.c, NULL, 0),
1828 CLK_DUMMY("ebi1_acpu_clk", ebi_acpu_clk.c, NULL, 0),
1829 CLK_DUMMY("ebi1_lcdc_clk", ebi_lcdc_clk.c, NULL, 0),
1830 CLK_DUMMY("ebi1_mddi_clk", ebi_mddi_clk.c, NULL, 0),
1831 CLK_DUMMY("ebi1_usb_clk", ebi_usb_clk.c, NULL, 0),
1832 CLK_DUMMY("ebi1_vfe_clk", ebi_vfe_clk.c, NULL, 0),
1833 CLK_DUMMY("mem_clk", ebi_adm_clk.c, "msm_dmov", 0),
1834};
1835
1836struct clock_init_data msm8625_dummy_clock_init_data __initdata = {
1837 .table = msm_clock_8625_dummy,
1838 .size = ARRAY_SIZE(msm_clock_8625_dummy),
1839};
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301840enum {
1841 MSM8625,
1842 MSM8625A,
Kaushal Kumar86473f02012-06-28 19:35:58 +05301843 MSM8625AB,
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301844};
1845
1846static int __init msm8625_cpu_id(void)
1847{
1848 int raw_id, cpu;
1849
1850 raw_id = socinfo_get_raw_id();
1851 switch (raw_id) {
1852 /* Part number for 1GHz part */
1853 case 0x770:
1854 case 0x771:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301855 case 0x77C:
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301856 case 0x780:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301857 case 0x8D0:
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301858 cpu = MSM8625;
1859 break;
1860 /* Part number for 1.2GHz part */
1861 case 0x773:
1862 case 0x774:
1863 case 0x781:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301864 case 0x8D1:
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301865 cpu = MSM8625A;
1866 break;
Kaushal Kumar86473f02012-06-28 19:35:58 +05301867 case 0x775:
1868 case 0x776:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301869 case 0x77D:
Kaushal Kumar86473f02012-06-28 19:35:58 +05301870 case 0x782:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301871 case 0x8D2:
Kaushal Kumar86473f02012-06-28 19:35:58 +05301872 cpu = MSM8625AB;
1873 break;
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301874 default:
1875 pr_err("Invalid Raw ID\n");
1876 return -ENODEV;
1877 }
1878 return cpu;
1879}
1880
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001881int __init msm7x2x_misc_init(void)
1882{
Taniya Das7c9f0512011-12-02 14:26:46 +05301883 if (machine_is_msm8625_rumi3()) {
1884 msm_clock_init(&msm8625_dummy_clock_init_data);
Kaushal Kumar622828f2012-07-31 16:07:49 +05301885 msm_cpr_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301886 return 0;
Taniya Das7c9f0512011-12-02 14:26:46 +05301887 }
Taniya Das43bcdd62011-12-02 17:33:27 +05301888
Stephen Boydbb600ae2011-08-02 20:11:40 -07001889 msm_clock_init(&msm7x27a_clock_init_data);
Pankaj Kumarfee56a82012-04-17 14:26:49 +05301890 if (cpu_is_msm7x27aa() || cpu_is_msm7x25ab())
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001891 platform_device_register(&msm7x27aa_device_acpuclk);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301892 else if (cpu_is_msm8625()) {
1893 if (msm8625_cpu_id() == MSM8625)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001894 platform_device_register(&msm7x27aa_device_acpuclk);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301895 else if (msm8625_cpu_id() == MSM8625A)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001896 platform_device_register(&msm8625_device_acpuclk);
Kaushal Kumar86473f02012-06-28 19:35:58 +05301897 else if (msm8625_cpu_id() == MSM8625AB)
1898 platform_device_register(&msm8625ab_device_acpuclk);
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001899 } else {
1900 platform_device_register(&msm7x27a_device_acpuclk);
1901 }
Kaushal Kumar622828f2012-07-31 16:07:49 +05301902
1903 if (cpu_is_msm8625() &&
1904 (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2))
1905 msm_cpr_init();
1906
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001907 return 0;
1908}
1909
1910#ifdef CONFIG_CACHE_L2X0
1911static int __init msm7x27x_cache_init(void)
1912{
1913 int aux_ctrl = 0;
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301914 int pctrl = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001915
1916 /* Way Size 010(0x2) 32KB */
1917 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
1918 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
1919 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
1920
Taniya Das379b5682011-12-02 14:53:46 +05301921 if (cpu_is_msm8625()) {
1922 /* Way Size 011(0x3) 64KB */
1923 aux_ctrl |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
1924 (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | \
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301925 (0X1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) | \
1926 (0x1 << L2X0_AUX_CTRL_L2_FORCE_NWA_SHIFT);
1927
1928 /* Write Prefetch Control settings */
1929 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
1930 pctrl |= (0x3 << L2X0_PREFETCH_CTRL_OFFSET_SHIFT) | \
1931 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_INC_SHIFT) | \
1932 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_SHIFT);
1933 writel_relaxed(pctrl , MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
Taniya Das379b5682011-12-02 14:53:46 +05301934 }
1935
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001936 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301937 if (cpu_is_msm8625()) {
1938 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
1939 pr_info("Prfetch Ctrl: 0x%08x\n", pctrl);
1940 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001941
1942 return 0;
1943}
1944#else
pankaj kumar80d7cb62011-08-23 13:37:55 +05301945static int __init msm7x27x_cache_init(void){ return 0; }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001946#endif
1947
1948void __init msm_common_io_init(void)
1949{
1950 msm_map_common_io();
Taniya Das43bcdd62011-12-02 17:33:27 +05301951 if (socinfo_init() < 0)
1952 pr_err("%s: socinfo_init() failed!\n", __func__);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001953 msm7x27x_cache_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301954}
1955
1956void __init msm8625_init_irq(void)
1957{
Trilok Soni1a9fdee2012-05-28 19:54:11 +05301958 msm_gic_irq_extn_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301959 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1960 (void *)MSM_QGIC_CPU_BASE);
Taniya Das43bcdd62011-12-02 17:33:27 +05301961}
1962
1963void __init msm8625_map_io(void)
1964{
1965 msm_map_msm8625_io();
1966
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001967 if (socinfo_init() < 0)
1968 pr_err("%s: socinfo_init() failed!\n", __func__);
Taniya Das379b5682011-12-02 14:53:46 +05301969 msm7x27x_cache_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001970}
1971
Taniya Das43bcdd62011-12-02 17:33:27 +05301972static int msm7627a_init_gpio(void)
1973{
Taniya Das6684d622012-01-12 10:29:09 +05301974 if (cpu_is_msm8625())
1975 platform_device_register(&msm8625_device_gpio);
1976 else
1977 platform_device_register(&msm_device_gpio);
Taniya Das43bcdd62011-12-02 17:33:27 +05301978 return 0;
1979}
1980postcore_initcall(msm7627a_init_gpio);
Taniya Das9d0c3c52012-05-04 14:40:55 +05301981
1982static int msm7627a_panic_handler(struct notifier_block *this,
1983 unsigned long event, void *ptr)
1984{
1985 flush_cache_all();
1986 outer_flush_all();
1987 return NOTIFY_DONE;
1988}
1989
1990static struct notifier_block panic_handler = {
1991 .notifier_call = msm7627a_panic_handler,
1992};
1993
1994static int __init panic_register(void)
1995{
1996 atomic_notifier_chain_register(&panic_notifier_list,
1997 &panic_handler);
1998 return 0;
1999}
2000module_init(panic_register);