blob: cf456f71deaf48d74962eb145b245049a72c4019 [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>
Matt Wagantall33d01f52012-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"
Trilok Soni31f00272012-11-08 14:36:51 +053039#include "acpuclock-8625q.h"
Murali Nalajala41786ab2012-03-06 10:47:32 +053040#include "spm.h"
Taniya Dasfcb35002012-03-09 15:28:12 +053041#include "mpm-8625.h"
Murali Nalajala2a0bbda2012-03-28 12:12:54 +053042#include "irq.h"
43#include "pm.h"
Kaushal Kumarc0e5d672012-07-31 16:07:49 +053044#include "msm_cpr.h"
45#include "msm_smem_iface.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070046
47/* Address of GSBI blocks */
48#define MSM_GSBI0_PHYS 0xA1200000
49#define MSM_GSBI1_PHYS 0xA1300000
50
51/* GSBI QUPe devices */
52#define MSM_GSBI0_QUP_PHYS (MSM_GSBI0_PHYS + 0x80000)
53#define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000)
54
Kaushal Kumarc0e5d672012-07-31 16:07:49 +053055#define A11S_TEST_BUS_SEL_ADDR (MSM_CSR_BASE + 0x518)
56#define RBCPR_CLK_MUX_SEL (1 << 13)
57
58/* Reset Address of RBCPR (Active Low)*/
59#define RBCPR_SW_RESET_N (MSM_CSR_BASE + 0x64)
60
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070061static struct resource gsbi0_qup_i2c_resources[] = {
62 {
63 .name = "qup_phys_addr",
64 .start = MSM_GSBI0_QUP_PHYS,
65 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
66 .flags = IORESOURCE_MEM,
67 },
68 {
69 .name = "gsbi_qup_i2c_addr",
70 .start = MSM_GSBI0_PHYS,
71 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
72 .flags = IORESOURCE_MEM,
73 },
74 {
75 .name = "qup_err_intr",
76 .start = INT_PWB_I2C,
77 .end = INT_PWB_I2C,
78 .flags = IORESOURCE_IRQ,
79 },
80};
81
82/* Use GSBI0 QUP for /dev/i2c-0 */
83struct platform_device msm_gsbi0_qup_i2c_device = {
84 .name = "qup_i2c",
85 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
86 .num_resources = ARRAY_SIZE(gsbi0_qup_i2c_resources),
87 .resource = gsbi0_qup_i2c_resources,
88};
89
90static struct resource gsbi1_qup_i2c_resources[] = {
91 {
92 .name = "qup_phys_addr",
93 .start = MSM_GSBI1_QUP_PHYS,
94 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
95 .flags = IORESOURCE_MEM,
96 },
97 {
98 .name = "gsbi_qup_i2c_addr",
99 .start = MSM_GSBI1_PHYS,
100 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
101 .flags = IORESOURCE_MEM,
102 },
103 {
104 .name = "qup_err_intr",
105 .start = INT_ARM11_DMA,
106 .end = INT_ARM11_DMA,
107 .flags = IORESOURCE_IRQ,
108 },
109};
110
111/* Use GSBI1 QUP for /dev/i2c-1 */
112struct platform_device msm_gsbi1_qup_i2c_device = {
113 .name = "qup_i2c",
114 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
115 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
116 .resource = gsbi1_qup_i2c_resources,
117};
118
119#define MSM_HSUSB_PHYS 0xA0800000
120static struct resource resources_hsusb_otg[] = {
121 {
122 .start = MSM_HSUSB_PHYS,
123 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
124 .flags = IORESOURCE_MEM,
125 },
126 {
127 .start = INT_USB_HS,
128 .end = INT_USB_HS,
129 .flags = IORESOURCE_IRQ,
130 },
131};
132
133static u64 dma_mask = 0xffffffffULL;
134struct platform_device msm_device_otg = {
135 .name = "msm_otg",
136 .id = -1,
137 .num_resources = ARRAY_SIZE(resources_hsusb_otg),
138 .resource = resources_hsusb_otg,
139 .dev = {
140 .dma_mask = &dma_mask,
141 .coherent_dma_mask = 0xffffffffULL,
142 },
143};
144
145static struct resource resources_gadget_peripheral[] = {
146 {
147 .start = MSM_HSUSB_PHYS,
148 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
149 .flags = IORESOURCE_MEM,
150 },
151 {
152 .start = INT_USB_HS,
153 .end = INT_USB_HS,
154 .flags = IORESOURCE_IRQ,
155 },
156};
157
158struct platform_device msm_device_gadget_peripheral = {
159 .name = "msm_hsusb",
160 .id = -1,
161 .num_resources = ARRAY_SIZE(resources_gadget_peripheral),
162 .resource = resources_gadget_peripheral,
163 .dev = {
164 .dma_mask = &dma_mask,
165 .coherent_dma_mask = 0xffffffffULL,
166 },
167};
168
169static struct resource resources_hsusb_host[] = {
170 {
171 .start = MSM_HSUSB_PHYS,
172 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
173 .flags = IORESOURCE_MEM,
174 },
175 {
176 .start = INT_USB_HS,
177 .end = INT_USB_HS,
178 .flags = IORESOURCE_IRQ,
179 },
180};
181
182struct platform_device msm_device_hsusb_host = {
183 .name = "msm_hsusb_host",
184 .id = 0,
185 .num_resources = ARRAY_SIZE(resources_hsusb_host),
186 .resource = resources_hsusb_host,
187 .dev = {
188 .dma_mask = &dma_mask,
189 .coherent_dma_mask = 0xffffffffULL,
190 },
191};
192
193static struct platform_device *msm_host_devices[] = {
194 &msm_device_hsusb_host,
195};
196
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700197static struct resource msm_dmov_resource[] = {
198 {
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700199 .start = INT_ADM_AARM,
200 .flags = IORESOURCE_IRQ,
201 },
202 {
203 .start = 0xA9700000,
204 .end = 0xA9700000 + SZ_4K - 1,
205 .flags = IORESOURCE_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700206 },
207};
208
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700209static struct msm_dmov_pdata msm_dmov_pdata = {
210 .sd = 3,
211 .sd_size = 0x400,
212};
213
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700214struct platform_device msm_device_dmov = {
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700215 .name = "msm_dmov",
216 .id = -1,
217 .resource = msm_dmov_resource,
218 .num_resources = ARRAY_SIZE(msm_dmov_resource),
219 .dev = {
220 .platform_data = &msm_dmov_pdata,
221 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700222};
223
Matt Wagantallbf430eb2012-03-22 11:45:49 -0700224static struct acpuclk_pdata msm7x27a_acpuclk_pdata = {
225 .max_speed_delta_khz = 400000,
226};
227
228struct platform_device msm7x27a_device_acpuclk = {
229 .name = "acpuclk-7627",
230 .id = -1,
231 .dev.platform_data = &msm7x27a_acpuclk_pdata,
232};
233
234static struct acpuclk_pdata msm7x27aa_acpuclk_pdata = {
235 .max_speed_delta_khz = 504000,
236};
237
238struct platform_device msm7x27aa_device_acpuclk = {
239 .name = "acpuclk-7627",
240 .id = -1,
241 .dev.platform_data = &msm7x27aa_acpuclk_pdata,
242};
243
Trilok Soni31f00272012-11-08 14:36:51 +0530244static struct acpuclk_pdata msm8625q_pdata = {
245 .max_speed_delta_khz = 801600,
246};
247
248static struct acpuclk_pdata_8625q msm8625q_acpuclk_pdata = {
249 .acpu_clk_data = &msm8625q_pdata,
250 .pvs_voltage_uv = 1350000,
251};
252
253struct platform_device msm8625q_device_acpuclk = {
254 .name = "acpuclock-8625q",
255 .id = -1,
256 .dev.platform_data = &msm8625q_acpuclk_pdata,
257};
258
Matt Wagantallbf430eb2012-03-22 11:45:49 -0700259static struct acpuclk_pdata msm8625_acpuclk_pdata = {
260 /* TODO: Need to update speed delta from H/w Team */
261 .max_speed_delta_khz = 604800,
262};
263
Kaushal Kumar86473f02012-06-28 19:35:58 +0530264static struct acpuclk_pdata msm8625ab_acpuclk_pdata = {
265 .max_speed_delta_khz = 801600,
266};
267
Matt Wagantallbf430eb2012-03-22 11:45:49 -0700268struct platform_device msm8625_device_acpuclk = {
269 .name = "acpuclk-7627",
270 .id = -1,
271 .dev.platform_data = &msm8625_acpuclk_pdata,
272};
273
Kaushal Kumar86473f02012-06-28 19:35:58 +0530274struct platform_device msm8625ab_device_acpuclk = {
275 .name = "acpuclk-7627",
276 .id = -1,
277 .dev.platform_data = &msm8625ab_acpuclk_pdata,
278};
279
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700280struct platform_device msm_device_smd = {
281 .name = "msm_smd",
282 .id = -1,
283};
284
Angshuman Sarkarfb1cce92012-02-21 15:20:43 +0530285static struct resource smd_8625_resource[] = {
286 {
287 .name = "a9_m2a_0",
288 .start = MSM8625_INT_A9_M2A_0,
289 .flags = IORESOURCE_IRQ,
290 },
291 {
292 .name = "a9_m2a_5",
293 .start = MSM8625_INT_A9_M2A_5,
294 .flags = IORESOURCE_IRQ,
295 },
296};
297
298static struct smd_subsystem_config smd_8625_config_list[] = {
299 {
300 .irq_config_id = SMD_MODEM,
301 .subsys_name = "modem",
302 .edge = SMD_APPS_MODEM,
303
304 .smd_int.irq_name = "a9_m2a_0",
305 .smd_int.flags = IRQF_TRIGGER_RISING,
306 .smd_int.irq_id = -1,
307 .smd_int.device_name = "smd_dev",
308 .smd_int.dev_id = 0,
309
310 .smd_int.out_bit_pos = 1,
311 .smd_int.out_base = (void __iomem *)MSM_CSR_BASE,
312 .smd_int.out_offset = 0x400 + (0) * 4,
313
314 .smsm_int.irq_name = "a9_m2a_5",
315 .smsm_int.flags = IRQF_TRIGGER_RISING,
316 .smsm_int.irq_id = -1,
317 .smsm_int.device_name = "smsm_dev",
318 .smsm_int.dev_id = 0,
319
320 .smsm_int.out_bit_pos = 1,
321 .smsm_int.out_base = (void __iomem *)MSM_CSR_BASE,
322 .smsm_int.out_offset = 0x400 + (5) * 4,
323
324 }
325};
326
327static struct smd_platform smd_8625_platform_data = {
328 .num_ss_configs = ARRAY_SIZE(smd_8625_config_list),
329 .smd_ss_configs = smd_8625_config_list,
330};
331
332struct platform_device msm8625_device_smd = {
333 .name = "msm_smd",
334 .id = -1,
335 .resource = smd_8625_resource,
336 .num_resources = ARRAY_SIZE(smd_8625_resource),
337 .dev = {
338 .platform_data = &smd_8625_platform_data,
339 }
340};
341
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +0530342static struct resource resources_adsp[] = {
343 {
344 .start = INT_ADSP_A9_A11,
345 .end = INT_ADSP_A9_A11,
346 .flags = IORESOURCE_IRQ,
347 },
348};
349
350struct platform_device msm_adsp_device = {
351 .name = "msm_adsp",
352 .id = -1,
353 .num_resources = ARRAY_SIZE(resources_adsp),
354 .resource = resources_adsp,
355};
356
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700357static struct resource resources_uart1[] = {
358 {
359 .start = INT_UART1,
360 .end = INT_UART1,
361 .flags = IORESOURCE_IRQ,
362 },
363 {
Taniya Das13b811a2011-12-09 18:33:45 +0530364 .start = MSM7XXX_UART1_PHYS,
365 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700366 .flags = IORESOURCE_MEM,
367 },
368};
369
370struct platform_device msm_device_uart1 = {
371 .name = "msm_serial",
372 .id = 0,
373 .num_resources = ARRAY_SIZE(resources_uart1),
374 .resource = resources_uart1,
375};
376
377#define MSM_UART1DM_PHYS 0xA0200000
378static struct resource msm_uart1_dm_resources[] = {
379 {
380 .start = MSM_UART1DM_PHYS,
381 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
382 .flags = IORESOURCE_MEM,
383 },
384 {
385 .start = INT_UART1DM_IRQ,
386 .end = INT_UART1DM_IRQ,
387 .flags = IORESOURCE_IRQ,
388 },
389 {
390 .start = INT_UART1DM_RX,
391 .end = INT_UART1DM_RX,
392 .flags = IORESOURCE_IRQ,
393 },
394 {
395 .start = DMOV_HSUART1_TX_CHAN,
396 .end = DMOV_HSUART1_RX_CHAN,
397 .name = "uartdm_channels",
398 .flags = IORESOURCE_DMA,
399 },
400 {
401 .start = DMOV_HSUART1_TX_CRCI,
402 .end = DMOV_HSUART1_RX_CRCI,
403 .name = "uartdm_crci",
404 .flags = IORESOURCE_DMA,
405 },
406};
407
408static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32);
409struct platform_device msm_device_uart_dm1 = {
410 .name = "msm_serial_hs",
411 .id = 0,
412 .num_resources = ARRAY_SIZE(msm_uart1_dm_resources),
413 .resource = msm_uart1_dm_resources,
414 .dev = {
415 .dma_mask = &msm_uart_dm1_dma_mask,
416 .coherent_dma_mask = DMA_BIT_MASK(32),
417 },
418};
419
420#define MSM_UART2DM_PHYS 0xA0300000
421static struct resource msm_uart2dm_resources[] = {
422 {
423 .start = MSM_UART2DM_PHYS,
424 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
425 .name = "uartdm_resource",
426 .flags = IORESOURCE_MEM,
427 },
428 {
429 .start = INT_UART2DM_IRQ,
430 .end = INT_UART2DM_IRQ,
431 .flags = IORESOURCE_IRQ,
432 },
433};
434
435struct platform_device msm_device_uart_dm2 = {
436 .name = "msm_serial_hsl",
437 .id = 0,
438 .num_resources = ARRAY_SIZE(msm_uart2dm_resources),
439 .resource = msm_uart2dm_resources,
440};
441
442#define MSM_NAND_PHYS 0xA0A00000
443#define MSM_NANDC01_PHYS 0xA0A40000
444#define MSM_NANDC10_PHYS 0xA0A80000
445#define MSM_NANDC11_PHYS 0xA0AC0000
446#define EBI2_REG_BASE 0xA0D00000
447static struct resource resources_nand[] = {
448 [0] = {
449 .name = "msm_nand_dmac",
450 .start = DMOV_NAND_CHAN,
451 .end = DMOV_NAND_CHAN,
452 .flags = IORESOURCE_DMA,
453 },
454 [1] = {
455 .name = "msm_nand_phys",
456 .start = MSM_NAND_PHYS,
457 .end = MSM_NAND_PHYS + 0x7FF,
458 .flags = IORESOURCE_MEM,
459 },
460 [2] = {
461 .name = "msm_nandc01_phys",
462 .start = MSM_NANDC01_PHYS,
463 .end = MSM_NANDC01_PHYS + 0x7FF,
464 .flags = IORESOURCE_MEM,
465 },
466 [3] = {
467 .name = "msm_nandc10_phys",
468 .start = MSM_NANDC10_PHYS,
469 .end = MSM_NANDC10_PHYS + 0x7FF,
470 .flags = IORESOURCE_MEM,
471 },
472 [4] = {
473 .name = "msm_nandc11_phys",
474 .start = MSM_NANDC11_PHYS,
475 .end = MSM_NANDC11_PHYS + 0x7FF,
476 .flags = IORESOURCE_MEM,
477 },
478 [5] = {
479 .name = "ebi2_reg_base",
480 .start = EBI2_REG_BASE,
481 .end = EBI2_REG_BASE + 0x60,
482 .flags = IORESOURCE_MEM,
483 },
484};
485
Sujit Reddy Thummaec9b3252012-04-23 15:53:45 +0530486struct flash_platform_data msm_nand_data = {
487 .version = VERSION_2,
488};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700489
490struct platform_device msm_device_nand = {
491 .name = "msm_nand",
492 .id = -1,
493 .num_resources = ARRAY_SIZE(resources_nand),
494 .resource = resources_nand,
495 .dev = {
496 .platform_data = &msm_nand_data,
497 },
498};
499
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530500static struct msm_pm_irq_calls msm7x27a_pm_irq_calls = {
501 .irq_pending = msm_irq_pending,
502 .idle_sleep_allowed = msm_irq_idle_sleep_allowed,
503 .enter_sleep1 = msm_irq_enter_sleep1,
504 .enter_sleep2 = msm_irq_enter_sleep2,
505 .exit_sleep1 = msm_irq_exit_sleep1,
506 .exit_sleep2 = msm_irq_exit_sleep2,
507 .exit_sleep3 = msm_irq_exit_sleep3,
508};
509
510static struct msm_pm_irq_calls msm8625_pm_irq_calls = {
511 .irq_pending = msm_gic_spi_ppi_pending,
512 .idle_sleep_allowed = msm_gic_irq_idle_sleep_allowed,
513 .enter_sleep1 = msm_gic_irq_enter_sleep1,
514 .enter_sleep2 = msm_gic_irq_enter_sleep2,
515 .exit_sleep1 = msm_gic_irq_exit_sleep1,
516 .exit_sleep2 = msm_gic_irq_exit_sleep2,
517 .exit_sleep3 = msm_gic_irq_exit_sleep3,
518};
519
Ranjhith Kalisamyb5fabb42012-10-30 18:43:20 +0530520void msm_clk_dump_debug_info(void)
521{
522 pr_info("%s: GLBL_CLK_ENA: 0x%08X\n", __func__,
523 readl_relaxed(MSM_CLK_CTL_BASE + 0x0));
524 pr_info("%s: GLBL_CLK_STATE: 0x%08X\n", __func__,
525 readl_relaxed(MSM_CLK_CTL_BASE + 0x4));
526 pr_info("%s: GRP_NS_REG: 0x%08X\n", __func__,
527 readl_relaxed(MSM_CLK_CTL_BASE + 0x84));
528 pr_info("%s: CLK_HALT_STATEB: 0x%08X\n", __func__,
529 readl_relaxed(MSM_CLK_CTL_BASE + 0x10C));
530}
531
Stephen Boyd986c9632012-04-24 16:31:45 -0700532void __init msm_pm_register_irqs(void)
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530533{
Utsab Bose4ed4ba12012-11-08 18:52:38 +0530534 if (cpu_is_msm8625() || cpu_is_msm8625q())
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530535 msm_pm_set_irq_extns(&msm8625_pm_irq_calls);
536 else
537 msm_pm_set_irq_extns(&msm7x27a_pm_irq_calls);
538
539}
540
Murali Nalajalaff723ec2012-07-13 16:54:40 +0530541static struct msm_pm_cpr_ops msm8625_pm_cpr_ops = {
542 .cpr_suspend = msm_cpr_pm_suspend,
543 .cpr_resume = msm_cpr_pm_resume,
544};
545
546void __init msm_pm_register_cpr_ops(void)
547{
548 /* CPR presents on revision >= v2.0 chipsets */
Utsab Bose4ed4ba12012-11-08 18:52:38 +0530549 if ((cpu_is_msm8625() &&
Murali Nalajalaff723ec2012-07-13 16:54:40 +0530550 SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
Utsab Bose4ed4ba12012-11-08 18:52:38 +0530551 || cpu_is_msm8625q())
Murali Nalajalaff723ec2012-07-13 16:54:40 +0530552 msm_pm_set_cpr_ops(&msm8625_pm_cpr_ops);
553}
554
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700555#define MSM_SDC1_BASE 0xA0400000
556#define MSM_SDC2_BASE 0xA0500000
557#define MSM_SDC3_BASE 0xA0600000
558#define MSM_SDC4_BASE 0xA0700000
559static struct resource resources_sdc1[] = {
560 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530561 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700562 .start = MSM_SDC1_BASE,
563 .end = MSM_SDC1_BASE + SZ_4K - 1,
564 .flags = IORESOURCE_MEM,
565 },
566 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530567 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700568 .start = INT_SDC1_0,
569 .end = INT_SDC1_1,
570 .flags = IORESOURCE_IRQ,
571 },
572 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530573 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700574 .start = DMOV_SDC1_CHAN,
575 .end = DMOV_SDC1_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700576 .flags = IORESOURCE_DMA,
577 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700578 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530579 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700580 .start = DMOV_SDC1_CRCI,
581 .end = DMOV_SDC1_CRCI,
582 .flags = IORESOURCE_DMA,
583 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700584};
585
586static struct resource resources_sdc2[] = {
587 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530588 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700589 .start = MSM_SDC2_BASE,
590 .end = MSM_SDC2_BASE + SZ_4K - 1,
591 .flags = IORESOURCE_MEM,
592 },
593 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530594 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700595 .start = INT_SDC2_0,
596 .end = INT_SDC2_1,
597 .flags = IORESOURCE_IRQ,
598 },
599 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530600 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700601 .start = DMOV_SDC2_CHAN,
602 .end = DMOV_SDC2_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700603 .flags = IORESOURCE_DMA,
604 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700605 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530606 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700607 .start = DMOV_SDC2_CRCI,
608 .end = DMOV_SDC2_CRCI,
609 .flags = IORESOURCE_DMA,
610 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700611};
612
613static struct resource resources_sdc3[] = {
614 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530615 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700616 .start = MSM_SDC3_BASE,
617 .end = MSM_SDC3_BASE + SZ_4K - 1,
618 .flags = IORESOURCE_MEM,
619 },
620 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530621 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700622 .start = INT_SDC3_0,
623 .end = INT_SDC3_1,
624 .flags = IORESOURCE_IRQ,
625 },
626 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530627 .name = "dma_chnl",
Subhash Jadavanif29aefd2012-06-21 00:43:15 +0530628 .start = DMOV_NAND_CHAN,
629 .end = DMOV_NAND_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700630 .flags = IORESOURCE_DMA,
631 },
632 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530633 .name = "dma_crci",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530634 .start = DMOV_SDC3_CRCI,
635 .end = DMOV_SDC3_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700636 .flags = IORESOURCE_DMA,
637 },
638};
639
640static struct resource resources_sdc4[] = {
641 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530642 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700643 .start = MSM_SDC4_BASE,
644 .end = MSM_SDC4_BASE + SZ_4K - 1,
645 .flags = IORESOURCE_MEM,
646 },
647 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530648 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700649 .start = INT_SDC4_0,
650 .end = INT_SDC4_1,
651 .flags = IORESOURCE_IRQ,
652 },
653 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530654 .name = "dma_chnl",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530655 .start = DMOV_SDC4_CHAN,
656 .end = DMOV_SDC4_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700657 .flags = IORESOURCE_DMA,
658 },
659 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530660 .name = "dma_crci",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530661 .start = DMOV_SDC4_CRCI,
662 .end = DMOV_SDC4_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700663 .flags = IORESOURCE_DMA,
664 },
665};
666
667struct platform_device msm_device_sdc1 = {
668 .name = "msm_sdcc",
669 .id = 1,
670 .num_resources = ARRAY_SIZE(resources_sdc1),
671 .resource = resources_sdc1,
672 .dev = {
673 .coherent_dma_mask = 0xffffffff,
674 },
675};
676
677struct platform_device msm_device_sdc2 = {
678 .name = "msm_sdcc",
679 .id = 2,
680 .num_resources = ARRAY_SIZE(resources_sdc2),
681 .resource = resources_sdc2,
682 .dev = {
683 .coherent_dma_mask = 0xffffffff,
684 },
685};
686
687struct platform_device msm_device_sdc3 = {
688 .name = "msm_sdcc",
689 .id = 3,
690 .num_resources = ARRAY_SIZE(resources_sdc3),
691 .resource = resources_sdc3,
692 .dev = {
693 .coherent_dma_mask = 0xffffffff,
694 },
695};
696
697struct platform_device msm_device_sdc4 = {
698 .name = "msm_sdcc",
699 .id = 4,
700 .num_resources = ARRAY_SIZE(resources_sdc4),
701 .resource = resources_sdc4,
702 .dev = {
703 .coherent_dma_mask = 0xffffffff,
704 },
705};
706
707static struct platform_device *msm_sdcc_devices[] __initdata = {
708 &msm_device_sdc1,
709 &msm_device_sdc2,
710 &msm_device_sdc3,
711 &msm_device_sdc4,
712};
713
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530714#ifdef CONFIG_MSM_CAMERA_V4L2
Suresh Vankadara6050cef52012-04-16 21:44:59 +0530715static int apps_reset;
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530716static struct resource msm_csic0_resources[] = {
717 {
718 .name = "csic",
719 .start = 0xA0F00000,
720 .end = 0xA0F00000 + 0x00100000 - 1,
721 .flags = IORESOURCE_MEM,
722 },
723 {
724 .name = "csic",
725 .start = INT_CSI_IRQ_0,
726 .end = INT_CSI_IRQ_0,
727 .flags = IORESOURCE_IRQ,
728 },
729};
730
731static struct resource msm_csic1_resources[] = {
732 {
733 .name = "csic",
734 .start = 0xA1000000,
735 .end = 0xA1000000 + 0x00100000 - 1,
736 .flags = IORESOURCE_MEM,
737 },
738 {
739 .name = "csic",
740 .start = INT_CSI_IRQ_1,
741 .end = INT_CSI_IRQ_1,
742 .flags = IORESOURCE_IRQ,
743 },
744};
745
746struct platform_device msm7x27a_device_csic0 = {
747 .name = "msm_csic",
748 .id = 0,
749 .resource = msm_csic0_resources,
750 .num_resources = ARRAY_SIZE(msm_csic0_resources),
751};
752
753struct platform_device msm7x27a_device_csic1 = {
754 .name = "msm_csic",
755 .id = 1,
756 .resource = msm_csic1_resources,
757 .num_resources = ARRAY_SIZE(msm_csic1_resources),
758};
759
760static struct resource msm_clkctl_resources[] = {
761 {
762 .name = "clk_ctl",
Taniya Das13b811a2011-12-09 18:33:45 +0530763 .start = MSM7XXX_CLK_CTL_PHYS,
764 .end = MSM7XXX_CLK_CTL_PHYS + MSM7XXX_CLK_CTL_SIZE - 1,
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530765 .flags = IORESOURCE_MEM,
766 },
767};
768struct platform_device msm7x27a_device_clkctl = {
769 .name = "msm_clk_ctl",
770 .id = 0,
771 .resource = msm_clkctl_resources,
772 .num_resources = ARRAY_SIZE(msm_clkctl_resources),
Suresh Vankadara6050cef52012-04-16 21:44:59 +0530773 .dev = {
774 .platform_data = &apps_reset,
775 },
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530776};
777
778struct platform_device msm7x27a_device_vfe = {
779 .name = "msm_vfe",
780 .id = 0,
781};
782
783#endif
784
Murali Nalajala41786ab2012-03-06 10:47:32 +0530785/* Command sequence for simple WFI */
786static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Murali Nalajala2250a272012-03-13 15:56:59 +0530787 0x04, 0x03, 0x04, 0x0f,
Murali Nalajala41786ab2012-03-06 10:47:32 +0530788};
789
790/* Command sequence for GDFS, this won't send any interrupt to the modem */
791static uint8_t spm_pc_without_modem[] __initdata = {
792 0x20, 0x00, 0x30, 0x10,
Murali Nalajala2250a272012-03-13 15:56:59 +0530793 0x03, 0x1e, 0x0e, 0x3e,
794 0x4e, 0x4e, 0x4e, 0x4e,
795 0x4e, 0x4e, 0x4e, 0x4e,
796 0x4e, 0x4e, 0x4e, 0x4e,
797 0x4e, 0x4e, 0x4e, 0x4e,
798 0x2E, 0x0f,
Murali Nalajala41786ab2012-03-06 10:47:32 +0530799};
800
801static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
802 [0] = {
803 .mode = MSM_SPM_MODE_CLOCK_GATING,
804 .notify_rpm = false,
805 .cmd = spm_wfi_cmd_sequence,
806 },
807 [1] = {
808 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
809 .notify_rpm = false,
810 .cmd = spm_pc_without_modem,
811 },
Murali Nalajalaf194f682012-10-19 20:10:07 +0530812 [2] = {
813 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
814 .notify_rpm = false,
815 .cmd = spm_pc_without_modem,
816 },
817 [3] = {
818 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
819 .notify_rpm = false,
820 .cmd = spm_pc_without_modem,
821 },
Murali Nalajala41786ab2012-03-06 10:47:32 +0530822};
823
824static struct msm_spm_platform_data msm_spm_data[] __initdata = {
825 [0] = {
826 .reg_base_addr = MSM_SAW0_BASE,
827 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
828 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
829 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
830 .modes = msm_spm_seq_list,
831 },
832 [1] = {
833 .reg_base_addr = MSM_SAW1_BASE,
834 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
835 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
836 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
837 .modes = msm_spm_seq_list,
838 },
Murali Nalajalaf194f682012-10-19 20:10:07 +0530839 [2] = {
840 .reg_base_addr = MSM_SAW2_BASE,
841 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
842 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
843 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
844 .modes = msm_spm_seq_list,
845 },
846 [3] = {
847 .reg_base_addr = MSM_SAW3_BASE,
848 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
849 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
850 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
851 .modes = msm_spm_seq_list,
852 },
Murali Nalajala41786ab2012-03-06 10:47:32 +0530853};
854
855void __init msm8x25_spm_device_init(void)
856{
857 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
858}
859
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700860#define MDP_BASE 0xAA200000
861#define MIPI_DSI_HW_BASE 0xA1100000
862
863static struct resource msm_mipi_dsi_resources[] = {
864 {
865 .name = "mipi_dsi",
866 .start = MIPI_DSI_HW_BASE,
867 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
868 .flags = IORESOURCE_MEM,
869 },
870 {
871 .start = INT_DSI_IRQ,
872 .end = INT_DSI_IRQ,
873 .flags = IORESOURCE_IRQ,
874 },
875};
876
877static struct platform_device msm_mipi_dsi_device = {
878 .name = "mipi_dsi",
879 .id = 1,
880 .num_resources = ARRAY_SIZE(msm_mipi_dsi_resources),
881 .resource = msm_mipi_dsi_resources,
882};
883
884static struct resource msm_mdp_resources[] = {
885 {
886 .name = "mdp",
887 .start = MDP_BASE,
888 .end = MDP_BASE + 0x000F1008 - 1,
889 .flags = IORESOURCE_MEM,
890 },
891 {
892 .start = INT_MDP,
893 .end = INT_MDP,
894 .flags = IORESOURCE_IRQ,
895 },
896};
897
898static struct platform_device msm_mdp_device = {
899 .name = "mdp",
900 .id = 0,
901 .num_resources = ARRAY_SIZE(msm_mdp_resources),
902 .resource = msm_mdp_resources,
903};
904
Padmanabhan Komandurue77bcf52012-07-26 12:43:39 +0530905struct platform_device msm_lcdc_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700906 .name = "lcdc",
907 .id = 0,
908};
909
910static struct resource kgsl_3d0_resources[] = {
911 {
912 .name = KGSL_3D0_REG_MEMORY,
913 .start = 0xA0000000,
914 .end = 0xA001ffff,
915 .flags = IORESOURCE_MEM,
916 },
917 {
918 .name = KGSL_3D0_IRQ,
919 .start = INT_GRAPHICS,
920 .end = INT_GRAPHICS,
921 .flags = IORESOURCE_IRQ,
922 },
923};
924
925static struct kgsl_device_platform_data kgsl_3d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600926 .pwrlevel = {
927 {
928 .gpu_freq = 245760000,
929 .bus_freq = 200000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700930 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600931 {
Lynus Vazeaf0aac2012-01-05 12:28:47 +0530932 .gpu_freq = 192000000,
933 .bus_freq = 160000000,
934 },
935 {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600936 .gpu_freq = 133330000,
937 .bus_freq = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700938 },
939 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600940 .init_level = 0,
Lynus Vazeaf0aac2012-01-05 12:28:47 +0530941 .num_levels = 3,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600942 .set_grp_async = set_grp_xbar_async,
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700943 .idle_timeout = HZ,
Lynus Vazfe4bede2012-04-06 11:53:30 -0700944 .strtstp_sleepwake = true,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600945 .nap_allowed = false,
946 .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700947};
948
949struct platform_device msm_kgsl_3d0 = {
950 .name = "kgsl-3d0",
951 .id = 0,
952 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
953 .resource = kgsl_3d0_resources,
954 .dev = {
955 .platform_data = &kgsl_3d0_pdata,
956 },
957};
958
959void __init msm7x25a_kgsl_3d0_init(void)
960{
Pankaj Kumarfee56a82012-04-17 14:26:49 +0530961 if (cpu_is_msm7x25a() || cpu_is_msm7x25aa() || cpu_is_msm7x25ab()) {
Lynus Vaz971610e2012-01-06 11:00:32 +0530962 kgsl_3d0_pdata.num_levels = 2;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600963 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 133330000;
964 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 160000000;
965 kgsl_3d0_pdata.pwrlevel[1].gpu_freq = 96000000;
966 kgsl_3d0_pdata.pwrlevel[1].bus_freq = 0;
Rajesh Kemisettidf6e62f2012-03-12 14:02:30 +0530967 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700968}
969
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700970void __init msm8x25_kgsl_3d0_init(void)
971{
Utsab Bose4ed4ba12012-11-08 18:52:38 +0530972 if (cpu_is_msm8625() || cpu_is_msm8625q()) {
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700973 kgsl_3d0_pdata.idle_timeout = HZ/5;
Lynus Vazfe4bede2012-04-06 11:53:30 -0700974 kgsl_3d0_pdata.strtstp_sleepwake = false;
Ranjhith Kalisamy5fb30ef2012-08-12 16:26:36 +0530975
976 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
977 /* 8x25 v2.0 & above supports a higher GPU frequency */
978 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 320000000;
979 else
980 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 300000000;
981
Ranjhith Kalisamy24696322012-04-11 22:09:17 +0530982 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 200000000;
Lynus Vazfe4bede2012-04-06 11:53:30 -0700983 }
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700984}
985
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700986static void __init msm_register_device(struct platform_device *pdev, void *data)
987{
988 int ret;
989
990 pdev->dev.platform_data = data;
991
992 ret = platform_device_register(pdev);
993
994 if (ret)
995 dev_err(&pdev->dev,
996 "%s: platform_device_register() failed = %d\n",
997 __func__, ret);
998}
999
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001000
1001#define PERPH_WEB_BLOCK_ADDR (0xA9D00040)
1002#define PDM0_CTL_OFFSET (0x04)
1003#define SIZE_8B (0x08)
1004
1005static struct resource resources_led[] = {
1006 {
1007 .start = PERPH_WEB_BLOCK_ADDR,
1008 .end = PERPH_WEB_BLOCK_ADDR + (SIZE_8B) - 1,
1009 .name = "led-gpio-pdm",
1010 .flags = IORESOURCE_MEM,
1011 },
1012};
1013
1014static struct led_info msm_kpbl_pdm_led_pdata = {
1015 .name = "keyboard-backlight",
1016};
1017
1018struct platform_device led_pdev = {
1019 .name = "leds-msm-pdm",
1020 /* use pdev id to represent pdm id */
1021 .id = 0,
1022 .num_resources = ARRAY_SIZE(resources_led),
1023 .resource = resources_led,
1024 .dev = {
1025 .platform_data = &msm_kpbl_pdm_led_pdata,
1026 },
1027};
1028
Manish Dewangan3a260992011-06-24 18:01:34 +05301029struct platform_device asoc_msm_pcm = {
1030 .name = "msm-dsp-audio",
1031 .id = 0,
1032};
1033
1034struct platform_device asoc_msm_dai0 = {
1035 .name = "msm-codec-dai",
1036 .id = 0,
1037};
1038
1039struct platform_device asoc_msm_dai1 = {
1040 .name = "msm-cpu-dai",
1041 .id = 0,
1042};
1043
Taniya Das2e948192011-12-20 11:15:13 +05301044static struct resource gpio_resources[] = {
1045 {
1046 .start = INT_GPIO_GROUP1,
1047 .flags = IORESOURCE_IRQ,
1048 },
1049 {
1050 .start = INT_GPIO_GROUP2,
1051 .flags = IORESOURCE_IRQ,
1052 },
1053};
1054
1055static struct platform_device msm_device_gpio = {
1056 .name = "msmgpio",
1057 .id = -1,
1058 .resource = gpio_resources,
1059 .num_resources = ARRAY_SIZE(gpio_resources),
1060};
1061
Taniya Das43bcdd62011-12-02 17:33:27 +05301062struct platform_device *msm_footswitch_devices[] = {
Matt Wagantalld6fbf232012-05-03 20:09:28 -07001063 FS_PCOM(FS_GFX3D, "vdd", "kgsl-3d0.0"),
Taniya Das43bcdd62011-12-02 17:33:27 +05301064};
1065unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);
1066
1067/* MSM8625 Devices */
1068
1069static struct resource msm8625_resources_uart1[] = {
1070 {
1071 .start = MSM8625_INT_UART1,
1072 .end = MSM8625_INT_UART1,
1073 .flags = IORESOURCE_IRQ,
1074 },
1075 {
Taniya Das13b811a2011-12-09 18:33:45 +05301076 .start = MSM7XXX_UART1_PHYS,
1077 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Taniya Das43bcdd62011-12-02 17:33:27 +05301078 .flags = IORESOURCE_MEM,
1079 },
1080};
1081
1082struct platform_device msm8625_device_uart1 = {
1083 .name = "msm_serial",
1084 .id = 0,
1085 .num_resources = ARRAY_SIZE(msm8625_resources_uart1),
1086 .resource = msm8625_resources_uart1,
1087};
1088
Trilok Soni269fff42012-02-13 20:35:30 +05301089static struct resource msm8625_uart1_dm_resources[] = {
1090 {
1091 .start = MSM_UART1DM_PHYS,
1092 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
1093 .flags = IORESOURCE_MEM,
1094 },
1095 {
1096 .start = MSM8625_INT_UART1DM_IRQ,
1097 .end = MSM8625_INT_UART1DM_IRQ,
1098 .flags = IORESOURCE_IRQ,
1099 },
1100 {
1101 .start = MSM8625_INT_UART1DM_RX,
1102 .end = MSM8625_INT_UART1DM_RX,
1103 .flags = IORESOURCE_IRQ,
1104 },
1105 {
1106 .start = DMOV_HSUART1_TX_CHAN,
1107 .end = DMOV_HSUART1_RX_CHAN,
1108 .name = "uartdm_channels",
1109 .flags = IORESOURCE_DMA,
1110 },
1111 {
1112 .start = DMOV_HSUART1_TX_CRCI,
1113 .end = DMOV_HSUART1_RX_CRCI,
1114 .name = "uartdm_crci",
1115 .flags = IORESOURCE_DMA,
1116 },
1117};
1118
1119struct platform_device msm8625_device_uart_dm1 = {
1120 .name = "msm_serial_hs",
1121 .id = 0,
1122 .num_resources = ARRAY_SIZE(msm8625_uart1_dm_resources),
1123 .resource = msm8625_uart1_dm_resources,
1124 .dev = {
1125 .dma_mask = &msm_uart_dm1_dma_mask,
1126 .coherent_dma_mask = DMA_BIT_MASK(32),
1127 },
1128};
1129
1130static struct resource msm8625_uart2dm_resources[] = {
1131 {
1132 .start = MSM_UART2DM_PHYS,
1133 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
1134 .name = "uartdm_resource",
1135 .flags = IORESOURCE_MEM,
1136 },
1137 {
1138 .start = MSM8625_INT_UART2DM_IRQ,
1139 .end = MSM8625_INT_UART2DM_IRQ,
1140 .flags = IORESOURCE_IRQ,
1141 },
1142};
1143
1144struct platform_device msm8625_device_uart_dm2 = {
1145 .name = "msm_serial_hsl",
1146 .id = 0,
1147 .num_resources = ARRAY_SIZE(msm8625_uart2dm_resources),
1148 .resource = msm8625_uart2dm_resources,
1149};
1150
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +05301151static struct resource msm8625_resources_adsp[] = {
1152 {
1153 .start = MSM8625_INT_ADSP_A9_A11,
1154 .end = MSM8625_INT_ADSP_A9_A11,
1155 .flags = IORESOURCE_IRQ,
1156 },
1157};
1158
1159struct platform_device msm8625_device_adsp = {
1160 .name = "msm_adsp",
1161 .id = -1,
1162 .num_resources = ARRAY_SIZE(msm8625_resources_adsp),
1163 .resource = msm8625_resources_adsp,
1164};
1165
Taniya Das43bcdd62011-12-02 17:33:27 +05301166static struct resource msm8625_dmov_resource[] = {
1167 {
1168 .start = MSM8625_INT_ADM_AARM,
1169 .flags = IORESOURCE_IRQ,
1170 },
1171 {
1172 .start = 0xA9700000,
1173 .end = 0xA9700000 + SZ_4K - 1,
1174 .flags = IORESOURCE_MEM,
1175 },
1176};
1177
1178struct platform_device msm8625_device_dmov = {
1179 .name = "msm_dmov",
1180 .id = -1,
1181 .resource = msm8625_dmov_resource,
1182 .num_resources = ARRAY_SIZE(msm8625_dmov_resource),
1183 .dev = {
1184 .platform_data = &msm_dmov_pdata,
1185 },
1186};
Taniya Das2e948192011-12-20 11:15:13 +05301187
Taniya Das9d187142011-12-02 15:53:25 +05301188static struct resource gsbi0_msm8625_qup_resources[] = {
1189 {
1190 .name = "qup_phys_addr",
1191 .start = MSM_GSBI0_QUP_PHYS,
1192 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
1193 .flags = IORESOURCE_MEM,
1194 },
1195 {
1196 .name = "gsbi_qup_i2c_addr",
1197 .start = MSM_GSBI0_PHYS,
1198 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
1199 .flags = IORESOURCE_MEM,
1200 },
1201 {
1202 .name = "qup_err_intr",
1203 .start = MSM8625_INT_PWB_I2C,
1204 .end = MSM8625_INT_PWB_I2C,
1205 .flags = IORESOURCE_IRQ,
1206 },
1207};
1208
1209/* Use GSBI0 QUP for /dev/i2c-0 */
Taniya Dase3027e22012-02-27 16:32:27 +05301210struct platform_device msm8625_gsbi0_qup_i2c_device = {
Taniya Das9d187142011-12-02 15:53:25 +05301211 .name = "qup_i2c",
1212 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
1213 .num_resources = ARRAY_SIZE(gsbi0_msm8625_qup_resources),
1214 .resource = gsbi0_msm8625_qup_resources,
1215};
1216
Trilok Soni633e59c2012-02-13 20:28:30 +05301217static struct resource gsbi1_msm8625_qup_i2c_resources[] = {
1218 {
1219 .name = "qup_phys_addr",
1220 .start = MSM_GSBI1_QUP_PHYS,
1221 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
1222 .flags = IORESOURCE_MEM,
1223 },
1224 {
1225 .name = "gsbi_qup_i2c_addr",
1226 .start = MSM_GSBI1_PHYS,
1227 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
1228 .flags = IORESOURCE_MEM,
1229 },
1230 {
1231 .name = "qup_err_intr",
1232 .start = MSM8625_INT_ARM11_DMA,
1233 .end = MSM8625_INT_ARM11_DMA,
1234 .flags = IORESOURCE_IRQ,
1235 },
1236};
1237
1238/* Use GSBI1 QUP for /dev/i2c-1 */
Taniya Dase3027e22012-02-27 16:32:27 +05301239struct platform_device msm8625_gsbi1_qup_i2c_device = {
Trilok Soni633e59c2012-02-13 20:28:30 +05301240 .name = "qup_i2c",
1241 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
1242 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
1243 .resource = gsbi1_msm8625_qup_i2c_resources,
1244};
1245
Taniya Das6684d622012-01-12 10:29:09 +05301246static struct resource msm8625_gpio_resources[] = {
1247 {
1248 .start = MSM8625_INT_GPIO_GROUP1,
1249 .flags = IORESOURCE_IRQ,
1250 },
1251 {
1252 .start = MSM8625_INT_GPIO_GROUP2,
1253 .flags = IORESOURCE_IRQ,
1254 },
1255};
1256
1257static struct platform_device msm8625_device_gpio = {
1258 .name = "msmgpio",
1259 .id = -1,
1260 .resource = msm8625_gpio_resources,
1261 .num_resources = ARRAY_SIZE(msm8625_gpio_resources),
1262};
1263
Trilok Soniee75f6c2012-02-13 20:45:07 +05301264static struct resource msm8625_resources_sdc1[] = {
1265 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301266 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301267 .start = MSM_SDC1_BASE,
1268 .end = MSM_SDC1_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_SDC1_0,
1274 .end = MSM8625_INT_SDC1_1,
1275 .flags = IORESOURCE_IRQ,
1276 },
1277 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301278 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301279 .start = DMOV_SDC1_CHAN,
1280 .end = DMOV_SDC1_CHAN,
1281 .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_SDC1_CRCI,
1286 .end = DMOV_SDC1_CRCI,
1287 .flags = IORESOURCE_DMA,
1288 }
1289};
1290
1291static struct resource msm8625_resources_sdc2[] = {
1292 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301293 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301294 .start = MSM_SDC2_BASE,
1295 .end = MSM_SDC2_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_SDC2_0,
1301 .end = MSM8625_INT_SDC2_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_SDC2_CHAN,
1307 .end = DMOV_SDC2_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_SDC2_CRCI,
1313 .end = DMOV_SDC2_CRCI,
1314 .flags = IORESOURCE_DMA,
1315 }
1316};
1317
1318static struct resource msm8625_resources_sdc3[] = {
1319 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301320 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301321 .start = MSM_SDC3_BASE,
1322 .end = MSM_SDC3_BASE + SZ_4K - 1,
1323 .flags = IORESOURCE_MEM,
1324 },
1325 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301326 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301327 .start = MSM8625_INT_SDC3_0,
1328 .end = MSM8625_INT_SDC3_1,
1329 .flags = IORESOURCE_IRQ,
1330 },
1331 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301332 .name = "dma_chnl",
Pratibhasagar Vc483d202012-08-21 14:37:17 +05301333 .start = DMOV_NAND_CHAN,
1334 .end = DMOV_NAND_CHAN,
Trilok Soniee75f6c2012-02-13 20:45:07 +05301335 .flags = IORESOURCE_DMA,
1336 },
1337 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301338 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301339 .start = DMOV_SDC3_CRCI,
1340 .end = DMOV_SDC3_CRCI,
1341 .flags = IORESOURCE_DMA,
1342 },
1343};
1344
1345static struct resource msm8625_resources_sdc4[] = {
1346 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301347 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301348 .start = MSM_SDC4_BASE,
1349 .end = MSM_SDC4_BASE + SZ_4K - 1,
1350 .flags = IORESOURCE_MEM,
1351 },
1352 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301353 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301354 .start = MSM8625_INT_SDC4_0,
1355 .end = MSM8625_INT_SDC4_1,
1356 .flags = IORESOURCE_IRQ,
1357 },
1358 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301359 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301360 .start = DMOV_SDC4_CHAN,
1361 .end = DMOV_SDC4_CHAN,
1362 .flags = IORESOURCE_DMA,
1363 },
1364 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301365 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301366 .start = DMOV_SDC4_CRCI,
1367 .end = DMOV_SDC4_CRCI,
1368 .flags = IORESOURCE_DMA,
1369 },
1370};
1371
1372struct platform_device msm8625_device_sdc1 = {
1373 .name = "msm_sdcc",
1374 .id = 1,
1375 .num_resources = ARRAY_SIZE(msm8625_resources_sdc1),
1376 .resource = msm8625_resources_sdc1,
1377 .dev = {
1378 .coherent_dma_mask = 0xffffffff,
1379 },
1380};
1381
1382struct platform_device msm8625_device_sdc2 = {
1383 .name = "msm_sdcc",
1384 .id = 2,
1385 .num_resources = ARRAY_SIZE(msm8625_resources_sdc2),
1386 .resource = msm8625_resources_sdc2,
1387 .dev = {
1388 .coherent_dma_mask = 0xffffffff,
1389 },
1390};
1391
1392struct platform_device msm8625_device_sdc3 = {
1393 .name = "msm_sdcc",
1394 .id = 3,
1395 .num_resources = ARRAY_SIZE(msm8625_resources_sdc3),
1396 .resource = msm8625_resources_sdc3,
1397 .dev = {
1398 .coherent_dma_mask = 0xffffffff,
1399 },
1400};
1401
1402struct platform_device msm8625_device_sdc4 = {
1403 .name = "msm_sdcc",
1404 .id = 4,
1405 .num_resources = ARRAY_SIZE(msm8625_resources_sdc4),
1406 .resource = msm8625_resources_sdc4,
1407 .dev = {
1408 .coherent_dma_mask = 0xffffffff,
1409 },
1410};
1411
1412static struct platform_device *msm8625_sdcc_devices[] __initdata = {
1413 &msm8625_device_sdc1,
1414 &msm8625_device_sdc2,
1415 &msm8625_device_sdc3,
1416 &msm8625_device_sdc4,
1417};
1418
1419int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
1420{
1421 struct platform_device *pdev;
1422
1423 if (controller < 1 || controller > 4)
1424 return -EINVAL;
1425
Utsab Bose4ed4ba12012-11-08 18:52:38 +05301426 if (cpu_is_msm8625() || cpu_is_msm8625q())
Trilok Soniee75f6c2012-02-13 20:45:07 +05301427 pdev = msm8625_sdcc_devices[controller-1];
1428 else
1429 pdev = msm_sdcc_devices[controller-1];
1430
1431 pdev->dev.platform_data = plat;
1432 return platform_device_register(pdev);
1433}
1434
Trilok Sonida63a8b2012-02-13 20:50:03 +05301435static struct resource msm8625_resources_hsusb_otg[] = {
1436 {
1437 .start = MSM_HSUSB_PHYS,
1438 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1439 .flags = IORESOURCE_MEM,
1440 },
1441 {
1442 .start = MSM8625_INT_USB_HS,
1443 .end = MSM8625_INT_USB_HS,
1444 .flags = IORESOURCE_IRQ,
1445 },
1446};
1447
1448struct platform_device msm8625_device_otg = {
1449 .name = "msm_otg",
1450 .id = -1,
1451 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_otg),
1452 .resource = msm8625_resources_hsusb_otg,
1453 .dev = {
1454 .dma_mask = &dma_mask,
1455 .coherent_dma_mask = 0xffffffffULL,
1456 },
1457};
1458
1459static struct resource msm8625_resources_gadget_peripheral[] = {
1460 {
1461 .start = MSM_HSUSB_PHYS,
1462 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1463 .flags = IORESOURCE_MEM,
1464 },
1465 {
1466 .start = MSM8625_INT_USB_HS,
1467 .end = MSM8625_INT_USB_HS,
1468 .flags = IORESOURCE_IRQ,
1469 },
1470};
1471
1472struct platform_device msm8625_device_gadget_peripheral = {
1473 .name = "msm_hsusb",
1474 .id = -1,
1475 .num_resources = ARRAY_SIZE(msm8625_resources_gadget_peripheral),
1476 .resource = msm8625_resources_gadget_peripheral,
1477 .dev = {
1478 .dma_mask = &dma_mask,
1479 .coherent_dma_mask = 0xffffffffULL,
1480 },
1481};
1482
1483static struct resource msm8625_resources_hsusb_host[] = {
1484 {
1485 .start = MSM_HSUSB_PHYS,
1486 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1487 .flags = IORESOURCE_MEM,
1488 },
1489 {
1490 .start = MSM8625_INT_USB_HS,
1491 .end = MSM8625_INT_USB_HS,
1492 .flags = IORESOURCE_IRQ,
1493 },
1494};
1495
1496struct platform_device msm8625_device_hsusb_host = {
1497 .name = "msm_hsusb_host",
1498 .id = 0,
1499 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_host),
1500 .resource = msm8625_resources_hsusb_host,
1501 .dev = {
1502 .dma_mask = &dma_mask,
1503 .coherent_dma_mask = 0xffffffffULL,
1504 },
1505};
1506
1507static struct platform_device *msm8625_host_devices[] = {
1508 &msm8625_device_hsusb_host,
1509};
1510
1511int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
1512{
1513 struct platform_device *pdev;
1514
Utsab Bose4ed4ba12012-11-08 18:52:38 +05301515 if (cpu_is_msm8625() || cpu_is_msm8625q())
Trilok Sonida63a8b2012-02-13 20:50:03 +05301516 pdev = msm8625_host_devices[host];
1517 else
1518 pdev = msm_host_devices[host];
1519 if (!pdev)
1520 return -ENODEV;
1521 pdev->dev.platform_data = plat;
1522 return platform_device_register(pdev);
1523}
1524
Trilok Soni88da2552012-02-13 21:01:24 +05301525#ifdef CONFIG_MSM_CAMERA_V4L2
1526static struct resource msm8625_csic0_resources[] = {
1527 {
1528 .name = "csic",
1529 .start = 0xA0F00000,
1530 .end = 0xA0F00000 + 0x00100000 - 1,
1531 .flags = IORESOURCE_MEM,
1532 },
1533 {
1534 .name = "csic",
1535 .start = MSM8625_INT_CSI_IRQ_0,
1536 .end = MSM8625_INT_CSI_IRQ_0,
1537 .flags = IORESOURCE_IRQ,
1538 },
1539};
1540
1541static struct resource msm8625_csic1_resources[] = {
1542 {
1543 .name = "csic",
1544 .start = 0xA1000000,
1545 .end = 0xA1000000 + 0x00100000 - 1,
1546 .flags = IORESOURCE_MEM,
1547 },
1548 {
1549 .name = "csic",
1550 .start = MSM8625_INT_CSI_IRQ_1,
1551 .end = MSM8625_INT_CSI_IRQ_1,
1552 .flags = IORESOURCE_IRQ,
1553 },
1554};
1555
1556struct platform_device msm8625_device_csic0 = {
1557 .name = "msm_csic",
1558 .id = 0,
1559 .resource = msm8625_csic0_resources,
1560 .num_resources = ARRAY_SIZE(msm8625_csic0_resources),
1561};
1562
1563struct platform_device msm8625_device_csic1 = {
1564 .name = "msm_csic",
1565 .id = 1,
1566 .resource = msm8625_csic1_resources,
1567 .num_resources = ARRAY_SIZE(msm8625_csic1_resources),
1568};
1569#endif
1570
Trilok Soniae4633d2012-02-13 21:08:32 +05301571static struct resource msm8625_mipi_dsi_resources[] = {
1572 {
1573 .name = "mipi_dsi",
1574 .start = MIPI_DSI_HW_BASE,
1575 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
1576 .flags = IORESOURCE_MEM,
1577 },
1578 {
1579 .start = MSM8625_INT_DSI_IRQ,
1580 .end = MSM8625_INT_DSI_IRQ,
1581 .flags = IORESOURCE_IRQ,
1582 },
1583};
1584
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301585static struct platform_device msm8625_mipi_dsi_device = {
Trilok Soniae4633d2012-02-13 21:08:32 +05301586 .name = "mipi_dsi",
1587 .id = 1,
1588 .num_resources = ARRAY_SIZE(msm8625_mipi_dsi_resources),
1589 .resource = msm8625_mipi_dsi_resources,
1590};
1591
1592static struct resource msm8625_mdp_resources[] = {
1593 {
1594 .name = "mdp",
1595 .start = MDP_BASE,
1596 .end = MDP_BASE + 0x000F1008 - 1,
1597 .flags = IORESOURCE_MEM,
1598 },
1599 {
1600 .start = MSM8625_INT_MDP,
1601 .end = MSM8625_INT_MDP,
1602 .flags = IORESOURCE_IRQ,
1603 },
1604};
1605
1606static struct platform_device msm8625_mdp_device = {
1607 .name = "mdp",
1608 .id = 0,
1609 .num_resources = ARRAY_SIZE(msm8625_mdp_resources),
1610 .resource = msm8625_mdp_resources,
1611};
1612
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301613struct platform_device mipi_dsi_device;
1614
Trilok Soniae4633d2012-02-13 21:08:32 +05301615void __init msm_fb_register_device(char *name, void *data)
1616{
1617 if (!strncmp(name, "mdp", 3)) {
Utsab Bose4ed4ba12012-11-08 18:52:38 +05301618 if (cpu_is_msm8625() || cpu_is_msm8625q())
Trilok Soniae4633d2012-02-13 21:08:32 +05301619 msm_register_device(&msm8625_mdp_device, data);
1620 else
1621 msm_register_device(&msm_mdp_device, data);
1622 } else if (!strncmp(name, "mipi_dsi", 8)) {
Utsab Bose4ed4ba12012-11-08 18:52:38 +05301623 if (cpu_is_msm8625() || cpu_is_msm8625q()) {
Trilok Soniae4633d2012-02-13 21:08:32 +05301624 msm_register_device(&msm8625_mipi_dsi_device, data);
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301625 mipi_dsi_device = msm8625_mipi_dsi_device;
1626 } else {
Trilok Soniae4633d2012-02-13 21:08:32 +05301627 msm_register_device(&msm_mipi_dsi_device, data);
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301628 mipi_dsi_device = msm_mipi_dsi_device;
1629 }
Trilok Soniae4633d2012-02-13 21:08:32 +05301630 } else if (!strncmp(name, "lcdc", 4)) {
1631 msm_register_device(&msm_lcdc_device, data);
1632 } else {
1633 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
1634 }
1635}
1636
Trilok Soni664b95d2012-02-13 21:13:15 +05301637static struct resource msm8625_kgsl_3d0_resources[] = {
1638 {
1639 .name = KGSL_3D0_REG_MEMORY,
1640 .start = 0xA0000000,
1641 .end = 0xA001ffff,
1642 .flags = IORESOURCE_MEM,
1643 },
1644 {
1645 .name = KGSL_3D0_IRQ,
1646 .start = MSM8625_INT_GRAPHICS,
1647 .end = MSM8625_INT_GRAPHICS,
1648 .flags = IORESOURCE_IRQ,
1649 },
1650};
1651
1652struct platform_device msm8625_kgsl_3d0 = {
1653 .name = "kgsl-3d0",
1654 .id = 0,
1655 .num_resources = ARRAY_SIZE(msm8625_kgsl_3d0_resources),
1656 .resource = msm8625_kgsl_3d0_resources,
1657 .dev = {
1658 .platform_data = &kgsl_3d0_pdata,
1659 },
1660};
1661
Taniya Das364426e2012-09-28 17:09:51 +05301662static struct resource pl310_resources[] = {
1663 {
1664 .start = 0xC0400000,
1665 .end = 0xC0400000 + SZ_4K - 1,
1666 .flags = IORESOURCE_MEM,
1667 },
1668 {
1669 .name = "l2_irq",
1670 .start = MSM8625_INT_L2CC_INTR,
1671 .flags = IORESOURCE_IRQ,
1672 },
1673};
1674
1675static struct platform_device pl310_erp_device = {
1676 .name = "pl310_erp",
1677 .id = -1,
1678 .resource = pl310_resources,
1679 .num_resources = ARRAY_SIZE(pl310_resources),
1680};
1681
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301682enum {
1683 MSM8625,
1684 MSM8625A,
1685 MSM8625AB,
1686};
1687
1688static int __init msm8625_cpu_id(void)
1689{
1690 int raw_id, cpu;
1691
1692 raw_id = socinfo_get_raw_id();
1693 switch (raw_id) {
1694 /* Part number for 1GHz part */
1695 case 0x770:
1696 case 0x771:
1697 case 0x77C:
1698 case 0x780:
Kaushal Kumarc84b9c22012-10-12 12:47:55 +05301699 case 0x785: /* Edge-only MSM8125-0 */
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301700 case 0x8D0:
1701 cpu = MSM8625;
1702 break;
1703 /* Part number for 1.2GHz part */
1704 case 0x773:
1705 case 0x774:
1706 case 0x781:
1707 case 0x8D1:
1708 cpu = MSM8625A;
1709 break;
1710 case 0x775:
1711 case 0x776:
Kaushal Kumar5b700f32012-09-05 16:50:19 +05301712 case 0x779:
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301713 case 0x77D:
1714 case 0x782:
1715 case 0x8D2:
1716 cpu = MSM8625AB;
1717 break;
1718 default:
1719 pr_err("Invalid Raw ID\n");
1720 return -ENODEV;
1721 }
1722 return cpu;
1723}
1724
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301725static struct resource cpr_resources[] = {
1726 {
1727 .start = MSM8625_INT_CPR_IRQ0,
1728 .flags = IORESOURCE_IRQ,
1729 },
1730 {
1731 .start = MSM8625_CPR_PHYS,
1732 .end = MSM8625_CPR_PHYS + SZ_4K - 1,
1733 .flags = IORESOURCE_MEM,
1734 },
1735};
1736
1737/**
1738 * These are various Vdd levels supported by PMIC
1739 */
1740static uint32_t msm_c2_pmic_mv[] __initdata = {
Trilok Soni9573ce32012-09-02 03:50:18 +05301741 1350000, 1337500, 1325000, 1312500, 1300000,
1742 1287500, 1275000, 1262500, 1250000, 1237500,
1743 1225000, 1212500, 1200000, 1187500, 1175000,
1744 1162500, 1150000, 1137500, 1125000, 1112500,
1745 1100000, 1087500, 1075000, 1062500, 0,
1746 0, 0, 0, 0, 0,
1747 0, 1050000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301748};
1749
1750/**
1751 * This data will be based on CPR mode of operation
1752 */
1753static struct msm_cpr_mode msm_cpr_mode_data[] = {
1754 [NORMAL_MODE] = {
1755 .ring_osc_data = {
1756 {0, },
1757 {0, },
1758 {0, },
1759 {0, },
1760 {0, },
1761 {0, },
1762 {0, },
1763 {0, },
1764 },
1765 .ring_osc = 0,
1766 .step_quot = ~0,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301767 .tgt_volt_offset = 0,
Trilok Sonidb64ae92012-09-02 02:09:04 +05301768 .nom_Vmax = 1350000,
1769 .nom_Vmin = 1250000,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301770 .calibrated_uV = 1100000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301771 },
1772 [TURBO_MODE] = {
1773 .ring_osc_data = {
1774 {0, },
1775 {0, },
1776 {0, },
1777 {0, },
1778 {0, },
1779 {0, },
1780 {0, },
1781 {0, },
1782 },
1783 .ring_osc = 0,
1784 .step_quot = ~0,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301785 .tgt_volt_offset = 0,
Trilok Sonidb64ae92012-09-02 02:09:04 +05301786 .turbo_Vmax = 1350000,
Kaushal Kumar1f549fc2012-10-04 11:45:32 +05301787 .turbo_Vmin = 1150000,
Trilok Sonidb64ae92012-09-02 02:09:04 +05301788 .nom_Vmax = 1350000,
Kaushal Kumar1f549fc2012-10-04 11:45:32 +05301789 .nom_Vmin = 1150000,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301790 .calibrated_uV = 1300000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301791 },
1792};
1793
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301794static uint32_t
1795msm_cpr_get_quot(uint32_t max_quot, uint32_t max_freq, uint32_t new_freq)
1796{
1797 uint32_t quot;
1798
1799 /* This formula is as per chip characterization data */
Kaushal Kumarddd521c2012-09-18 19:50:53 +05301800 quot = max_quot - (((max_freq - new_freq) * 7) / 10);
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301801
1802 return quot;
1803}
1804
1805static void msm_cpr_clk_enable(void)
1806{
1807 uint32_t reg_val;
1808
1809 /* Select TCXO (19.2MHz) as clock source */
1810 reg_val = readl_relaxed(A11S_TEST_BUS_SEL_ADDR);
1811 reg_val |= RBCPR_CLK_MUX_SEL;
1812 writel_relaxed(reg_val, A11S_TEST_BUS_SEL_ADDR);
1813
1814 /* Get CPR out of reset */
1815 writel_relaxed(0x1, RBCPR_SW_RESET_N);
1816}
1817
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301818static struct msm_cpr_config msm_cpr_pdata = {
1819 .ref_clk_khz = 19200,
Kaushal Kumar3e60a102012-10-15 16:54:16 +05301820 .delay_us = 25000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301821 .irq_line = 0,
1822 .cpr_mode_data = msm_cpr_mode_data,
1823 .tgt_count_div_N = 1,
1824 .floor = 0,
1825 .ceiling = 40,
1826 .sw_vlevel = 20,
1827 .up_threshold = 1,
Kaushal Kumar3e60a102012-10-15 16:54:16 +05301828 .dn_threshold = 3,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301829 .up_margin = 0,
1830 .dn_margin = 0,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301831 .max_nom_freq = 700800,
1832 .max_freq = 1401600,
1833 .max_quot = 0,
Kaushal Kumarecfc9182012-10-25 16:17:51 +05301834 .disable_cpr = false,
Tirupathi Reddy7c5d7b12012-11-06 13:29:36 +05301835 .step_size = 12500,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301836 .get_quot = msm_cpr_get_quot,
1837 .clk_enable = msm_cpr_clk_enable,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301838};
1839
1840static struct platform_device msm8625_device_cpr = {
1841 .name = "msm-cpr",
1842 .id = -1,
1843 .num_resources = ARRAY_SIZE(cpr_resources),
1844 .resource = cpr_resources,
1845 .dev = {
1846 .platform_data = &msm_cpr_pdata,
1847 },
1848};
1849
1850static struct platform_device msm8625_vp_device = {
1851 .name = "vp-regulator",
1852 .id = -1,
1853};
1854
1855static void __init msm_cpr_init(void)
1856{
1857 struct cpr_info_type *cpr_info = NULL;
1858 uint8_t ring_osc = 0;
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301859
1860 cpr_info = kzalloc(sizeof(struct cpr_info_type), GFP_KERNEL);
1861 if (!cpr_info) {
1862 pr_err("%s: Out of memory %d\n", __func__, -ENOMEM);
1863 return;
1864 }
1865
1866 msm_smem_get_cpr_info(cpr_info);
Kaushal Kumarecfc9182012-10-25 16:17:51 +05301867 msm_cpr_pdata.disable_cpr = cpr_info->disable_cpr;
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301868
1869 /**
1870 * Set the ring_osc based on efuse BIT(0)
1871 * CPR_fuse[0] = 0 selects 2nd RO (010)
1872 * CPR_fuse[0] = 1 select 3rd RO (011)
1873 */
1874 if (cpr_info->ring_osc == 0x0)
1875 ring_osc = 0x2;
1876 else if (cpr_info->ring_osc == 0x1)
1877 ring_osc = 0x3;
1878
1879 msm_cpr_mode_data[TURBO_MODE].ring_osc = ring_osc;
1880 msm_cpr_mode_data[NORMAL_MODE].ring_osc = ring_osc;
1881
1882 /* GCNT = 1000 nsec/52nsec (@TCX0=19.2Mhz) = 19.2 */
1883 msm_cpr_mode_data[TURBO_MODE].ring_osc_data[ring_osc].gcnt = 19;
1884 msm_cpr_mode_data[NORMAL_MODE].ring_osc_data[ring_osc].gcnt = 19;
1885
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301886 /**
1887 * The scaling factor and offset are as per chip characterization data
1888 * This formula is used since available fuse bits in the chip are not
1889 * enough to represent the value of maximum quot
1890 */
Trilok Soni7f311172012-09-02 15:15:33 +05301891 msm_cpr_pdata.max_quot = cpr_info->turbo_quot * 10 + 600;
Kaushal Kumarbcb46d92012-10-04 11:31:14 +05301892 /**
1893 * Fused Quot value for 1.2GHz on a 1.2GHz part is lower than
1894 * the quot value calculated using the scaling factor formula for
1895 * 1.2GHz when running on a 1.4GHz part. So, prop up the Quot for
1896 * a 1.2GHz part by a chip characterization recommended value.
1897 * Ditto for a 1.0GHz part.
1898 */
1899 if (msm8625_cpu_id() == MSM8625A) {
Kaushal Kumar3a9f6c82012-10-19 15:30:28 +05301900 msm_cpr_pdata.max_quot += 30;
Kaushal Kumarbcb46d92012-10-04 11:31:14 +05301901 if (msm_cpr_pdata.max_quot > 1400)
1902 msm_cpr_pdata.max_quot = 1400;
1903 } else if (msm8625_cpu_id() == MSM8625) {
Kaushal Kumar3a9f6c82012-10-19 15:30:28 +05301904 msm_cpr_pdata.max_quot += 50;
Kaushal Kumarbcb46d92012-10-04 11:31:14 +05301905 if (msm_cpr_pdata.max_quot > 1350)
1906 msm_cpr_pdata.max_quot = 1350;
1907 }
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301908
1909 /**
1910 * Bits 4:0 of pvs_fuse provide mapping to the safe boot up voltage.
1911 * Boot up mode is by default Turbo.
1912 */
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301913 msm_cpr_mode_data[TURBO_MODE].calibrated_uV =
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301914 msm_c2_pmic_mv[cpr_info->pvs_fuse & 0x1F];
1915
Kaushal Kumar1f549fc2012-10-04 11:45:32 +05301916 if ((cpr_info->floor_fuse & 0x3) == 0x0) {
1917 msm_cpr_mode_data[TURBO_MODE].nom_Vmin = 1000000;
1918 msm_cpr_mode_data[TURBO_MODE].turbo_Vmin = 1100000;
1919 } else if ((cpr_info->floor_fuse & 0x3) == 0x1) {
1920 msm_cpr_mode_data[TURBO_MODE].nom_Vmin = 1050000;
1921 msm_cpr_mode_data[TURBO_MODE].turbo_Vmin = 1100000;
1922 } else if ((cpr_info->floor_fuse & 0x3) == 0x2) {
1923 msm_cpr_mode_data[TURBO_MODE].nom_Vmin = 1100000;
1924 msm_cpr_mode_data[TURBO_MODE].turbo_Vmin = 1100000;
1925 }
1926
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301927 pr_debug("%s: cpr: ring_osc: 0x%x\n", __func__,
1928 msm_cpr_mode_data[TURBO_MODE].ring_osc);
1929 pr_debug("%s: cpr: turbo_quot: 0x%x\n", __func__, cpr_info->turbo_quot);
1930 pr_debug("%s: cpr: pvs_fuse: 0x%x\n", __func__, cpr_info->pvs_fuse);
Kaushal Kumar1f549fc2012-10-04 11:45:32 +05301931 pr_debug("%s: cpr: floor_fuse: 0x%x\n", __func__, cpr_info->floor_fuse);
1932 pr_debug("%s: cpr: nom_Vmin: %d, turbo_Vmin: %d\n", __func__,
1933 msm_cpr_mode_data[TURBO_MODE].nom_Vmin,
1934 msm_cpr_mode_data[TURBO_MODE].turbo_Vmin);
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301935 kfree(cpr_info);
1936
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301937 if (msm8625_cpu_id() == MSM8625A)
1938 msm_cpr_pdata.max_freq = 1209600;
1939 else if (msm8625_cpu_id() == MSM8625)
1940 msm_cpr_pdata.max_freq = 1008000;
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301941
Tirupathi Reddy23cb2df2012-11-06 14:57:38 +05301942 if (machine_is_qrd_skud_prime() || cpu_is_msm8625q())
1943 msm_cpr_pdata.step_size = 6250;
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301944 platform_device_register(&msm8625_vp_device);
1945 platform_device_register(&msm8625_device_cpr);
1946}
1947
Taniya Das7c9f0512011-12-02 14:26:46 +05301948static struct clk_lookup msm_clock_8625_dummy[] = {
1949 CLK_DUMMY("core_clk", adm_clk.c, "msm_dmov", 0),
1950 CLK_DUMMY("adsp_clk", adsp_clk.c, NULL, 0),
1951 CLK_DUMMY("ahb_m_clk", ahb_m_clk.c, NULL, 0),
1952 CLK_DUMMY("ahb_s_clk", ahb_s_clk.c, NULL, 0),
1953 CLK_DUMMY("cam_m_clk", cam_m_clk.c, NULL, 0),
1954 CLK_DUMMY("csi_clk", csi1_clk.c, NULL, 0),
1955 CLK_DUMMY("csi_pclk", csi1_p_clk.c, NULL, 0),
1956 CLK_DUMMY("csi_vfe_clk", csi1_vfe_clk.c, NULL, 0),
1957 CLK_DUMMY("dsi_byte_clk", dsi_byte_clk.c, NULL, 0),
1958 CLK_DUMMY("dsi_clk", dsi_clk.c, NULL, 0),
1959 CLK_DUMMY("dsi_esc_clk", dsi_esc_clk.c, NULL, 0),
1960 CLK_DUMMY("dsi_pixel_clk", dsi_pixel_clk.c, NULL, 0),
1961 CLK_DUMMY("dsi_ref_clk", dsi_ref_clk.c, NULL, 0),
1962 CLK_DUMMY("ebi1_clk", ebi1_clk.c, NULL, 0),
1963 CLK_DUMMY("ebi2_clk", ebi2_clk.c, NULL, 0),
1964 CLK_DUMMY("ecodec_clk", ecodec_clk.c, NULL, 0),
1965 CLK_DUMMY("gp_clk", gp_clk.c, NULL, 0),
1966 CLK_DUMMY("core_clk", gsbi1_qup_clk.c, "qup_i2c.0", 0),
1967 CLK_DUMMY("core_clk", gsbi2_qup_clk.c, "qup_i2c.1", 0),
1968 CLK_DUMMY("iface_clk", gsbi1_qup_p_clk.c, "qup_i2c.0", 0),
1969 CLK_DUMMY("iface_clk", gsbi2_qup_p_clk.c, "qup_i2c.1", 0),
1970 CLK_DUMMY("icodec_rx_clk", icodec_rx_clk.c, NULL, 0),
1971 CLK_DUMMY("icodec_tx_clk", icodec_tx_clk.c, NULL, 0),
1972 CLK_DUMMY("mem_clk", imem_clk.c, NULL, 0),
1973 CLK_DUMMY("mddi_clk", pmdh_clk.c, NULL, 0),
1974 CLK_DUMMY("mdp_clk", mdp_clk.c, NULL, 0),
1975 CLK_DUMMY("mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk.c, NULL, 0),
1976 CLK_DUMMY("mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk.c, NULL, 0),
1977 CLK_DUMMY("mdp_vsync_clk", mdp_vsync_clk.c, NULL, 0),
1978 CLK_DUMMY("mdp_dsi_pclk", mdp_dsi_p_clk.c, NULL, 0),
1979 CLK_DUMMY("pbus_clk", pbus_clk.c, NULL, 0),
1980 CLK_DUMMY("pcm_clk", pcm_clk.c, NULL, 0),
1981 CLK_DUMMY("sdac_clk", sdac_clk.c, NULL, 0),
1982 CLK_DUMMY("core_clk", sdc1_clk.c, "msm_sdcc.1", 0),
1983 CLK_DUMMY("iface_clk", sdc1_p_clk.c, "msm_sdcc.1", 0),
1984 CLK_DUMMY("core_clk", sdc2_clk.c, "msm_sdcc.2", 0),
1985 CLK_DUMMY("iface_clk", sdc2_p_clk.c, "msm_sdcc.2", 0),
1986 CLK_DUMMY("core_clk", sdc3_clk.c, "msm_sdcc.3", 0),
1987 CLK_DUMMY("iface_clk", sdc3_p_clk.c, "msm_sdcc.3", 0),
1988 CLK_DUMMY("core_clk", sdc4_clk.c, "msm_sdcc.4", 0),
1989 CLK_DUMMY("iface_clk", sdc4_p_clk.c, "msm_sdcc.4", 0),
1990 CLK_DUMMY("ref_clk", tsif_ref_clk.c, "msm_tsif.0", 0),
1991 CLK_DUMMY("iface_clk", tsif_p_clk.c, "msm_tsif.0", 0),
1992 CLK_DUMMY("core_clk", uart1_clk.c, "msm_serial.0", 0),
1993 CLK_DUMMY("core_clk", uart2_clk.c, "msm_serial.1", 0),
1994 CLK_DUMMY("core_clk", uart1dm_clk.c, "msm_serial_hs.0", 0),
1995 CLK_DUMMY("core_clk", uart2dm_clk.c, "msm_serial_hsl.0", 0),
1996 CLK_DUMMY("usb_hs_core_clk", usb_hs_core_clk.c, NULL, 0),
1997 CLK_DUMMY("usb_hs2_clk", usb_hs2_clk.c, NULL, 0),
1998 CLK_DUMMY("usb_hs_clk", usb_hs_clk.c, NULL, 0),
1999 CLK_DUMMY("usb_hs_pclk", usb_hs_p_clk.c, NULL, 0),
2000 CLK_DUMMY("usb_phy_clk", usb_phy_clk.c, NULL, 0),
2001 CLK_DUMMY("vdc_clk", vdc_clk.c, NULL, 0),
2002 CLK_DUMMY("ebi1_acpu_clk", ebi_acpu_clk.c, NULL, 0),
2003 CLK_DUMMY("ebi1_lcdc_clk", ebi_lcdc_clk.c, NULL, 0),
2004 CLK_DUMMY("ebi1_mddi_clk", ebi_mddi_clk.c, NULL, 0),
2005 CLK_DUMMY("ebi1_usb_clk", ebi_usb_clk.c, NULL, 0),
2006 CLK_DUMMY("ebi1_vfe_clk", ebi_vfe_clk.c, NULL, 0),
2007 CLK_DUMMY("mem_clk", ebi_adm_clk.c, "msm_dmov", 0),
2008};
2009
2010struct clock_init_data msm8625_dummy_clock_init_data __initdata = {
2011 .table = msm_clock_8625_dummy,
2012 .size = ARRAY_SIZE(msm_clock_8625_dummy),
2013};
Pankaj Kumar50c705c2012-01-10 12:02:07 +05302014
Taniya Das6e0ff0d2012-10-12 11:38:32 +05302015
2016static int __init msm_gpio_config_gps(void)
2017{
2018 unsigned int gps_gpio = 7;
2019 int ret = 0;
2020
2021 if (!machine_is_msm8625_evb())
2022 return ret;
2023
2024 ret = gpio_tlmm_config(GPIO_CFG(gps_gpio, 0, GPIO_CFG_OUTPUT,
2025 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
2026 if (ret < 0) {
2027 pr_err("gpio tlmm failed for gpio-%d\n", gps_gpio);
2028 return ret;
2029 }
2030
2031 ret = gpio_request(gps_gpio, "gnss-gpio");
2032 if (ret < 0) {
2033 pr_err("failed to request gpio-%d\n", gps_gpio);
2034 return ret;
2035 }
2036
2037 ret = gpio_direction_input(gps_gpio);
2038 if (ret < 0) {
2039 pr_err("failed to change direction for gpio-%d\n", gps_gpio);
2040 return ret;
2041 }
2042
2043 ret = gpio_export(gps_gpio, true);
2044 if (ret < 0)
2045 pr_err("failed to export gpio for user\n");
2046
2047 return ret;
2048}
2049
Utsab Bose2e7a90a2012-12-10 20:22:27 +05302050static int __init msm_acpuclock_init(bool flag)
Trilok Soni31f00272012-11-08 14:36:51 +05302051{
2052 struct cpr_info_type *acpu_info = NULL;
2053 acpu_info = kzalloc(sizeof(struct cpr_info_type), GFP_KERNEL);
2054 if (!acpu_info) {
2055 pr_err("%s: Out of memory %d\n", __func__, -ENOMEM);
2056 return -ENOMEM;
2057 }
2058 msm_smem_get_cpr_info(acpu_info);
2059 msm8625q_acpuclk_pdata.pvs_voltage_uv =
2060 msm_c2_pmic_mv[acpu_info->pvs_fuse & 0x1F];
2061 kfree(acpu_info);
Utsab Bose2e7a90a2012-12-10 20:22:27 +05302062 msm8625q_acpuclk_pdata.flag = flag;
Trilok Soni31f00272012-11-08 14:36:51 +05302063 return 0;
2064}
2065
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002066int __init msm7x2x_misc_init(void)
2067{
Taniya Das7c9f0512011-12-02 14:26:46 +05302068 if (machine_is_msm8625_rumi3()) {
2069 msm_clock_init(&msm8625_dummy_clock_init_data);
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05302070 msm_cpr_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05302071 return 0;
Taniya Das7c9f0512011-12-02 14:26:46 +05302072 }
Taniya Das43bcdd62011-12-02 17:33:27 +05302073
Stephen Boydbb600ae2011-08-02 20:11:40 -07002074 msm_clock_init(&msm7x27a_clock_init_data);
Pankaj Kumarfee56a82012-04-17 14:26:49 +05302075 if (cpu_is_msm7x27aa() || cpu_is_msm7x25ab())
Matt Wagantallbf430eb2012-03-22 11:45:49 -07002076 platform_device_register(&msm7x27aa_device_acpuclk);
Utsab Bose4051d252012-11-30 13:32:50 +05302077 else if (cpu_is_msm8625q()) {
Utsab Bose2e7a90a2012-12-10 20:22:27 +05302078 msm_acpuclock_init(1);
2079 platform_device_register(&msm8625q_device_acpuclk);
Utsab Bose4051d252012-11-30 13:32:50 +05302080 } else if (cpu_is_msm8625()) {
2081 if (machine_is_qrd_skud_prime()) {
Utsab Bose2e7a90a2012-12-10 20:22:27 +05302082 msm_acpuclock_init(0);
Trilok Soni31f00272012-11-08 14:36:51 +05302083 platform_device_register(&msm8625q_device_acpuclk);
2084 } else if (msm8625_cpu_id() == MSM8625)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07002085 platform_device_register(&msm7x27aa_device_acpuclk);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05302086 else if (msm8625_cpu_id() == MSM8625A)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07002087 platform_device_register(&msm8625_device_acpuclk);
Kaushal Kumar86473f02012-06-28 19:35:58 +05302088 else if (msm8625_cpu_id() == MSM8625AB)
2089 platform_device_register(&msm8625ab_device_acpuclk);
Matt Wagantallbf430eb2012-03-22 11:45:49 -07002090 } else {
2091 platform_device_register(&msm7x27a_device_acpuclk);
2092 }
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05302093
Utsab Bose4ed4ba12012-11-08 18:52:38 +05302094 if (cpu_is_msm8625() || (cpu_is_msm8625q() &&
2095 SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2))
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05302096 msm_cpr_init();
2097
Utsab Bose4ed4ba12012-11-08 18:52:38 +05302098 if (!cpu_is_msm8625() && !cpu_is_msm8625q())
Taniya Das364426e2012-09-28 17:09:51 +05302099 pl310_resources[1].start = INT_L2CC_INTR;
2100
2101 platform_device_register(&pl310_erp_device);
2102
Taniya Das6e0ff0d2012-10-12 11:38:32 +05302103 if (msm_gpio_config_gps() < 0)
2104 pr_err("Error for gpio config for GPS gpio\n");
2105
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002106 return 0;
2107}
2108
2109#ifdef CONFIG_CACHE_L2X0
2110static int __init msm7x27x_cache_init(void)
2111{
2112 int aux_ctrl = 0;
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05302113 int pctrl = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002114
2115 /* Way Size 010(0x2) 32KB */
2116 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
2117 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
2118 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
2119
Utsab Bose4ed4ba12012-11-08 18:52:38 +05302120 if (cpu_is_msm8625() || cpu_is_msm8625q()) {
Taniya Das379b5682011-12-02 14:53:46 +05302121 /* Way Size 011(0x3) 64KB */
2122 aux_ctrl |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
2123 (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | \
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05302124 (0X1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) | \
2125 (0x1 << L2X0_AUX_CTRL_L2_FORCE_NWA_SHIFT);
2126
2127 /* Write Prefetch Control settings */
2128 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
2129 pctrl |= (0x3 << L2X0_PREFETCH_CTRL_OFFSET_SHIFT) | \
2130 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_INC_SHIFT) | \
2131 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_SHIFT);
2132 writel_relaxed(pctrl , MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
Taniya Das379b5682011-12-02 14:53:46 +05302133 }
2134
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002135 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
Utsab Bose4ed4ba12012-11-08 18:52:38 +05302136 if (cpu_is_msm8625() || cpu_is_msm8625q()) {
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05302137 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
2138 pr_info("Prfetch Ctrl: 0x%08x\n", pctrl);
2139 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002140
2141 return 0;
2142}
2143#else
pankaj kumar80d7cb62011-08-23 13:37:55 +05302144static int __init msm7x27x_cache_init(void){ return 0; }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002145#endif
2146
2147void __init msm_common_io_init(void)
2148{
2149 msm_map_common_io();
Taniya Das43bcdd62011-12-02 17:33:27 +05302150 if (socinfo_init() < 0)
2151 pr_err("%s: socinfo_init() failed!\n", __func__);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002152 msm7x27x_cache_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05302153}
2154
2155void __init msm8625_init_irq(void)
2156{
Trilok Soni1a9fdee2012-05-28 19:54:11 +05302157 msm_gic_irq_extn_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05302158 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
2159 (void *)MSM_QGIC_CPU_BASE);
Taniya Das43bcdd62011-12-02 17:33:27 +05302160}
2161
2162void __init msm8625_map_io(void)
2163{
2164 msm_map_msm8625_io();
2165
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002166 if (socinfo_init() < 0)
2167 pr_err("%s: socinfo_init() failed!\n", __func__);
Taniya Das379b5682011-12-02 14:53:46 +05302168 msm7x27x_cache_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002169}
2170
Taniya Das43bcdd62011-12-02 17:33:27 +05302171static int msm7627a_init_gpio(void)
2172{
Utsab Bose4ed4ba12012-11-08 18:52:38 +05302173 if (cpu_is_msm8625() || cpu_is_msm8625q())
Taniya Das6684d622012-01-12 10:29:09 +05302174 platform_device_register(&msm8625_device_gpio);
2175 else
2176 platform_device_register(&msm_device_gpio);
Taniya Das43bcdd62011-12-02 17:33:27 +05302177 return 0;
2178}
2179postcore_initcall(msm7627a_init_gpio);
Taniya Das9d0c3c52012-05-04 14:40:55 +05302180
2181static int msm7627a_panic_handler(struct notifier_block *this,
2182 unsigned long event, void *ptr)
2183{
Ranjhith Kalisamyb5fabb42012-10-30 18:43:20 +05302184 msm_clk_dump_debug_info();
Taniya Das9d0c3c52012-05-04 14:40:55 +05302185 flush_cache_all();
2186 outer_flush_all();
2187 return NOTIFY_DONE;
2188}
2189
2190static struct notifier_block panic_handler = {
2191 .notifier_call = msm7627a_panic_handler,
Aparna Mallavarapua9990472012-09-26 12:25:24 +05302192 .priority = INT_MAX,
Taniya Das9d0c3c52012-05-04 14:40:55 +05302193};
2194
2195static int __init panic_register(void)
2196{
2197 atomic_notifier_chain_register(&panic_notifier_list,
2198 &panic_handler);
2199 return 0;
2200}
2201module_init(panic_register);