blob: 446d6b62673c80ee0e2f0a840ce036f53feb563d [file] [log] [blame]
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -08001/* Copyright (c) 2011-2013, 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 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 .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700946};
947
948struct platform_device msm_kgsl_3d0 = {
949 .name = "kgsl-3d0",
950 .id = 0,
951 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
952 .resource = kgsl_3d0_resources,
953 .dev = {
954 .platform_data = &kgsl_3d0_pdata,
955 },
956};
957
958void __init msm7x25a_kgsl_3d0_init(void)
959{
Pankaj Kumarfee56a82012-04-17 14:26:49 +0530960 if (cpu_is_msm7x25a() || cpu_is_msm7x25aa() || cpu_is_msm7x25ab()) {
Lynus Vaz971610e2012-01-06 11:00:32 +0530961 kgsl_3d0_pdata.num_levels = 2;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600962 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 133330000;
963 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 160000000;
964 kgsl_3d0_pdata.pwrlevel[1].gpu_freq = 96000000;
965 kgsl_3d0_pdata.pwrlevel[1].bus_freq = 0;
Rajesh Kemisettidf6e62f2012-03-12 14:02:30 +0530966 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700967}
968
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700969void __init msm8x25_kgsl_3d0_init(void)
970{
Utsab Bose4ed4ba12012-11-08 18:52:38 +0530971 if (cpu_is_msm8625() || cpu_is_msm8625q()) {
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700972 kgsl_3d0_pdata.idle_timeout = HZ/5;
Lynus Vazfe4bede2012-04-06 11:53:30 -0700973 kgsl_3d0_pdata.strtstp_sleepwake = false;
Ranjhith Kalisamy5fb30ef2012-08-12 16:26:36 +0530974
975 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
976 /* 8x25 v2.0 & above supports a higher GPU frequency */
977 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 320000000;
978 else
979 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 300000000;
980
Ranjhith Kalisamy24696322012-04-11 22:09:17 +0530981 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 200000000;
Lynus Vazfe4bede2012-04-06 11:53:30 -0700982 }
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700983}
984
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700985static void __init msm_register_device(struct platform_device *pdev, void *data)
986{
987 int ret;
988
989 pdev->dev.platform_data = data;
990
991 ret = platform_device_register(pdev);
992
993 if (ret)
994 dev_err(&pdev->dev,
995 "%s: platform_device_register() failed = %d\n",
996 __func__, ret);
997}
998
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700999
1000#define PERPH_WEB_BLOCK_ADDR (0xA9D00040)
1001#define PDM0_CTL_OFFSET (0x04)
1002#define SIZE_8B (0x08)
1003
1004static struct resource resources_led[] = {
1005 {
1006 .start = PERPH_WEB_BLOCK_ADDR,
1007 .end = PERPH_WEB_BLOCK_ADDR + (SIZE_8B) - 1,
1008 .name = "led-gpio-pdm",
1009 .flags = IORESOURCE_MEM,
1010 },
1011};
1012
1013static struct led_info msm_kpbl_pdm_led_pdata = {
1014 .name = "keyboard-backlight",
1015};
1016
1017struct platform_device led_pdev = {
1018 .name = "leds-msm-pdm",
1019 /* use pdev id to represent pdm id */
1020 .id = 0,
1021 .num_resources = ARRAY_SIZE(resources_led),
1022 .resource = resources_led,
1023 .dev = {
1024 .platform_data = &msm_kpbl_pdm_led_pdata,
1025 },
1026};
1027
Manish Dewangan3a260992011-06-24 18:01:34 +05301028struct platform_device asoc_msm_pcm = {
1029 .name = "msm-dsp-audio",
1030 .id = 0,
1031};
1032
1033struct platform_device asoc_msm_dai0 = {
1034 .name = "msm-codec-dai",
1035 .id = 0,
1036};
1037
1038struct platform_device asoc_msm_dai1 = {
1039 .name = "msm-cpu-dai",
1040 .id = 0,
1041};
1042
Taniya Das2e948192011-12-20 11:15:13 +05301043static struct resource gpio_resources[] = {
1044 {
1045 .start = INT_GPIO_GROUP1,
1046 .flags = IORESOURCE_IRQ,
1047 },
1048 {
1049 .start = INT_GPIO_GROUP2,
1050 .flags = IORESOURCE_IRQ,
1051 },
1052};
1053
1054static struct platform_device msm_device_gpio = {
1055 .name = "msmgpio",
1056 .id = -1,
1057 .resource = gpio_resources,
1058 .num_resources = ARRAY_SIZE(gpio_resources),
1059};
1060
Taniya Das43bcdd62011-12-02 17:33:27 +05301061struct platform_device *msm_footswitch_devices[] = {
Matt Wagantalld6fbf232012-05-03 20:09:28 -07001062 FS_PCOM(FS_GFX3D, "vdd", "kgsl-3d0.0"),
Taniya Das43bcdd62011-12-02 17:33:27 +05301063};
1064unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);
1065
1066/* MSM8625 Devices */
1067
1068static struct resource msm8625_resources_uart1[] = {
1069 {
1070 .start = MSM8625_INT_UART1,
1071 .end = MSM8625_INT_UART1,
1072 .flags = IORESOURCE_IRQ,
1073 },
1074 {
Taniya Das13b811a2011-12-09 18:33:45 +05301075 .start = MSM7XXX_UART1_PHYS,
1076 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Taniya Das43bcdd62011-12-02 17:33:27 +05301077 .flags = IORESOURCE_MEM,
1078 },
1079};
1080
1081struct platform_device msm8625_device_uart1 = {
1082 .name = "msm_serial",
1083 .id = 0,
1084 .num_resources = ARRAY_SIZE(msm8625_resources_uart1),
1085 .resource = msm8625_resources_uart1,
1086};
1087
Trilok Soni269fff42012-02-13 20:35:30 +05301088static struct resource msm8625_uart1_dm_resources[] = {
1089 {
1090 .start = MSM_UART1DM_PHYS,
1091 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
1092 .flags = IORESOURCE_MEM,
1093 },
1094 {
1095 .start = MSM8625_INT_UART1DM_IRQ,
1096 .end = MSM8625_INT_UART1DM_IRQ,
1097 .flags = IORESOURCE_IRQ,
1098 },
1099 {
1100 .start = MSM8625_INT_UART1DM_RX,
1101 .end = MSM8625_INT_UART1DM_RX,
1102 .flags = IORESOURCE_IRQ,
1103 },
1104 {
1105 .start = DMOV_HSUART1_TX_CHAN,
1106 .end = DMOV_HSUART1_RX_CHAN,
1107 .name = "uartdm_channels",
1108 .flags = IORESOURCE_DMA,
1109 },
1110 {
1111 .start = DMOV_HSUART1_TX_CRCI,
1112 .end = DMOV_HSUART1_RX_CRCI,
1113 .name = "uartdm_crci",
1114 .flags = IORESOURCE_DMA,
1115 },
1116};
1117
1118struct platform_device msm8625_device_uart_dm1 = {
1119 .name = "msm_serial_hs",
1120 .id = 0,
1121 .num_resources = ARRAY_SIZE(msm8625_uart1_dm_resources),
1122 .resource = msm8625_uart1_dm_resources,
1123 .dev = {
1124 .dma_mask = &msm_uart_dm1_dma_mask,
1125 .coherent_dma_mask = DMA_BIT_MASK(32),
1126 },
1127};
1128
1129static struct resource msm8625_uart2dm_resources[] = {
1130 {
1131 .start = MSM_UART2DM_PHYS,
1132 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
1133 .name = "uartdm_resource",
1134 .flags = IORESOURCE_MEM,
1135 },
1136 {
1137 .start = MSM8625_INT_UART2DM_IRQ,
1138 .end = MSM8625_INT_UART2DM_IRQ,
1139 .flags = IORESOURCE_IRQ,
1140 },
1141};
1142
1143struct platform_device msm8625_device_uart_dm2 = {
1144 .name = "msm_serial_hsl",
1145 .id = 0,
1146 .num_resources = ARRAY_SIZE(msm8625_uart2dm_resources),
1147 .resource = msm8625_uart2dm_resources,
1148};
1149
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +05301150static struct resource msm8625_resources_adsp[] = {
1151 {
1152 .start = MSM8625_INT_ADSP_A9_A11,
1153 .end = MSM8625_INT_ADSP_A9_A11,
1154 .flags = IORESOURCE_IRQ,
1155 },
1156};
1157
1158struct platform_device msm8625_device_adsp = {
1159 .name = "msm_adsp",
1160 .id = -1,
1161 .num_resources = ARRAY_SIZE(msm8625_resources_adsp),
1162 .resource = msm8625_resources_adsp,
1163};
1164
Taniya Das43bcdd62011-12-02 17:33:27 +05301165static struct resource msm8625_dmov_resource[] = {
1166 {
1167 .start = MSM8625_INT_ADM_AARM,
1168 .flags = IORESOURCE_IRQ,
1169 },
1170 {
1171 .start = 0xA9700000,
1172 .end = 0xA9700000 + SZ_4K - 1,
1173 .flags = IORESOURCE_MEM,
1174 },
1175};
1176
1177struct platform_device msm8625_device_dmov = {
1178 .name = "msm_dmov",
1179 .id = -1,
1180 .resource = msm8625_dmov_resource,
1181 .num_resources = ARRAY_SIZE(msm8625_dmov_resource),
1182 .dev = {
1183 .platform_data = &msm_dmov_pdata,
1184 },
1185};
Taniya Das2e948192011-12-20 11:15:13 +05301186
Taniya Das9d187142011-12-02 15:53:25 +05301187static struct resource gsbi0_msm8625_qup_resources[] = {
1188 {
1189 .name = "qup_phys_addr",
1190 .start = MSM_GSBI0_QUP_PHYS,
1191 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
1192 .flags = IORESOURCE_MEM,
1193 },
1194 {
1195 .name = "gsbi_qup_i2c_addr",
1196 .start = MSM_GSBI0_PHYS,
1197 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
1198 .flags = IORESOURCE_MEM,
1199 },
1200 {
1201 .name = "qup_err_intr",
1202 .start = MSM8625_INT_PWB_I2C,
1203 .end = MSM8625_INT_PWB_I2C,
1204 .flags = IORESOURCE_IRQ,
1205 },
1206};
1207
1208/* Use GSBI0 QUP for /dev/i2c-0 */
Taniya Dase3027e22012-02-27 16:32:27 +05301209struct platform_device msm8625_gsbi0_qup_i2c_device = {
Taniya Das9d187142011-12-02 15:53:25 +05301210 .name = "qup_i2c",
1211 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
1212 .num_resources = ARRAY_SIZE(gsbi0_msm8625_qup_resources),
1213 .resource = gsbi0_msm8625_qup_resources,
1214};
1215
Trilok Soni633e59c2012-02-13 20:28:30 +05301216static struct resource gsbi1_msm8625_qup_i2c_resources[] = {
1217 {
1218 .name = "qup_phys_addr",
1219 .start = MSM_GSBI1_QUP_PHYS,
1220 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
1221 .flags = IORESOURCE_MEM,
1222 },
1223 {
1224 .name = "gsbi_qup_i2c_addr",
1225 .start = MSM_GSBI1_PHYS,
1226 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
1227 .flags = IORESOURCE_MEM,
1228 },
1229 {
1230 .name = "qup_err_intr",
1231 .start = MSM8625_INT_ARM11_DMA,
1232 .end = MSM8625_INT_ARM11_DMA,
1233 .flags = IORESOURCE_IRQ,
1234 },
1235};
1236
1237/* Use GSBI1 QUP for /dev/i2c-1 */
Taniya Dase3027e22012-02-27 16:32:27 +05301238struct platform_device msm8625_gsbi1_qup_i2c_device = {
Trilok Soni633e59c2012-02-13 20:28:30 +05301239 .name = "qup_i2c",
1240 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
1241 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
1242 .resource = gsbi1_msm8625_qup_i2c_resources,
1243};
1244
Taniya Das6684d622012-01-12 10:29:09 +05301245static struct resource msm8625_gpio_resources[] = {
1246 {
1247 .start = MSM8625_INT_GPIO_GROUP1,
1248 .flags = IORESOURCE_IRQ,
1249 },
1250 {
1251 .start = MSM8625_INT_GPIO_GROUP2,
1252 .flags = IORESOURCE_IRQ,
1253 },
1254};
1255
1256static struct platform_device msm8625_device_gpio = {
1257 .name = "msmgpio",
1258 .id = -1,
1259 .resource = msm8625_gpio_resources,
1260 .num_resources = ARRAY_SIZE(msm8625_gpio_resources),
1261};
1262
Trilok Soniee75f6c2012-02-13 20:45:07 +05301263static struct resource msm8625_resources_sdc1[] = {
1264 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301265 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301266 .start = MSM_SDC1_BASE,
1267 .end = MSM_SDC1_BASE + SZ_4K - 1,
1268 .flags = IORESOURCE_MEM,
1269 },
1270 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301271 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301272 .start = MSM8625_INT_SDC1_0,
1273 .end = MSM8625_INT_SDC1_1,
1274 .flags = IORESOURCE_IRQ,
1275 },
1276 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301277 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301278 .start = DMOV_SDC1_CHAN,
1279 .end = DMOV_SDC1_CHAN,
1280 .flags = IORESOURCE_DMA,
1281 },
1282 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301283 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301284 .start = DMOV_SDC1_CRCI,
1285 .end = DMOV_SDC1_CRCI,
1286 .flags = IORESOURCE_DMA,
1287 }
1288};
1289
1290static struct resource msm8625_resources_sdc2[] = {
1291 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301292 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301293 .start = MSM_SDC2_BASE,
1294 .end = MSM_SDC2_BASE + SZ_4K - 1,
1295 .flags = IORESOURCE_MEM,
1296 },
1297 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301298 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301299 .start = MSM8625_INT_SDC2_0,
1300 .end = MSM8625_INT_SDC2_1,
1301 .flags = IORESOURCE_IRQ,
1302 },
1303 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301304 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301305 .start = DMOV_SDC2_CHAN,
1306 .end = DMOV_SDC2_CHAN,
1307 .flags = IORESOURCE_DMA,
1308 },
1309 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301310 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301311 .start = DMOV_SDC2_CRCI,
1312 .end = DMOV_SDC2_CRCI,
1313 .flags = IORESOURCE_DMA,
1314 }
1315};
1316
1317static struct resource msm8625_resources_sdc3[] = {
1318 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301319 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301320 .start = MSM_SDC3_BASE,
1321 .end = MSM_SDC3_BASE + SZ_4K - 1,
1322 .flags = IORESOURCE_MEM,
1323 },
1324 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301325 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301326 .start = MSM8625_INT_SDC3_0,
1327 .end = MSM8625_INT_SDC3_1,
1328 .flags = IORESOURCE_IRQ,
1329 },
1330 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301331 .name = "dma_chnl",
Pratibhasagar Vc483d202012-08-21 14:37:17 +05301332 .start = DMOV_NAND_CHAN,
1333 .end = DMOV_NAND_CHAN,
Trilok Soniee75f6c2012-02-13 20:45:07 +05301334 .flags = IORESOURCE_DMA,
1335 },
1336 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301337 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301338 .start = DMOV_SDC3_CRCI,
1339 .end = DMOV_SDC3_CRCI,
1340 .flags = IORESOURCE_DMA,
1341 },
1342};
1343
1344static struct resource msm8625_resources_sdc4[] = {
1345 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301346 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301347 .start = MSM_SDC4_BASE,
1348 .end = MSM_SDC4_BASE + SZ_4K - 1,
1349 .flags = IORESOURCE_MEM,
1350 },
1351 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301352 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301353 .start = MSM8625_INT_SDC4_0,
1354 .end = MSM8625_INT_SDC4_1,
1355 .flags = IORESOURCE_IRQ,
1356 },
1357 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301358 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301359 .start = DMOV_SDC4_CHAN,
1360 .end = DMOV_SDC4_CHAN,
1361 .flags = IORESOURCE_DMA,
1362 },
1363 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301364 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301365 .start = DMOV_SDC4_CRCI,
1366 .end = DMOV_SDC4_CRCI,
1367 .flags = IORESOURCE_DMA,
1368 },
1369};
1370
1371struct platform_device msm8625_device_sdc1 = {
1372 .name = "msm_sdcc",
1373 .id = 1,
1374 .num_resources = ARRAY_SIZE(msm8625_resources_sdc1),
1375 .resource = msm8625_resources_sdc1,
1376 .dev = {
1377 .coherent_dma_mask = 0xffffffff,
1378 },
1379};
1380
1381struct platform_device msm8625_device_sdc2 = {
1382 .name = "msm_sdcc",
1383 .id = 2,
1384 .num_resources = ARRAY_SIZE(msm8625_resources_sdc2),
1385 .resource = msm8625_resources_sdc2,
1386 .dev = {
1387 .coherent_dma_mask = 0xffffffff,
1388 },
1389};
1390
1391struct platform_device msm8625_device_sdc3 = {
1392 .name = "msm_sdcc",
1393 .id = 3,
1394 .num_resources = ARRAY_SIZE(msm8625_resources_sdc3),
1395 .resource = msm8625_resources_sdc3,
1396 .dev = {
1397 .coherent_dma_mask = 0xffffffff,
1398 },
1399};
1400
1401struct platform_device msm8625_device_sdc4 = {
1402 .name = "msm_sdcc",
1403 .id = 4,
1404 .num_resources = ARRAY_SIZE(msm8625_resources_sdc4),
1405 .resource = msm8625_resources_sdc4,
1406 .dev = {
1407 .coherent_dma_mask = 0xffffffff,
1408 },
1409};
1410
1411static struct platform_device *msm8625_sdcc_devices[] __initdata = {
1412 &msm8625_device_sdc1,
1413 &msm8625_device_sdc2,
1414 &msm8625_device_sdc3,
1415 &msm8625_device_sdc4,
1416};
1417
1418int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
1419{
1420 struct platform_device *pdev;
1421
1422 if (controller < 1 || controller > 4)
1423 return -EINVAL;
1424
Utsab Bose4ed4ba12012-11-08 18:52:38 +05301425 if (cpu_is_msm8625() || cpu_is_msm8625q())
Trilok Soniee75f6c2012-02-13 20:45:07 +05301426 pdev = msm8625_sdcc_devices[controller-1];
1427 else
1428 pdev = msm_sdcc_devices[controller-1];
1429
1430 pdev->dev.platform_data = plat;
1431 return platform_device_register(pdev);
1432}
1433
Trilok Sonida63a8b2012-02-13 20:50:03 +05301434static struct resource msm8625_resources_hsusb_otg[] = {
1435 {
1436 .start = MSM_HSUSB_PHYS,
1437 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1438 .flags = IORESOURCE_MEM,
1439 },
1440 {
1441 .start = MSM8625_INT_USB_HS,
1442 .end = MSM8625_INT_USB_HS,
1443 .flags = IORESOURCE_IRQ,
1444 },
1445};
1446
1447struct platform_device msm8625_device_otg = {
1448 .name = "msm_otg",
1449 .id = -1,
1450 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_otg),
1451 .resource = msm8625_resources_hsusb_otg,
1452 .dev = {
1453 .dma_mask = &dma_mask,
1454 .coherent_dma_mask = 0xffffffffULL,
1455 },
1456};
1457
1458static struct resource msm8625_resources_gadget_peripheral[] = {
1459 {
1460 .start = MSM_HSUSB_PHYS,
1461 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1462 .flags = IORESOURCE_MEM,
1463 },
1464 {
1465 .start = MSM8625_INT_USB_HS,
1466 .end = MSM8625_INT_USB_HS,
1467 .flags = IORESOURCE_IRQ,
1468 },
1469};
1470
1471struct platform_device msm8625_device_gadget_peripheral = {
1472 .name = "msm_hsusb",
1473 .id = -1,
1474 .num_resources = ARRAY_SIZE(msm8625_resources_gadget_peripheral),
1475 .resource = msm8625_resources_gadget_peripheral,
1476 .dev = {
1477 .dma_mask = &dma_mask,
1478 .coherent_dma_mask = 0xffffffffULL,
1479 },
1480};
1481
1482static struct resource msm8625_resources_hsusb_host[] = {
1483 {
1484 .start = MSM_HSUSB_PHYS,
1485 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1486 .flags = IORESOURCE_MEM,
1487 },
1488 {
1489 .start = MSM8625_INT_USB_HS,
1490 .end = MSM8625_INT_USB_HS,
1491 .flags = IORESOURCE_IRQ,
1492 },
1493};
1494
1495struct platform_device msm8625_device_hsusb_host = {
1496 .name = "msm_hsusb_host",
1497 .id = 0,
1498 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_host),
1499 .resource = msm8625_resources_hsusb_host,
1500 .dev = {
1501 .dma_mask = &dma_mask,
1502 .coherent_dma_mask = 0xffffffffULL,
1503 },
1504};
1505
1506static struct platform_device *msm8625_host_devices[] = {
1507 &msm8625_device_hsusb_host,
1508};
1509
1510int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
1511{
1512 struct platform_device *pdev;
1513
Utsab Bose4ed4ba12012-11-08 18:52:38 +05301514 if (cpu_is_msm8625() || cpu_is_msm8625q())
Trilok Sonida63a8b2012-02-13 20:50:03 +05301515 pdev = msm8625_host_devices[host];
1516 else
1517 pdev = msm_host_devices[host];
1518 if (!pdev)
1519 return -ENODEV;
1520 pdev->dev.platform_data = plat;
1521 return platform_device_register(pdev);
1522}
1523
Trilok Soni88da2552012-02-13 21:01:24 +05301524#ifdef CONFIG_MSM_CAMERA_V4L2
1525static struct resource msm8625_csic0_resources[] = {
1526 {
1527 .name = "csic",
1528 .start = 0xA0F00000,
1529 .end = 0xA0F00000 + 0x00100000 - 1,
1530 .flags = IORESOURCE_MEM,
1531 },
1532 {
1533 .name = "csic",
1534 .start = MSM8625_INT_CSI_IRQ_0,
1535 .end = MSM8625_INT_CSI_IRQ_0,
1536 .flags = IORESOURCE_IRQ,
1537 },
1538};
1539
1540static struct resource msm8625_csic1_resources[] = {
1541 {
1542 .name = "csic",
1543 .start = 0xA1000000,
1544 .end = 0xA1000000 + 0x00100000 - 1,
1545 .flags = IORESOURCE_MEM,
1546 },
1547 {
1548 .name = "csic",
1549 .start = MSM8625_INT_CSI_IRQ_1,
1550 .end = MSM8625_INT_CSI_IRQ_1,
1551 .flags = IORESOURCE_IRQ,
1552 },
1553};
1554
1555struct platform_device msm8625_device_csic0 = {
1556 .name = "msm_csic",
1557 .id = 0,
1558 .resource = msm8625_csic0_resources,
1559 .num_resources = ARRAY_SIZE(msm8625_csic0_resources),
1560};
1561
1562struct platform_device msm8625_device_csic1 = {
1563 .name = "msm_csic",
1564 .id = 1,
1565 .resource = msm8625_csic1_resources,
1566 .num_resources = ARRAY_SIZE(msm8625_csic1_resources),
1567};
1568#endif
1569
Trilok Soniae4633d2012-02-13 21:08:32 +05301570static struct resource msm8625_mipi_dsi_resources[] = {
1571 {
1572 .name = "mipi_dsi",
1573 .start = MIPI_DSI_HW_BASE,
1574 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
1575 .flags = IORESOURCE_MEM,
1576 },
1577 {
1578 .start = MSM8625_INT_DSI_IRQ,
1579 .end = MSM8625_INT_DSI_IRQ,
1580 .flags = IORESOURCE_IRQ,
1581 },
1582};
1583
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301584static struct platform_device msm8625_mipi_dsi_device = {
Trilok Soniae4633d2012-02-13 21:08:32 +05301585 .name = "mipi_dsi",
1586 .id = 1,
1587 .num_resources = ARRAY_SIZE(msm8625_mipi_dsi_resources),
1588 .resource = msm8625_mipi_dsi_resources,
1589};
1590
1591static struct resource msm8625_mdp_resources[] = {
1592 {
1593 .name = "mdp",
1594 .start = MDP_BASE,
1595 .end = MDP_BASE + 0x000F1008 - 1,
1596 .flags = IORESOURCE_MEM,
1597 },
1598 {
1599 .start = MSM8625_INT_MDP,
1600 .end = MSM8625_INT_MDP,
1601 .flags = IORESOURCE_IRQ,
1602 },
1603};
1604
1605static struct platform_device msm8625_mdp_device = {
1606 .name = "mdp",
1607 .id = 0,
1608 .num_resources = ARRAY_SIZE(msm8625_mdp_resources),
1609 .resource = msm8625_mdp_resources,
1610};
1611
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301612struct platform_device mipi_dsi_device;
1613
Trilok Soniae4633d2012-02-13 21:08:32 +05301614void __init msm_fb_register_device(char *name, void *data)
1615{
1616 if (!strncmp(name, "mdp", 3)) {
Utsab Bose4ed4ba12012-11-08 18:52:38 +05301617 if (cpu_is_msm8625() || cpu_is_msm8625q())
Trilok Soniae4633d2012-02-13 21:08:32 +05301618 msm_register_device(&msm8625_mdp_device, data);
1619 else
1620 msm_register_device(&msm_mdp_device, data);
1621 } else if (!strncmp(name, "mipi_dsi", 8)) {
Utsab Bose4ed4ba12012-11-08 18:52:38 +05301622 if (cpu_is_msm8625() || cpu_is_msm8625q()) {
Trilok Soniae4633d2012-02-13 21:08:32 +05301623 msm_register_device(&msm8625_mipi_dsi_device, data);
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301624 mipi_dsi_device = msm8625_mipi_dsi_device;
1625 } else {
Trilok Soniae4633d2012-02-13 21:08:32 +05301626 msm_register_device(&msm_mipi_dsi_device, data);
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301627 mipi_dsi_device = msm_mipi_dsi_device;
1628 }
Trilok Soniae4633d2012-02-13 21:08:32 +05301629 } else if (!strncmp(name, "lcdc", 4)) {
1630 msm_register_device(&msm_lcdc_device, data);
1631 } else {
1632 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
1633 }
1634}
1635
Trilok Soni664b95d2012-02-13 21:13:15 +05301636static struct resource msm8625_kgsl_3d0_resources[] = {
1637 {
1638 .name = KGSL_3D0_REG_MEMORY,
1639 .start = 0xA0000000,
1640 .end = 0xA001ffff,
1641 .flags = IORESOURCE_MEM,
1642 },
1643 {
1644 .name = KGSL_3D0_IRQ,
1645 .start = MSM8625_INT_GRAPHICS,
1646 .end = MSM8625_INT_GRAPHICS,
1647 .flags = IORESOURCE_IRQ,
1648 },
1649};
1650
1651struct platform_device msm8625_kgsl_3d0 = {
1652 .name = "kgsl-3d0",
1653 .id = 0,
1654 .num_resources = ARRAY_SIZE(msm8625_kgsl_3d0_resources),
1655 .resource = msm8625_kgsl_3d0_resources,
1656 .dev = {
1657 .platform_data = &kgsl_3d0_pdata,
1658 },
1659};
1660
Taniya Das364426e2012-09-28 17:09:51 +05301661static struct resource pl310_resources[] = {
1662 {
1663 .start = 0xC0400000,
1664 .end = 0xC0400000 + SZ_4K - 1,
1665 .flags = IORESOURCE_MEM,
1666 },
1667 {
1668 .name = "l2_irq",
Ashwin Chaugule3deb6b82012-12-21 13:09:48 -05001669 .start = MSM8625_INT_SC_SICL2PERFMONIRPTREQ,
Taniya Das364426e2012-09-28 17:09:51 +05301670 .flags = IORESOURCE_IRQ,
1671 },
1672};
1673
1674static struct platform_device pl310_erp_device = {
1675 .name = "pl310_erp",
1676 .id = -1,
1677 .resource = pl310_resources,
1678 .num_resources = ARRAY_SIZE(pl310_resources),
1679};
1680
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301681enum {
1682 MSM8625,
1683 MSM8625A,
1684 MSM8625AB,
1685};
1686
1687static int __init msm8625_cpu_id(void)
1688{
1689 int raw_id, cpu;
1690
1691 raw_id = socinfo_get_raw_id();
1692 switch (raw_id) {
1693 /* Part number for 1GHz part */
1694 case 0x770:
1695 case 0x771:
1696 case 0x77C:
1697 case 0x780:
Kaushal Kumarc84b9c22012-10-12 12:47:55 +05301698 case 0x785: /* Edge-only MSM8125-0 */
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301699 case 0x8D0:
1700 cpu = MSM8625;
1701 break;
1702 /* Part number for 1.2GHz part */
1703 case 0x773:
1704 case 0x774:
1705 case 0x781:
1706 case 0x8D1:
1707 cpu = MSM8625A;
1708 break;
1709 case 0x775:
1710 case 0x776:
Kaushal Kumar5b700f32012-09-05 16:50:19 +05301711 case 0x779:
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301712 case 0x77D:
1713 case 0x782:
1714 case 0x8D2:
1715 cpu = MSM8625AB;
1716 break;
1717 default:
1718 pr_err("Invalid Raw ID\n");
1719 return -ENODEV;
1720 }
1721 return cpu;
1722}
1723
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301724static struct resource cpr_resources[] = {
1725 {
1726 .start = MSM8625_INT_CPR_IRQ0,
1727 .flags = IORESOURCE_IRQ,
1728 },
1729 {
1730 .start = MSM8625_CPR_PHYS,
1731 .end = MSM8625_CPR_PHYS + SZ_4K - 1,
1732 .flags = IORESOURCE_MEM,
1733 },
1734};
1735
1736/**
1737 * These are various Vdd levels supported by PMIC
1738 */
1739static uint32_t msm_c2_pmic_mv[] __initdata = {
Trilok Soni9573ce32012-09-02 03:50:18 +05301740 1350000, 1337500, 1325000, 1312500, 1300000,
1741 1287500, 1275000, 1262500, 1250000, 1237500,
1742 1225000, 1212500, 1200000, 1187500, 1175000,
1743 1162500, 1150000, 1137500, 1125000, 1112500,
1744 1100000, 1087500, 1075000, 1062500, 0,
1745 0, 0, 0, 0, 0,
1746 0, 1050000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301747};
1748
1749/**
1750 * This data will be based on CPR mode of operation
1751 */
1752static struct msm_cpr_mode msm_cpr_mode_data[] = {
1753 [NORMAL_MODE] = {
1754 .ring_osc_data = {
1755 {0, },
1756 {0, },
1757 {0, },
1758 {0, },
1759 {0, },
1760 {0, },
1761 {0, },
1762 {0, },
1763 },
1764 .ring_osc = 0,
1765 .step_quot = ~0,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301766 .tgt_volt_offset = 0,
Trilok Sonidb64ae92012-09-02 02:09:04 +05301767 .nom_Vmax = 1350000,
1768 .nom_Vmin = 1250000,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301769 .calibrated_uV = 1100000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301770 },
1771 [TURBO_MODE] = {
1772 .ring_osc_data = {
1773 {0, },
1774 {0, },
1775 {0, },
1776 {0, },
1777 {0, },
1778 {0, },
1779 {0, },
1780 {0, },
1781 },
1782 .ring_osc = 0,
1783 .step_quot = ~0,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301784 .tgt_volt_offset = 0,
Trilok Sonidb64ae92012-09-02 02:09:04 +05301785 .turbo_Vmax = 1350000,
Kaushal Kumar1f549fc2012-10-04 11:45:32 +05301786 .turbo_Vmin = 1150000,
Trilok Sonidb64ae92012-09-02 02:09:04 +05301787 .nom_Vmax = 1350000,
Kaushal Kumar1f549fc2012-10-04 11:45:32 +05301788 .nom_Vmin = 1150000,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301789 .calibrated_uV = 1300000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301790 },
1791};
1792
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301793static uint32_t
1794msm_cpr_get_quot(uint32_t max_quot, uint32_t max_freq, uint32_t new_freq)
1795{
1796 uint32_t quot;
1797
1798 /* This formula is as per chip characterization data */
Kaushal Kumarddd521c2012-09-18 19:50:53 +05301799 quot = max_quot - (((max_freq - new_freq) * 7) / 10);
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301800
1801 return quot;
1802}
1803
1804static void msm_cpr_clk_enable(void)
1805{
1806 uint32_t reg_val;
1807
1808 /* Select TCXO (19.2MHz) as clock source */
1809 reg_val = readl_relaxed(A11S_TEST_BUS_SEL_ADDR);
1810 reg_val |= RBCPR_CLK_MUX_SEL;
1811 writel_relaxed(reg_val, A11S_TEST_BUS_SEL_ADDR);
1812
1813 /* Get CPR out of reset */
1814 writel_relaxed(0x1, RBCPR_SW_RESET_N);
1815}
1816
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301817static struct msm_cpr_config msm_cpr_pdata = {
1818 .ref_clk_khz = 19200,
Kaushal Kumar3e60a102012-10-15 16:54:16 +05301819 .delay_us = 25000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301820 .irq_line = 0,
1821 .cpr_mode_data = msm_cpr_mode_data,
1822 .tgt_count_div_N = 1,
1823 .floor = 0,
1824 .ceiling = 40,
1825 .sw_vlevel = 20,
1826 .up_threshold = 1,
Kaushal Kumar3e60a102012-10-15 16:54:16 +05301827 .dn_threshold = 3,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301828 .up_margin = 0,
1829 .dn_margin = 0,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301830 .max_nom_freq = 700800,
1831 .max_freq = 1401600,
1832 .max_quot = 0,
Kaushal Kumarecfc9182012-10-25 16:17:51 +05301833 .disable_cpr = false,
Tirupathi Reddy7c5d7b12012-11-06 13:29:36 +05301834 .step_size = 12500,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301835 .get_quot = msm_cpr_get_quot,
1836 .clk_enable = msm_cpr_clk_enable,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301837};
1838
1839static struct platform_device msm8625_device_cpr = {
1840 .name = "msm-cpr",
1841 .id = -1,
1842 .num_resources = ARRAY_SIZE(cpr_resources),
1843 .resource = cpr_resources,
1844 .dev = {
1845 .platform_data = &msm_cpr_pdata,
1846 },
1847};
1848
1849static struct platform_device msm8625_vp_device = {
1850 .name = "vp-regulator",
1851 .id = -1,
1852};
1853
1854static void __init msm_cpr_init(void)
1855{
1856 struct cpr_info_type *cpr_info = NULL;
1857 uint8_t ring_osc = 0;
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301858
1859 cpr_info = kzalloc(sizeof(struct cpr_info_type), GFP_KERNEL);
1860 if (!cpr_info) {
1861 pr_err("%s: Out of memory %d\n", __func__, -ENOMEM);
1862 return;
1863 }
1864
1865 msm_smem_get_cpr_info(cpr_info);
Kaushal Kumarecfc9182012-10-25 16:17:51 +05301866 msm_cpr_pdata.disable_cpr = cpr_info->disable_cpr;
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301867
1868 /**
1869 * Set the ring_osc based on efuse BIT(0)
1870 * CPR_fuse[0] = 0 selects 2nd RO (010)
1871 * CPR_fuse[0] = 1 select 3rd RO (011)
1872 */
1873 if (cpr_info->ring_osc == 0x0)
1874 ring_osc = 0x2;
1875 else if (cpr_info->ring_osc == 0x1)
1876 ring_osc = 0x3;
1877
1878 msm_cpr_mode_data[TURBO_MODE].ring_osc = ring_osc;
1879 msm_cpr_mode_data[NORMAL_MODE].ring_osc = ring_osc;
1880
1881 /* GCNT = 1000 nsec/52nsec (@TCX0=19.2Mhz) = 19.2 */
1882 msm_cpr_mode_data[TURBO_MODE].ring_osc_data[ring_osc].gcnt = 19;
1883 msm_cpr_mode_data[NORMAL_MODE].ring_osc_data[ring_osc].gcnt = 19;
1884
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301885 /**
1886 * The scaling factor and offset are as per chip characterization data
1887 * This formula is used since available fuse bits in the chip are not
1888 * enough to represent the value of maximum quot
1889 */
Trilok Soni7f311172012-09-02 15:15:33 +05301890 msm_cpr_pdata.max_quot = cpr_info->turbo_quot * 10 + 600;
Kaushal Kumarbcb46d92012-10-04 11:31:14 +05301891 /**
1892 * Fused Quot value for 1.2GHz on a 1.2GHz part is lower than
1893 * the quot value calculated using the scaling factor formula for
1894 * 1.2GHz when running on a 1.4GHz part. So, prop up the Quot for
1895 * a 1.2GHz part by a chip characterization recommended value.
1896 * Ditto for a 1.0GHz part.
1897 */
1898 if (msm8625_cpu_id() == MSM8625A) {
Kaushal Kumar3a9f6c82012-10-19 15:30:28 +05301899 msm_cpr_pdata.max_quot += 30;
Kaushal Kumarbcb46d92012-10-04 11:31:14 +05301900 if (msm_cpr_pdata.max_quot > 1400)
1901 msm_cpr_pdata.max_quot = 1400;
1902 } else if (msm8625_cpu_id() == MSM8625) {
Kaushal Kumar3a9f6c82012-10-19 15:30:28 +05301903 msm_cpr_pdata.max_quot += 50;
Kaushal Kumarbcb46d92012-10-04 11:31:14 +05301904 if (msm_cpr_pdata.max_quot > 1350)
1905 msm_cpr_pdata.max_quot = 1350;
1906 }
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301907
1908 /**
1909 * Bits 4:0 of pvs_fuse provide mapping to the safe boot up voltage.
1910 * Boot up mode is by default Turbo.
1911 */
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301912 msm_cpr_mode_data[TURBO_MODE].calibrated_uV =
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301913 msm_c2_pmic_mv[cpr_info->pvs_fuse & 0x1F];
1914
Kaushal Kumar1f549fc2012-10-04 11:45:32 +05301915 if ((cpr_info->floor_fuse & 0x3) == 0x0) {
1916 msm_cpr_mode_data[TURBO_MODE].nom_Vmin = 1000000;
1917 msm_cpr_mode_data[TURBO_MODE].turbo_Vmin = 1100000;
1918 } else if ((cpr_info->floor_fuse & 0x3) == 0x1) {
1919 msm_cpr_mode_data[TURBO_MODE].nom_Vmin = 1050000;
1920 msm_cpr_mode_data[TURBO_MODE].turbo_Vmin = 1100000;
1921 } else if ((cpr_info->floor_fuse & 0x3) == 0x2) {
1922 msm_cpr_mode_data[TURBO_MODE].nom_Vmin = 1100000;
1923 msm_cpr_mode_data[TURBO_MODE].turbo_Vmin = 1100000;
1924 }
1925
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301926 pr_debug("%s: cpr: ring_osc: 0x%x\n", __func__,
1927 msm_cpr_mode_data[TURBO_MODE].ring_osc);
1928 pr_debug("%s: cpr: turbo_quot: 0x%x\n", __func__, cpr_info->turbo_quot);
1929 pr_debug("%s: cpr: pvs_fuse: 0x%x\n", __func__, cpr_info->pvs_fuse);
Kaushal Kumar1f549fc2012-10-04 11:45:32 +05301930 pr_debug("%s: cpr: floor_fuse: 0x%x\n", __func__, cpr_info->floor_fuse);
1931 pr_debug("%s: cpr: nom_Vmin: %d, turbo_Vmin: %d\n", __func__,
1932 msm_cpr_mode_data[TURBO_MODE].nom_Vmin,
1933 msm_cpr_mode_data[TURBO_MODE].turbo_Vmin);
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301934 kfree(cpr_info);
1935
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301936 if (msm8625_cpu_id() == MSM8625A)
1937 msm_cpr_pdata.max_freq = 1209600;
1938 else if (msm8625_cpu_id() == MSM8625)
1939 msm_cpr_pdata.max_freq = 1008000;
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301940
Tirupathi Reddy23cb2df2012-11-06 14:57:38 +05301941 if (machine_is_qrd_skud_prime() || cpu_is_msm8625q())
1942 msm_cpr_pdata.step_size = 6250;
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301943 platform_device_register(&msm8625_vp_device);
1944 platform_device_register(&msm8625_device_cpr);
1945}
1946
Taniya Das7c9f0512011-12-02 14:26:46 +05301947static struct clk_lookup msm_clock_8625_dummy[] = {
1948 CLK_DUMMY("core_clk", adm_clk.c, "msm_dmov", 0),
1949 CLK_DUMMY("adsp_clk", adsp_clk.c, NULL, 0),
1950 CLK_DUMMY("ahb_m_clk", ahb_m_clk.c, NULL, 0),
1951 CLK_DUMMY("ahb_s_clk", ahb_s_clk.c, NULL, 0),
1952 CLK_DUMMY("cam_m_clk", cam_m_clk.c, NULL, 0),
1953 CLK_DUMMY("csi_clk", csi1_clk.c, NULL, 0),
1954 CLK_DUMMY("csi_pclk", csi1_p_clk.c, NULL, 0),
1955 CLK_DUMMY("csi_vfe_clk", csi1_vfe_clk.c, NULL, 0),
1956 CLK_DUMMY("dsi_byte_clk", dsi_byte_clk.c, NULL, 0),
1957 CLK_DUMMY("dsi_clk", dsi_clk.c, NULL, 0),
1958 CLK_DUMMY("dsi_esc_clk", dsi_esc_clk.c, NULL, 0),
1959 CLK_DUMMY("dsi_pixel_clk", dsi_pixel_clk.c, NULL, 0),
1960 CLK_DUMMY("dsi_ref_clk", dsi_ref_clk.c, NULL, 0),
1961 CLK_DUMMY("ebi1_clk", ebi1_clk.c, NULL, 0),
1962 CLK_DUMMY("ebi2_clk", ebi2_clk.c, NULL, 0),
1963 CLK_DUMMY("ecodec_clk", ecodec_clk.c, NULL, 0),
1964 CLK_DUMMY("gp_clk", gp_clk.c, NULL, 0),
1965 CLK_DUMMY("core_clk", gsbi1_qup_clk.c, "qup_i2c.0", 0),
1966 CLK_DUMMY("core_clk", gsbi2_qup_clk.c, "qup_i2c.1", 0),
1967 CLK_DUMMY("iface_clk", gsbi1_qup_p_clk.c, "qup_i2c.0", 0),
1968 CLK_DUMMY("iface_clk", gsbi2_qup_p_clk.c, "qup_i2c.1", 0),
1969 CLK_DUMMY("icodec_rx_clk", icodec_rx_clk.c, NULL, 0),
1970 CLK_DUMMY("icodec_tx_clk", icodec_tx_clk.c, NULL, 0),
1971 CLK_DUMMY("mem_clk", imem_clk.c, NULL, 0),
1972 CLK_DUMMY("mddi_clk", pmdh_clk.c, NULL, 0),
1973 CLK_DUMMY("mdp_clk", mdp_clk.c, NULL, 0),
1974 CLK_DUMMY("mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk.c, NULL, 0),
1975 CLK_DUMMY("mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk.c, NULL, 0),
1976 CLK_DUMMY("mdp_vsync_clk", mdp_vsync_clk.c, NULL, 0),
1977 CLK_DUMMY("mdp_dsi_pclk", mdp_dsi_p_clk.c, NULL, 0),
1978 CLK_DUMMY("pbus_clk", pbus_clk.c, NULL, 0),
1979 CLK_DUMMY("pcm_clk", pcm_clk.c, NULL, 0),
1980 CLK_DUMMY("sdac_clk", sdac_clk.c, NULL, 0),
1981 CLK_DUMMY("core_clk", sdc1_clk.c, "msm_sdcc.1", 0),
1982 CLK_DUMMY("iface_clk", sdc1_p_clk.c, "msm_sdcc.1", 0),
1983 CLK_DUMMY("core_clk", sdc2_clk.c, "msm_sdcc.2", 0),
1984 CLK_DUMMY("iface_clk", sdc2_p_clk.c, "msm_sdcc.2", 0),
1985 CLK_DUMMY("core_clk", sdc3_clk.c, "msm_sdcc.3", 0),
1986 CLK_DUMMY("iface_clk", sdc3_p_clk.c, "msm_sdcc.3", 0),
1987 CLK_DUMMY("core_clk", sdc4_clk.c, "msm_sdcc.4", 0),
1988 CLK_DUMMY("iface_clk", sdc4_p_clk.c, "msm_sdcc.4", 0),
1989 CLK_DUMMY("ref_clk", tsif_ref_clk.c, "msm_tsif.0", 0),
1990 CLK_DUMMY("iface_clk", tsif_p_clk.c, "msm_tsif.0", 0),
1991 CLK_DUMMY("core_clk", uart1_clk.c, "msm_serial.0", 0),
1992 CLK_DUMMY("core_clk", uart2_clk.c, "msm_serial.1", 0),
1993 CLK_DUMMY("core_clk", uart1dm_clk.c, "msm_serial_hs.0", 0),
1994 CLK_DUMMY("core_clk", uart2dm_clk.c, "msm_serial_hsl.0", 0),
1995 CLK_DUMMY("usb_hs_core_clk", usb_hs_core_clk.c, NULL, 0),
1996 CLK_DUMMY("usb_hs2_clk", usb_hs2_clk.c, NULL, 0),
1997 CLK_DUMMY("usb_hs_clk", usb_hs_clk.c, NULL, 0),
1998 CLK_DUMMY("usb_hs_pclk", usb_hs_p_clk.c, NULL, 0),
1999 CLK_DUMMY("usb_phy_clk", usb_phy_clk.c, NULL, 0),
2000 CLK_DUMMY("vdc_clk", vdc_clk.c, NULL, 0),
2001 CLK_DUMMY("ebi1_acpu_clk", ebi_acpu_clk.c, NULL, 0),
2002 CLK_DUMMY("ebi1_lcdc_clk", ebi_lcdc_clk.c, NULL, 0),
2003 CLK_DUMMY("ebi1_mddi_clk", ebi_mddi_clk.c, NULL, 0),
2004 CLK_DUMMY("ebi1_usb_clk", ebi_usb_clk.c, NULL, 0),
2005 CLK_DUMMY("ebi1_vfe_clk", ebi_vfe_clk.c, NULL, 0),
2006 CLK_DUMMY("mem_clk", ebi_adm_clk.c, "msm_dmov", 0),
2007};
2008
2009struct clock_init_data msm8625_dummy_clock_init_data __initdata = {
2010 .table = msm_clock_8625_dummy,
2011 .size = ARRAY_SIZE(msm_clock_8625_dummy),
2012};
Pankaj Kumar50c705c2012-01-10 12:02:07 +05302013
Taniya Das6e0ff0d2012-10-12 11:38:32 +05302014
2015static int __init msm_gpio_config_gps(void)
2016{
2017 unsigned int gps_gpio = 7;
2018 int ret = 0;
2019
2020 if (!machine_is_msm8625_evb())
2021 return ret;
2022
2023 ret = gpio_tlmm_config(GPIO_CFG(gps_gpio, 0, GPIO_CFG_OUTPUT,
2024 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
2025 if (ret < 0) {
2026 pr_err("gpio tlmm failed for gpio-%d\n", gps_gpio);
2027 return ret;
2028 }
2029
2030 ret = gpio_request(gps_gpio, "gnss-gpio");
2031 if (ret < 0) {
2032 pr_err("failed to request gpio-%d\n", gps_gpio);
2033 return ret;
2034 }
2035
2036 ret = gpio_direction_input(gps_gpio);
2037 if (ret < 0) {
2038 pr_err("failed to change direction for gpio-%d\n", gps_gpio);
2039 return ret;
2040 }
2041
2042 ret = gpio_export(gps_gpio, true);
2043 if (ret < 0)
2044 pr_err("failed to export gpio for user\n");
2045
2046 return ret;
2047}
2048
Utsab Bose2e7a90a2012-12-10 20:22:27 +05302049static int __init msm_acpuclock_init(bool flag)
Trilok Soni31f00272012-11-08 14:36:51 +05302050{
2051 struct cpr_info_type *acpu_info = NULL;
2052 acpu_info = kzalloc(sizeof(struct cpr_info_type), GFP_KERNEL);
2053 if (!acpu_info) {
2054 pr_err("%s: Out of memory %d\n", __func__, -ENOMEM);
2055 return -ENOMEM;
2056 }
2057 msm_smem_get_cpr_info(acpu_info);
2058 msm8625q_acpuclk_pdata.pvs_voltage_uv =
2059 msm_c2_pmic_mv[acpu_info->pvs_fuse & 0x1F];
2060 kfree(acpu_info);
Utsab Bose2e7a90a2012-12-10 20:22:27 +05302061 msm8625q_acpuclk_pdata.flag = flag;
Trilok Soni31f00272012-11-08 14:36:51 +05302062 return 0;
2063}
2064
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002065int __init msm7x2x_misc_init(void)
2066{
Taniya Das7c9f0512011-12-02 14:26:46 +05302067 if (machine_is_msm8625_rumi3()) {
2068 msm_clock_init(&msm8625_dummy_clock_init_data);
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05302069 msm_cpr_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05302070 return 0;
Taniya Das7c9f0512011-12-02 14:26:46 +05302071 }
Taniya Das43bcdd62011-12-02 17:33:27 +05302072
Stephen Boydbb600ae2011-08-02 20:11:40 -07002073 msm_clock_init(&msm7x27a_clock_init_data);
Pankaj Kumarfee56a82012-04-17 14:26:49 +05302074 if (cpu_is_msm7x27aa() || cpu_is_msm7x25ab())
Matt Wagantallbf430eb2012-03-22 11:45:49 -07002075 platform_device_register(&msm7x27aa_device_acpuclk);
Utsab Bose4051d252012-11-30 13:32:50 +05302076 else if (cpu_is_msm8625q()) {
Utsab Bose2e7a90a2012-12-10 20:22:27 +05302077 msm_acpuclock_init(1);
2078 platform_device_register(&msm8625q_device_acpuclk);
Utsab Bose4051d252012-11-30 13:32:50 +05302079 } else if (cpu_is_msm8625()) {
2080 if (machine_is_qrd_skud_prime()) {
Utsab Bose2e7a90a2012-12-10 20:22:27 +05302081 msm_acpuclock_init(0);
Trilok Soni31f00272012-11-08 14:36:51 +05302082 platform_device_register(&msm8625q_device_acpuclk);
2083 } else if (msm8625_cpu_id() == MSM8625)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07002084 platform_device_register(&msm7x27aa_device_acpuclk);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05302085 else if (msm8625_cpu_id() == MSM8625A)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07002086 platform_device_register(&msm8625_device_acpuclk);
Kaushal Kumar86473f02012-06-28 19:35:58 +05302087 else if (msm8625_cpu_id() == MSM8625AB)
2088 platform_device_register(&msm8625ab_device_acpuclk);
Matt Wagantallbf430eb2012-03-22 11:45:49 -07002089 } else {
2090 platform_device_register(&msm7x27a_device_acpuclk);
2091 }
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05302092
Utsab Bose4ed4ba12012-11-08 18:52:38 +05302093 if (cpu_is_msm8625() || (cpu_is_msm8625q() &&
2094 SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2))
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05302095 msm_cpr_init();
2096
Utsab Bose4ed4ba12012-11-08 18:52:38 +05302097 if (!cpu_is_msm8625() && !cpu_is_msm8625q())
Ashwin Chaugule3deb6b82012-12-21 13:09:48 -05002098 pl310_resources[1].start = SC_SICL2PERFMONIRPTREQ;
Taniya Das364426e2012-09-28 17:09:51 +05302099
2100 platform_device_register(&pl310_erp_device);
2101
Taniya Das6e0ff0d2012-10-12 11:38:32 +05302102 if (msm_gpio_config_gps() < 0)
2103 pr_err("Error for gpio config for GPS gpio\n");
2104
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002105 return 0;
2106}
2107
2108#ifdef CONFIG_CACHE_L2X0
2109static int __init msm7x27x_cache_init(void)
2110{
2111 int aux_ctrl = 0;
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05302112 int pctrl = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002113
2114 /* Way Size 010(0x2) 32KB */
2115 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
2116 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
2117 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
2118
Utsab Bose4ed4ba12012-11-08 18:52:38 +05302119 if (cpu_is_msm8625() || cpu_is_msm8625q()) {
Taniya Das379b5682011-12-02 14:53:46 +05302120 /* Way Size 011(0x3) 64KB */
2121 aux_ctrl |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
2122 (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | \
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05302123 (0X1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) | \
2124 (0x1 << L2X0_AUX_CTRL_L2_FORCE_NWA_SHIFT);
2125
2126 /* Write Prefetch Control settings */
2127 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
2128 pctrl |= (0x3 << L2X0_PREFETCH_CTRL_OFFSET_SHIFT) | \
2129 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_INC_SHIFT) | \
2130 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_SHIFT);
2131 writel_relaxed(pctrl , MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
Taniya Das379b5682011-12-02 14:53:46 +05302132 }
2133
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002134 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
Utsab Bose4ed4ba12012-11-08 18:52:38 +05302135 if (cpu_is_msm8625() || cpu_is_msm8625q()) {
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05302136 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
2137 pr_info("Prfetch Ctrl: 0x%08x\n", pctrl);
2138 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002139
2140 return 0;
2141}
2142#else
pankaj kumar80d7cb62011-08-23 13:37:55 +05302143static int __init msm7x27x_cache_init(void){ return 0; }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002144#endif
2145
2146void __init msm_common_io_init(void)
2147{
2148 msm_map_common_io();
Abhimanyu Kapur91a0a502013-01-11 19:24:59 -08002149 if (socinfo_init() < 0)
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -08002150 pr_err("socinfo_init() failed!\n");
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002151 msm7x27x_cache_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05302152}
2153
2154void __init msm8625_init_irq(void)
2155{
Trilok Soni1a9fdee2012-05-28 19:54:11 +05302156 msm_gic_irq_extn_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05302157 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
2158 (void *)MSM_QGIC_CPU_BASE);
Taniya Das43bcdd62011-12-02 17:33:27 +05302159}
2160
2161void __init msm8625_map_io(void)
2162{
2163 msm_map_msm8625_io();
2164
Abhimanyu Kapur91a0a502013-01-11 19:24:59 -08002165 if (socinfo_init() < 0)
Abhimanyu Kapur440cdde2012-12-04 00:05:40 -08002166 pr_err("socinfo_init() failed!\n");
Taniya Das379b5682011-12-02 14:53:46 +05302167 msm7x27x_cache_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002168}
2169
Taniya Das43bcdd62011-12-02 17:33:27 +05302170static int msm7627a_init_gpio(void)
2171{
Utsab Bose4ed4ba12012-11-08 18:52:38 +05302172 if (cpu_is_msm8625() || cpu_is_msm8625q())
Taniya Das6684d622012-01-12 10:29:09 +05302173 platform_device_register(&msm8625_device_gpio);
2174 else
2175 platform_device_register(&msm_device_gpio);
Taniya Das43bcdd62011-12-02 17:33:27 +05302176 return 0;
2177}
2178postcore_initcall(msm7627a_init_gpio);
Taniya Das9d0c3c52012-05-04 14:40:55 +05302179
2180static int msm7627a_panic_handler(struct notifier_block *this,
2181 unsigned long event, void *ptr)
2182{
Ranjhith Kalisamyb5fabb42012-10-30 18:43:20 +05302183 msm_clk_dump_debug_info();
Taniya Das9d0c3c52012-05-04 14:40:55 +05302184 flush_cache_all();
2185 outer_flush_all();
2186 return NOTIFY_DONE;
2187}
2188
2189static struct notifier_block panic_handler = {
2190 .notifier_call = msm7627a_panic_handler,
Aparna Mallavarapua9990472012-09-26 12:25:24 +05302191 .priority = INT_MAX,
Taniya Das9d0c3c52012-05-04 14:40:55 +05302192};
2193
2194static int __init panic_register(void)
2195{
2196 atomic_notifier_chain_register(&panic_notifier_list,
2197 &panic_handler);
2198 return 0;
2199}
2200module_init(panic_register);