blob: 5296048bc479e09c53cd0c55ef3d08af16cc0162 [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"
Murali Nalajala41786ab2012-03-06 10:47:32 +053039#include "spm.h"
Taniya Dasfcb35002012-03-09 15:28:12 +053040#include "mpm-8625.h"
Murali Nalajala2a0bbda2012-03-28 12:12:54 +053041#include "irq.h"
42#include "pm.h"
Kaushal Kumarc0e5d672012-07-31 16:07:49 +053043#include "msm_cpr.h"
44#include "msm_smem_iface.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070045
46/* Address of GSBI blocks */
47#define MSM_GSBI0_PHYS 0xA1200000
48#define MSM_GSBI1_PHYS 0xA1300000
49
50/* GSBI QUPe devices */
51#define MSM_GSBI0_QUP_PHYS (MSM_GSBI0_PHYS + 0x80000)
52#define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000)
53
Kaushal Kumarc0e5d672012-07-31 16:07:49 +053054#define A11S_TEST_BUS_SEL_ADDR (MSM_CSR_BASE + 0x518)
55#define RBCPR_CLK_MUX_SEL (1 << 13)
56
57/* Reset Address of RBCPR (Active Low)*/
58#define RBCPR_SW_RESET_N (MSM_CSR_BASE + 0x64)
59
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070060static struct resource gsbi0_qup_i2c_resources[] = {
61 {
62 .name = "qup_phys_addr",
63 .start = MSM_GSBI0_QUP_PHYS,
64 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
65 .flags = IORESOURCE_MEM,
66 },
67 {
68 .name = "gsbi_qup_i2c_addr",
69 .start = MSM_GSBI0_PHYS,
70 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
71 .flags = IORESOURCE_MEM,
72 },
73 {
74 .name = "qup_err_intr",
75 .start = INT_PWB_I2C,
76 .end = INT_PWB_I2C,
77 .flags = IORESOURCE_IRQ,
78 },
79};
80
81/* Use GSBI0 QUP for /dev/i2c-0 */
82struct platform_device msm_gsbi0_qup_i2c_device = {
83 .name = "qup_i2c",
84 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
85 .num_resources = ARRAY_SIZE(gsbi0_qup_i2c_resources),
86 .resource = gsbi0_qup_i2c_resources,
87};
88
89static struct resource gsbi1_qup_i2c_resources[] = {
90 {
91 .name = "qup_phys_addr",
92 .start = MSM_GSBI1_QUP_PHYS,
93 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
94 .flags = IORESOURCE_MEM,
95 },
96 {
97 .name = "gsbi_qup_i2c_addr",
98 .start = MSM_GSBI1_PHYS,
99 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
100 .flags = IORESOURCE_MEM,
101 },
102 {
103 .name = "qup_err_intr",
104 .start = INT_ARM11_DMA,
105 .end = INT_ARM11_DMA,
106 .flags = IORESOURCE_IRQ,
107 },
108};
109
110/* Use GSBI1 QUP for /dev/i2c-1 */
111struct platform_device msm_gsbi1_qup_i2c_device = {
112 .name = "qup_i2c",
113 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
114 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
115 .resource = gsbi1_qup_i2c_resources,
116};
117
118#define MSM_HSUSB_PHYS 0xA0800000
119static struct resource resources_hsusb_otg[] = {
120 {
121 .start = MSM_HSUSB_PHYS,
122 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
123 .flags = IORESOURCE_MEM,
124 },
125 {
126 .start = INT_USB_HS,
127 .end = INT_USB_HS,
128 .flags = IORESOURCE_IRQ,
129 },
130};
131
132static u64 dma_mask = 0xffffffffULL;
133struct platform_device msm_device_otg = {
134 .name = "msm_otg",
135 .id = -1,
136 .num_resources = ARRAY_SIZE(resources_hsusb_otg),
137 .resource = resources_hsusb_otg,
138 .dev = {
139 .dma_mask = &dma_mask,
140 .coherent_dma_mask = 0xffffffffULL,
141 },
142};
143
144static struct resource resources_gadget_peripheral[] = {
145 {
146 .start = MSM_HSUSB_PHYS,
147 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
148 .flags = IORESOURCE_MEM,
149 },
150 {
151 .start = INT_USB_HS,
152 .end = INT_USB_HS,
153 .flags = IORESOURCE_IRQ,
154 },
155};
156
157struct platform_device msm_device_gadget_peripheral = {
158 .name = "msm_hsusb",
159 .id = -1,
160 .num_resources = ARRAY_SIZE(resources_gadget_peripheral),
161 .resource = resources_gadget_peripheral,
162 .dev = {
163 .dma_mask = &dma_mask,
164 .coherent_dma_mask = 0xffffffffULL,
165 },
166};
167
168static struct resource resources_hsusb_host[] = {
169 {
170 .start = MSM_HSUSB_PHYS,
171 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
172 .flags = IORESOURCE_MEM,
173 },
174 {
175 .start = INT_USB_HS,
176 .end = INT_USB_HS,
177 .flags = IORESOURCE_IRQ,
178 },
179};
180
181struct platform_device msm_device_hsusb_host = {
182 .name = "msm_hsusb_host",
183 .id = 0,
184 .num_resources = ARRAY_SIZE(resources_hsusb_host),
185 .resource = resources_hsusb_host,
186 .dev = {
187 .dma_mask = &dma_mask,
188 .coherent_dma_mask = 0xffffffffULL,
189 },
190};
191
192static struct platform_device *msm_host_devices[] = {
193 &msm_device_hsusb_host,
194};
195
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700196static struct resource msm_dmov_resource[] = {
197 {
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700198 .start = INT_ADM_AARM,
199 .flags = IORESOURCE_IRQ,
200 },
201 {
202 .start = 0xA9700000,
203 .end = 0xA9700000 + SZ_4K - 1,
204 .flags = IORESOURCE_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700205 },
206};
207
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700208static struct msm_dmov_pdata msm_dmov_pdata = {
209 .sd = 3,
210 .sd_size = 0x400,
211};
212
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700213struct platform_device msm_device_dmov = {
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700214 .name = "msm_dmov",
215 .id = -1,
216 .resource = msm_dmov_resource,
217 .num_resources = ARRAY_SIZE(msm_dmov_resource),
218 .dev = {
219 .platform_data = &msm_dmov_pdata,
220 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700221};
222
Matt Wagantallbf430eb2012-03-22 11:45:49 -0700223static struct acpuclk_pdata msm7x27a_acpuclk_pdata = {
224 .max_speed_delta_khz = 400000,
225};
226
227struct platform_device msm7x27a_device_acpuclk = {
228 .name = "acpuclk-7627",
229 .id = -1,
230 .dev.platform_data = &msm7x27a_acpuclk_pdata,
231};
232
233static struct acpuclk_pdata msm7x27aa_acpuclk_pdata = {
234 .max_speed_delta_khz = 504000,
235};
236
237struct platform_device msm7x27aa_device_acpuclk = {
238 .name = "acpuclk-7627",
239 .id = -1,
240 .dev.platform_data = &msm7x27aa_acpuclk_pdata,
241};
242
243static struct acpuclk_pdata msm8625_acpuclk_pdata = {
244 /* TODO: Need to update speed delta from H/w Team */
245 .max_speed_delta_khz = 604800,
246};
247
Kaushal Kumar86473f02012-06-28 19:35:58 +0530248static struct acpuclk_pdata msm8625ab_acpuclk_pdata = {
249 .max_speed_delta_khz = 801600,
250};
251
Matt Wagantallbf430eb2012-03-22 11:45:49 -0700252struct platform_device msm8625_device_acpuclk = {
253 .name = "acpuclk-7627",
254 .id = -1,
255 .dev.platform_data = &msm8625_acpuclk_pdata,
256};
257
Kaushal Kumar86473f02012-06-28 19:35:58 +0530258struct platform_device msm8625ab_device_acpuclk = {
259 .name = "acpuclk-7627",
260 .id = -1,
261 .dev.platform_data = &msm8625ab_acpuclk_pdata,
262};
263
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700264struct platform_device msm_device_smd = {
265 .name = "msm_smd",
266 .id = -1,
267};
268
Angshuman Sarkarfb1cce92012-02-21 15:20:43 +0530269static struct resource smd_8625_resource[] = {
270 {
271 .name = "a9_m2a_0",
272 .start = MSM8625_INT_A9_M2A_0,
273 .flags = IORESOURCE_IRQ,
274 },
275 {
276 .name = "a9_m2a_5",
277 .start = MSM8625_INT_A9_M2A_5,
278 .flags = IORESOURCE_IRQ,
279 },
280};
281
282static struct smd_subsystem_config smd_8625_config_list[] = {
283 {
284 .irq_config_id = SMD_MODEM,
285 .subsys_name = "modem",
286 .edge = SMD_APPS_MODEM,
287
288 .smd_int.irq_name = "a9_m2a_0",
289 .smd_int.flags = IRQF_TRIGGER_RISING,
290 .smd_int.irq_id = -1,
291 .smd_int.device_name = "smd_dev",
292 .smd_int.dev_id = 0,
293
294 .smd_int.out_bit_pos = 1,
295 .smd_int.out_base = (void __iomem *)MSM_CSR_BASE,
296 .smd_int.out_offset = 0x400 + (0) * 4,
297
298 .smsm_int.irq_name = "a9_m2a_5",
299 .smsm_int.flags = IRQF_TRIGGER_RISING,
300 .smsm_int.irq_id = -1,
301 .smsm_int.device_name = "smsm_dev",
302 .smsm_int.dev_id = 0,
303
304 .smsm_int.out_bit_pos = 1,
305 .smsm_int.out_base = (void __iomem *)MSM_CSR_BASE,
306 .smsm_int.out_offset = 0x400 + (5) * 4,
307
308 }
309};
310
311static struct smd_platform smd_8625_platform_data = {
312 .num_ss_configs = ARRAY_SIZE(smd_8625_config_list),
313 .smd_ss_configs = smd_8625_config_list,
314};
315
316struct platform_device msm8625_device_smd = {
317 .name = "msm_smd",
318 .id = -1,
319 .resource = smd_8625_resource,
320 .num_resources = ARRAY_SIZE(smd_8625_resource),
321 .dev = {
322 .platform_data = &smd_8625_platform_data,
323 }
324};
325
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +0530326static struct resource resources_adsp[] = {
327 {
328 .start = INT_ADSP_A9_A11,
329 .end = INT_ADSP_A9_A11,
330 .flags = IORESOURCE_IRQ,
331 },
332};
333
334struct platform_device msm_adsp_device = {
335 .name = "msm_adsp",
336 .id = -1,
337 .num_resources = ARRAY_SIZE(resources_adsp),
338 .resource = resources_adsp,
339};
340
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700341static struct resource resources_uart1[] = {
342 {
343 .start = INT_UART1,
344 .end = INT_UART1,
345 .flags = IORESOURCE_IRQ,
346 },
347 {
Taniya Das13b811a2011-12-09 18:33:45 +0530348 .start = MSM7XXX_UART1_PHYS,
349 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700350 .flags = IORESOURCE_MEM,
351 },
352};
353
354struct platform_device msm_device_uart1 = {
355 .name = "msm_serial",
356 .id = 0,
357 .num_resources = ARRAY_SIZE(resources_uart1),
358 .resource = resources_uart1,
359};
360
361#define MSM_UART1DM_PHYS 0xA0200000
362static struct resource msm_uart1_dm_resources[] = {
363 {
364 .start = MSM_UART1DM_PHYS,
365 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
366 .flags = IORESOURCE_MEM,
367 },
368 {
369 .start = INT_UART1DM_IRQ,
370 .end = INT_UART1DM_IRQ,
371 .flags = IORESOURCE_IRQ,
372 },
373 {
374 .start = INT_UART1DM_RX,
375 .end = INT_UART1DM_RX,
376 .flags = IORESOURCE_IRQ,
377 },
378 {
379 .start = DMOV_HSUART1_TX_CHAN,
380 .end = DMOV_HSUART1_RX_CHAN,
381 .name = "uartdm_channels",
382 .flags = IORESOURCE_DMA,
383 },
384 {
385 .start = DMOV_HSUART1_TX_CRCI,
386 .end = DMOV_HSUART1_RX_CRCI,
387 .name = "uartdm_crci",
388 .flags = IORESOURCE_DMA,
389 },
390};
391
392static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32);
393struct platform_device msm_device_uart_dm1 = {
394 .name = "msm_serial_hs",
395 .id = 0,
396 .num_resources = ARRAY_SIZE(msm_uart1_dm_resources),
397 .resource = msm_uart1_dm_resources,
398 .dev = {
399 .dma_mask = &msm_uart_dm1_dma_mask,
400 .coherent_dma_mask = DMA_BIT_MASK(32),
401 },
402};
403
404#define MSM_UART2DM_PHYS 0xA0300000
405static struct resource msm_uart2dm_resources[] = {
406 {
407 .start = MSM_UART2DM_PHYS,
408 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
409 .name = "uartdm_resource",
410 .flags = IORESOURCE_MEM,
411 },
412 {
413 .start = INT_UART2DM_IRQ,
414 .end = INT_UART2DM_IRQ,
415 .flags = IORESOURCE_IRQ,
416 },
417};
418
419struct platform_device msm_device_uart_dm2 = {
420 .name = "msm_serial_hsl",
421 .id = 0,
422 .num_resources = ARRAY_SIZE(msm_uart2dm_resources),
423 .resource = msm_uart2dm_resources,
424};
425
426#define MSM_NAND_PHYS 0xA0A00000
427#define MSM_NANDC01_PHYS 0xA0A40000
428#define MSM_NANDC10_PHYS 0xA0A80000
429#define MSM_NANDC11_PHYS 0xA0AC0000
430#define EBI2_REG_BASE 0xA0D00000
431static struct resource resources_nand[] = {
432 [0] = {
433 .name = "msm_nand_dmac",
434 .start = DMOV_NAND_CHAN,
435 .end = DMOV_NAND_CHAN,
436 .flags = IORESOURCE_DMA,
437 },
438 [1] = {
439 .name = "msm_nand_phys",
440 .start = MSM_NAND_PHYS,
441 .end = MSM_NAND_PHYS + 0x7FF,
442 .flags = IORESOURCE_MEM,
443 },
444 [2] = {
445 .name = "msm_nandc01_phys",
446 .start = MSM_NANDC01_PHYS,
447 .end = MSM_NANDC01_PHYS + 0x7FF,
448 .flags = IORESOURCE_MEM,
449 },
450 [3] = {
451 .name = "msm_nandc10_phys",
452 .start = MSM_NANDC10_PHYS,
453 .end = MSM_NANDC10_PHYS + 0x7FF,
454 .flags = IORESOURCE_MEM,
455 },
456 [4] = {
457 .name = "msm_nandc11_phys",
458 .start = MSM_NANDC11_PHYS,
459 .end = MSM_NANDC11_PHYS + 0x7FF,
460 .flags = IORESOURCE_MEM,
461 },
462 [5] = {
463 .name = "ebi2_reg_base",
464 .start = EBI2_REG_BASE,
465 .end = EBI2_REG_BASE + 0x60,
466 .flags = IORESOURCE_MEM,
467 },
468};
469
Sujit Reddy Thummaec9b3252012-04-23 15:53:45 +0530470struct flash_platform_data msm_nand_data = {
471 .version = VERSION_2,
472};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700473
474struct platform_device msm_device_nand = {
475 .name = "msm_nand",
476 .id = -1,
477 .num_resources = ARRAY_SIZE(resources_nand),
478 .resource = resources_nand,
479 .dev = {
480 .platform_data = &msm_nand_data,
481 },
482};
483
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530484static struct msm_pm_irq_calls msm7x27a_pm_irq_calls = {
485 .irq_pending = msm_irq_pending,
486 .idle_sleep_allowed = msm_irq_idle_sleep_allowed,
487 .enter_sleep1 = msm_irq_enter_sleep1,
488 .enter_sleep2 = msm_irq_enter_sleep2,
489 .exit_sleep1 = msm_irq_exit_sleep1,
490 .exit_sleep2 = msm_irq_exit_sleep2,
491 .exit_sleep3 = msm_irq_exit_sleep3,
492};
493
494static struct msm_pm_irq_calls msm8625_pm_irq_calls = {
495 .irq_pending = msm_gic_spi_ppi_pending,
496 .idle_sleep_allowed = msm_gic_irq_idle_sleep_allowed,
497 .enter_sleep1 = msm_gic_irq_enter_sleep1,
498 .enter_sleep2 = msm_gic_irq_enter_sleep2,
499 .exit_sleep1 = msm_gic_irq_exit_sleep1,
500 .exit_sleep2 = msm_gic_irq_exit_sleep2,
501 .exit_sleep3 = msm_gic_irq_exit_sleep3,
502};
503
Stephen Boyd986c9632012-04-24 16:31:45 -0700504void __init msm_pm_register_irqs(void)
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530505{
506 if (cpu_is_msm8625())
507 msm_pm_set_irq_extns(&msm8625_pm_irq_calls);
508 else
509 msm_pm_set_irq_extns(&msm7x27a_pm_irq_calls);
510
511}
512
Murali Nalajalaff723ec2012-07-13 16:54:40 +0530513static struct msm_pm_cpr_ops msm8625_pm_cpr_ops = {
514 .cpr_suspend = msm_cpr_pm_suspend,
515 .cpr_resume = msm_cpr_pm_resume,
516};
517
518void __init msm_pm_register_cpr_ops(void)
519{
520 /* CPR presents on revision >= v2.0 chipsets */
521 if (cpu_is_msm8625() &&
522 SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
523 msm_pm_set_cpr_ops(&msm8625_pm_cpr_ops);
524}
525
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700526#define MSM_SDC1_BASE 0xA0400000
527#define MSM_SDC2_BASE 0xA0500000
528#define MSM_SDC3_BASE 0xA0600000
529#define MSM_SDC4_BASE 0xA0700000
530static struct resource resources_sdc1[] = {
531 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530532 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700533 .start = MSM_SDC1_BASE,
534 .end = MSM_SDC1_BASE + SZ_4K - 1,
535 .flags = IORESOURCE_MEM,
536 },
537 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530538 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700539 .start = INT_SDC1_0,
540 .end = INT_SDC1_1,
541 .flags = IORESOURCE_IRQ,
542 },
543 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530544 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700545 .start = DMOV_SDC1_CHAN,
546 .end = DMOV_SDC1_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700547 .flags = IORESOURCE_DMA,
548 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700549 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530550 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700551 .start = DMOV_SDC1_CRCI,
552 .end = DMOV_SDC1_CRCI,
553 .flags = IORESOURCE_DMA,
554 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700555};
556
557static struct resource resources_sdc2[] = {
558 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530559 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700560 .start = MSM_SDC2_BASE,
561 .end = MSM_SDC2_BASE + SZ_4K - 1,
562 .flags = IORESOURCE_MEM,
563 },
564 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530565 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700566 .start = INT_SDC2_0,
567 .end = INT_SDC2_1,
568 .flags = IORESOURCE_IRQ,
569 },
570 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530571 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700572 .start = DMOV_SDC2_CHAN,
573 .end = DMOV_SDC2_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700574 .flags = IORESOURCE_DMA,
575 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700576 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530577 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700578 .start = DMOV_SDC2_CRCI,
579 .end = DMOV_SDC2_CRCI,
580 .flags = IORESOURCE_DMA,
581 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700582};
583
584static struct resource resources_sdc3[] = {
585 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530586 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700587 .start = MSM_SDC3_BASE,
588 .end = MSM_SDC3_BASE + SZ_4K - 1,
589 .flags = IORESOURCE_MEM,
590 },
591 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530592 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700593 .start = INT_SDC3_0,
594 .end = INT_SDC3_1,
595 .flags = IORESOURCE_IRQ,
596 },
597 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530598 .name = "dma_chnl",
Subhash Jadavanif29aefd2012-06-21 00:43:15 +0530599 .start = DMOV_NAND_CHAN,
600 .end = DMOV_NAND_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700601 .flags = IORESOURCE_DMA,
602 },
603 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530604 .name = "dma_crci",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530605 .start = DMOV_SDC3_CRCI,
606 .end = DMOV_SDC3_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700607 .flags = IORESOURCE_DMA,
608 },
609};
610
611static struct resource resources_sdc4[] = {
612 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530613 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700614 .start = MSM_SDC4_BASE,
615 .end = MSM_SDC4_BASE + SZ_4K - 1,
616 .flags = IORESOURCE_MEM,
617 },
618 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530619 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700620 .start = INT_SDC4_0,
621 .end = INT_SDC4_1,
622 .flags = IORESOURCE_IRQ,
623 },
624 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530625 .name = "dma_chnl",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530626 .start = DMOV_SDC4_CHAN,
627 .end = DMOV_SDC4_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700628 .flags = IORESOURCE_DMA,
629 },
630 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530631 .name = "dma_crci",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530632 .start = DMOV_SDC4_CRCI,
633 .end = DMOV_SDC4_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700634 .flags = IORESOURCE_DMA,
635 },
636};
637
638struct platform_device msm_device_sdc1 = {
639 .name = "msm_sdcc",
640 .id = 1,
641 .num_resources = ARRAY_SIZE(resources_sdc1),
642 .resource = resources_sdc1,
643 .dev = {
644 .coherent_dma_mask = 0xffffffff,
645 },
646};
647
648struct platform_device msm_device_sdc2 = {
649 .name = "msm_sdcc",
650 .id = 2,
651 .num_resources = ARRAY_SIZE(resources_sdc2),
652 .resource = resources_sdc2,
653 .dev = {
654 .coherent_dma_mask = 0xffffffff,
655 },
656};
657
658struct platform_device msm_device_sdc3 = {
659 .name = "msm_sdcc",
660 .id = 3,
661 .num_resources = ARRAY_SIZE(resources_sdc3),
662 .resource = resources_sdc3,
663 .dev = {
664 .coherent_dma_mask = 0xffffffff,
665 },
666};
667
668struct platform_device msm_device_sdc4 = {
669 .name = "msm_sdcc",
670 .id = 4,
671 .num_resources = ARRAY_SIZE(resources_sdc4),
672 .resource = resources_sdc4,
673 .dev = {
674 .coherent_dma_mask = 0xffffffff,
675 },
676};
677
678static struct platform_device *msm_sdcc_devices[] __initdata = {
679 &msm_device_sdc1,
680 &msm_device_sdc2,
681 &msm_device_sdc3,
682 &msm_device_sdc4,
683};
684
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530685#ifdef CONFIG_MSM_CAMERA_V4L2
Suresh Vankadara6050cef52012-04-16 21:44:59 +0530686static int apps_reset;
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530687static struct resource msm_csic0_resources[] = {
688 {
689 .name = "csic",
690 .start = 0xA0F00000,
691 .end = 0xA0F00000 + 0x00100000 - 1,
692 .flags = IORESOURCE_MEM,
693 },
694 {
695 .name = "csic",
696 .start = INT_CSI_IRQ_0,
697 .end = INT_CSI_IRQ_0,
698 .flags = IORESOURCE_IRQ,
699 },
700};
701
702static struct resource msm_csic1_resources[] = {
703 {
704 .name = "csic",
705 .start = 0xA1000000,
706 .end = 0xA1000000 + 0x00100000 - 1,
707 .flags = IORESOURCE_MEM,
708 },
709 {
710 .name = "csic",
711 .start = INT_CSI_IRQ_1,
712 .end = INT_CSI_IRQ_1,
713 .flags = IORESOURCE_IRQ,
714 },
715};
716
717struct platform_device msm7x27a_device_csic0 = {
718 .name = "msm_csic",
719 .id = 0,
720 .resource = msm_csic0_resources,
721 .num_resources = ARRAY_SIZE(msm_csic0_resources),
722};
723
724struct platform_device msm7x27a_device_csic1 = {
725 .name = "msm_csic",
726 .id = 1,
727 .resource = msm_csic1_resources,
728 .num_resources = ARRAY_SIZE(msm_csic1_resources),
729};
730
731static struct resource msm_clkctl_resources[] = {
732 {
733 .name = "clk_ctl",
Taniya Das13b811a2011-12-09 18:33:45 +0530734 .start = MSM7XXX_CLK_CTL_PHYS,
735 .end = MSM7XXX_CLK_CTL_PHYS + MSM7XXX_CLK_CTL_SIZE - 1,
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530736 .flags = IORESOURCE_MEM,
737 },
738};
739struct platform_device msm7x27a_device_clkctl = {
740 .name = "msm_clk_ctl",
741 .id = 0,
742 .resource = msm_clkctl_resources,
743 .num_resources = ARRAY_SIZE(msm_clkctl_resources),
Suresh Vankadara6050cef52012-04-16 21:44:59 +0530744 .dev = {
745 .platform_data = &apps_reset,
746 },
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530747};
748
749struct platform_device msm7x27a_device_vfe = {
750 .name = "msm_vfe",
751 .id = 0,
752};
753
754#endif
755
Murali Nalajala41786ab2012-03-06 10:47:32 +0530756/* Command sequence for simple WFI */
757static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Murali Nalajala2250a272012-03-13 15:56:59 +0530758 0x04, 0x03, 0x04, 0x0f,
Murali Nalajala41786ab2012-03-06 10:47:32 +0530759};
760
761/* Command sequence for GDFS, this won't send any interrupt to the modem */
762static uint8_t spm_pc_without_modem[] __initdata = {
763 0x20, 0x00, 0x30, 0x10,
Murali Nalajala2250a272012-03-13 15:56:59 +0530764 0x03, 0x1e, 0x0e, 0x3e,
765 0x4e, 0x4e, 0x4e, 0x4e,
766 0x4e, 0x4e, 0x4e, 0x4e,
767 0x4e, 0x4e, 0x4e, 0x4e,
768 0x4e, 0x4e, 0x4e, 0x4e,
769 0x2E, 0x0f,
Murali Nalajala41786ab2012-03-06 10:47:32 +0530770};
771
772static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
773 [0] = {
774 .mode = MSM_SPM_MODE_CLOCK_GATING,
775 .notify_rpm = false,
776 .cmd = spm_wfi_cmd_sequence,
777 },
778 [1] = {
779 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
780 .notify_rpm = false,
781 .cmd = spm_pc_without_modem,
782 },
Murali Nalajalaf194f682012-10-19 20:10:07 +0530783 [2] = {
784 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
785 .notify_rpm = false,
786 .cmd = spm_pc_without_modem,
787 },
788 [3] = {
789 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
790 .notify_rpm = false,
791 .cmd = spm_pc_without_modem,
792 },
Murali Nalajala41786ab2012-03-06 10:47:32 +0530793};
794
795static struct msm_spm_platform_data msm_spm_data[] __initdata = {
796 [0] = {
797 .reg_base_addr = MSM_SAW0_BASE,
798 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
799 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
800 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
801 .modes = msm_spm_seq_list,
802 },
803 [1] = {
804 .reg_base_addr = MSM_SAW1_BASE,
805 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
806 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
807 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
808 .modes = msm_spm_seq_list,
809 },
Murali Nalajalaf194f682012-10-19 20:10:07 +0530810 [2] = {
811 .reg_base_addr = MSM_SAW2_BASE,
812 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
813 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
814 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
815 .modes = msm_spm_seq_list,
816 },
817 [3] = {
818 .reg_base_addr = MSM_SAW3_BASE,
819 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
820 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
821 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
822 .modes = msm_spm_seq_list,
823 },
Murali Nalajala41786ab2012-03-06 10:47:32 +0530824};
825
826void __init msm8x25_spm_device_init(void)
827{
828 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
829}
830
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700831#define MDP_BASE 0xAA200000
832#define MIPI_DSI_HW_BASE 0xA1100000
833
834static struct resource msm_mipi_dsi_resources[] = {
835 {
836 .name = "mipi_dsi",
837 .start = MIPI_DSI_HW_BASE,
838 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
839 .flags = IORESOURCE_MEM,
840 },
841 {
842 .start = INT_DSI_IRQ,
843 .end = INT_DSI_IRQ,
844 .flags = IORESOURCE_IRQ,
845 },
846};
847
848static struct platform_device msm_mipi_dsi_device = {
849 .name = "mipi_dsi",
850 .id = 1,
851 .num_resources = ARRAY_SIZE(msm_mipi_dsi_resources),
852 .resource = msm_mipi_dsi_resources,
853};
854
855static struct resource msm_mdp_resources[] = {
856 {
857 .name = "mdp",
858 .start = MDP_BASE,
859 .end = MDP_BASE + 0x000F1008 - 1,
860 .flags = IORESOURCE_MEM,
861 },
862 {
863 .start = INT_MDP,
864 .end = INT_MDP,
865 .flags = IORESOURCE_IRQ,
866 },
867};
868
869static struct platform_device msm_mdp_device = {
870 .name = "mdp",
871 .id = 0,
872 .num_resources = ARRAY_SIZE(msm_mdp_resources),
873 .resource = msm_mdp_resources,
874};
875
Padmanabhan Komandurue77bcf52012-07-26 12:43:39 +0530876struct platform_device msm_lcdc_device = {
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700877 .name = "lcdc",
878 .id = 0,
879};
880
881static struct resource kgsl_3d0_resources[] = {
882 {
883 .name = KGSL_3D0_REG_MEMORY,
884 .start = 0xA0000000,
885 .end = 0xA001ffff,
886 .flags = IORESOURCE_MEM,
887 },
888 {
889 .name = KGSL_3D0_IRQ,
890 .start = INT_GRAPHICS,
891 .end = INT_GRAPHICS,
892 .flags = IORESOURCE_IRQ,
893 },
894};
895
896static struct kgsl_device_platform_data kgsl_3d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600897 .pwrlevel = {
898 {
899 .gpu_freq = 245760000,
900 .bus_freq = 200000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700901 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600902 {
Lynus Vazeaf0aac2012-01-05 12:28:47 +0530903 .gpu_freq = 192000000,
904 .bus_freq = 160000000,
905 },
906 {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600907 .gpu_freq = 133330000,
908 .bus_freq = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700909 },
910 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600911 .init_level = 0,
Lynus Vazeaf0aac2012-01-05 12:28:47 +0530912 .num_levels = 3,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600913 .set_grp_async = set_grp_xbar_async,
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700914 .idle_timeout = HZ,
Lynus Vazfe4bede2012-04-06 11:53:30 -0700915 .strtstp_sleepwake = true,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600916 .nap_allowed = false,
917 .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700918};
919
920struct platform_device msm_kgsl_3d0 = {
921 .name = "kgsl-3d0",
922 .id = 0,
923 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
924 .resource = kgsl_3d0_resources,
925 .dev = {
926 .platform_data = &kgsl_3d0_pdata,
927 },
928};
929
930void __init msm7x25a_kgsl_3d0_init(void)
931{
Pankaj Kumarfee56a82012-04-17 14:26:49 +0530932 if (cpu_is_msm7x25a() || cpu_is_msm7x25aa() || cpu_is_msm7x25ab()) {
Lynus Vaz971610e2012-01-06 11:00:32 +0530933 kgsl_3d0_pdata.num_levels = 2;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600934 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 133330000;
935 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 160000000;
936 kgsl_3d0_pdata.pwrlevel[1].gpu_freq = 96000000;
937 kgsl_3d0_pdata.pwrlevel[1].bus_freq = 0;
Rajesh Kemisettidf6e62f2012-03-12 14:02:30 +0530938 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700939}
940
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700941void __init msm8x25_kgsl_3d0_init(void)
942{
Lynus Vazfe4bede2012-04-06 11:53:30 -0700943 if (cpu_is_msm8625()) {
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700944 kgsl_3d0_pdata.idle_timeout = HZ/5;
Lynus Vazfe4bede2012-04-06 11:53:30 -0700945 kgsl_3d0_pdata.strtstp_sleepwake = false;
Ranjhith Kalisamy5fb30ef2012-08-12 16:26:36 +0530946
947 if (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2)
948 /* 8x25 v2.0 & above supports a higher GPU frequency */
949 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 320000000;
950 else
951 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 300000000;
952
Ranjhith Kalisamy24696322012-04-11 22:09:17 +0530953 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 200000000;
Lynus Vazfe4bede2012-04-06 11:53:30 -0700954 }
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700955}
956
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700957static void __init msm_register_device(struct platform_device *pdev, void *data)
958{
959 int ret;
960
961 pdev->dev.platform_data = data;
962
963 ret = platform_device_register(pdev);
964
965 if (ret)
966 dev_err(&pdev->dev,
967 "%s: platform_device_register() failed = %d\n",
968 __func__, ret);
969}
970
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700971
972#define PERPH_WEB_BLOCK_ADDR (0xA9D00040)
973#define PDM0_CTL_OFFSET (0x04)
974#define SIZE_8B (0x08)
975
976static struct resource resources_led[] = {
977 {
978 .start = PERPH_WEB_BLOCK_ADDR,
979 .end = PERPH_WEB_BLOCK_ADDR + (SIZE_8B) - 1,
980 .name = "led-gpio-pdm",
981 .flags = IORESOURCE_MEM,
982 },
983};
984
985static struct led_info msm_kpbl_pdm_led_pdata = {
986 .name = "keyboard-backlight",
987};
988
989struct platform_device led_pdev = {
990 .name = "leds-msm-pdm",
991 /* use pdev id to represent pdm id */
992 .id = 0,
993 .num_resources = ARRAY_SIZE(resources_led),
994 .resource = resources_led,
995 .dev = {
996 .platform_data = &msm_kpbl_pdm_led_pdata,
997 },
998};
999
Manish Dewangan3a260992011-06-24 18:01:34 +05301000struct platform_device asoc_msm_pcm = {
1001 .name = "msm-dsp-audio",
1002 .id = 0,
1003};
1004
1005struct platform_device asoc_msm_dai0 = {
1006 .name = "msm-codec-dai",
1007 .id = 0,
1008};
1009
1010struct platform_device asoc_msm_dai1 = {
1011 .name = "msm-cpu-dai",
1012 .id = 0,
1013};
1014
Taniya Das2e948192011-12-20 11:15:13 +05301015static struct resource gpio_resources[] = {
1016 {
1017 .start = INT_GPIO_GROUP1,
1018 .flags = IORESOURCE_IRQ,
1019 },
1020 {
1021 .start = INT_GPIO_GROUP2,
1022 .flags = IORESOURCE_IRQ,
1023 },
1024};
1025
1026static struct platform_device msm_device_gpio = {
1027 .name = "msmgpio",
1028 .id = -1,
1029 .resource = gpio_resources,
1030 .num_resources = ARRAY_SIZE(gpio_resources),
1031};
1032
Taniya Das43bcdd62011-12-02 17:33:27 +05301033struct platform_device *msm_footswitch_devices[] = {
Matt Wagantalld6fbf232012-05-03 20:09:28 -07001034 FS_PCOM(FS_GFX3D, "vdd", "kgsl-3d0.0"),
Taniya Das43bcdd62011-12-02 17:33:27 +05301035};
1036unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);
1037
1038/* MSM8625 Devices */
1039
1040static struct resource msm8625_resources_uart1[] = {
1041 {
1042 .start = MSM8625_INT_UART1,
1043 .end = MSM8625_INT_UART1,
1044 .flags = IORESOURCE_IRQ,
1045 },
1046 {
Taniya Das13b811a2011-12-09 18:33:45 +05301047 .start = MSM7XXX_UART1_PHYS,
1048 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Taniya Das43bcdd62011-12-02 17:33:27 +05301049 .flags = IORESOURCE_MEM,
1050 },
1051};
1052
1053struct platform_device msm8625_device_uart1 = {
1054 .name = "msm_serial",
1055 .id = 0,
1056 .num_resources = ARRAY_SIZE(msm8625_resources_uart1),
1057 .resource = msm8625_resources_uart1,
1058};
1059
Trilok Soni269fff42012-02-13 20:35:30 +05301060static struct resource msm8625_uart1_dm_resources[] = {
1061 {
1062 .start = MSM_UART1DM_PHYS,
1063 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
1064 .flags = IORESOURCE_MEM,
1065 },
1066 {
1067 .start = MSM8625_INT_UART1DM_IRQ,
1068 .end = MSM8625_INT_UART1DM_IRQ,
1069 .flags = IORESOURCE_IRQ,
1070 },
1071 {
1072 .start = MSM8625_INT_UART1DM_RX,
1073 .end = MSM8625_INT_UART1DM_RX,
1074 .flags = IORESOURCE_IRQ,
1075 },
1076 {
1077 .start = DMOV_HSUART1_TX_CHAN,
1078 .end = DMOV_HSUART1_RX_CHAN,
1079 .name = "uartdm_channels",
1080 .flags = IORESOURCE_DMA,
1081 },
1082 {
1083 .start = DMOV_HSUART1_TX_CRCI,
1084 .end = DMOV_HSUART1_RX_CRCI,
1085 .name = "uartdm_crci",
1086 .flags = IORESOURCE_DMA,
1087 },
1088};
1089
1090struct platform_device msm8625_device_uart_dm1 = {
1091 .name = "msm_serial_hs",
1092 .id = 0,
1093 .num_resources = ARRAY_SIZE(msm8625_uart1_dm_resources),
1094 .resource = msm8625_uart1_dm_resources,
1095 .dev = {
1096 .dma_mask = &msm_uart_dm1_dma_mask,
1097 .coherent_dma_mask = DMA_BIT_MASK(32),
1098 },
1099};
1100
1101static struct resource msm8625_uart2dm_resources[] = {
1102 {
1103 .start = MSM_UART2DM_PHYS,
1104 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
1105 .name = "uartdm_resource",
1106 .flags = IORESOURCE_MEM,
1107 },
1108 {
1109 .start = MSM8625_INT_UART2DM_IRQ,
1110 .end = MSM8625_INT_UART2DM_IRQ,
1111 .flags = IORESOURCE_IRQ,
1112 },
1113};
1114
1115struct platform_device msm8625_device_uart_dm2 = {
1116 .name = "msm_serial_hsl",
1117 .id = 0,
1118 .num_resources = ARRAY_SIZE(msm8625_uart2dm_resources),
1119 .resource = msm8625_uart2dm_resources,
1120};
1121
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +05301122static struct resource msm8625_resources_adsp[] = {
1123 {
1124 .start = MSM8625_INT_ADSP_A9_A11,
1125 .end = MSM8625_INT_ADSP_A9_A11,
1126 .flags = IORESOURCE_IRQ,
1127 },
1128};
1129
1130struct platform_device msm8625_device_adsp = {
1131 .name = "msm_adsp",
1132 .id = -1,
1133 .num_resources = ARRAY_SIZE(msm8625_resources_adsp),
1134 .resource = msm8625_resources_adsp,
1135};
1136
Taniya Das43bcdd62011-12-02 17:33:27 +05301137static struct resource msm8625_dmov_resource[] = {
1138 {
1139 .start = MSM8625_INT_ADM_AARM,
1140 .flags = IORESOURCE_IRQ,
1141 },
1142 {
1143 .start = 0xA9700000,
1144 .end = 0xA9700000 + SZ_4K - 1,
1145 .flags = IORESOURCE_MEM,
1146 },
1147};
1148
1149struct platform_device msm8625_device_dmov = {
1150 .name = "msm_dmov",
1151 .id = -1,
1152 .resource = msm8625_dmov_resource,
1153 .num_resources = ARRAY_SIZE(msm8625_dmov_resource),
1154 .dev = {
1155 .platform_data = &msm_dmov_pdata,
1156 },
1157};
Taniya Das2e948192011-12-20 11:15:13 +05301158
Taniya Das9d187142011-12-02 15:53:25 +05301159static struct resource gsbi0_msm8625_qup_resources[] = {
1160 {
1161 .name = "qup_phys_addr",
1162 .start = MSM_GSBI0_QUP_PHYS,
1163 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
1164 .flags = IORESOURCE_MEM,
1165 },
1166 {
1167 .name = "gsbi_qup_i2c_addr",
1168 .start = MSM_GSBI0_PHYS,
1169 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
1170 .flags = IORESOURCE_MEM,
1171 },
1172 {
1173 .name = "qup_err_intr",
1174 .start = MSM8625_INT_PWB_I2C,
1175 .end = MSM8625_INT_PWB_I2C,
1176 .flags = IORESOURCE_IRQ,
1177 },
1178};
1179
1180/* Use GSBI0 QUP for /dev/i2c-0 */
Taniya Dase3027e22012-02-27 16:32:27 +05301181struct platform_device msm8625_gsbi0_qup_i2c_device = {
Taniya Das9d187142011-12-02 15:53:25 +05301182 .name = "qup_i2c",
1183 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
1184 .num_resources = ARRAY_SIZE(gsbi0_msm8625_qup_resources),
1185 .resource = gsbi0_msm8625_qup_resources,
1186};
1187
Trilok Soni633e59c2012-02-13 20:28:30 +05301188static struct resource gsbi1_msm8625_qup_i2c_resources[] = {
1189 {
1190 .name = "qup_phys_addr",
1191 .start = MSM_GSBI1_QUP_PHYS,
1192 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
1193 .flags = IORESOURCE_MEM,
1194 },
1195 {
1196 .name = "gsbi_qup_i2c_addr",
1197 .start = MSM_GSBI1_PHYS,
1198 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
1199 .flags = IORESOURCE_MEM,
1200 },
1201 {
1202 .name = "qup_err_intr",
1203 .start = MSM8625_INT_ARM11_DMA,
1204 .end = MSM8625_INT_ARM11_DMA,
1205 .flags = IORESOURCE_IRQ,
1206 },
1207};
1208
1209/* Use GSBI1 QUP for /dev/i2c-1 */
Taniya Dase3027e22012-02-27 16:32:27 +05301210struct platform_device msm8625_gsbi1_qup_i2c_device = {
Trilok Soni633e59c2012-02-13 20:28:30 +05301211 .name = "qup_i2c",
1212 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
1213 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
1214 .resource = gsbi1_msm8625_qup_i2c_resources,
1215};
1216
Taniya Das6684d622012-01-12 10:29:09 +05301217static struct resource msm8625_gpio_resources[] = {
1218 {
1219 .start = MSM8625_INT_GPIO_GROUP1,
1220 .flags = IORESOURCE_IRQ,
1221 },
1222 {
1223 .start = MSM8625_INT_GPIO_GROUP2,
1224 .flags = IORESOURCE_IRQ,
1225 },
1226};
1227
1228static struct platform_device msm8625_device_gpio = {
1229 .name = "msmgpio",
1230 .id = -1,
1231 .resource = msm8625_gpio_resources,
1232 .num_resources = ARRAY_SIZE(msm8625_gpio_resources),
1233};
1234
Trilok Soniee75f6c2012-02-13 20:45:07 +05301235static struct resource msm8625_resources_sdc1[] = {
1236 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301237 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301238 .start = MSM_SDC1_BASE,
1239 .end = MSM_SDC1_BASE + SZ_4K - 1,
1240 .flags = IORESOURCE_MEM,
1241 },
1242 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301243 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301244 .start = MSM8625_INT_SDC1_0,
1245 .end = MSM8625_INT_SDC1_1,
1246 .flags = IORESOURCE_IRQ,
1247 },
1248 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301249 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301250 .start = DMOV_SDC1_CHAN,
1251 .end = DMOV_SDC1_CHAN,
1252 .flags = IORESOURCE_DMA,
1253 },
1254 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301255 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301256 .start = DMOV_SDC1_CRCI,
1257 .end = DMOV_SDC1_CRCI,
1258 .flags = IORESOURCE_DMA,
1259 }
1260};
1261
1262static struct resource msm8625_resources_sdc2[] = {
1263 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301264 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301265 .start = MSM_SDC2_BASE,
1266 .end = MSM_SDC2_BASE + SZ_4K - 1,
1267 .flags = IORESOURCE_MEM,
1268 },
1269 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301270 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301271 .start = MSM8625_INT_SDC2_0,
1272 .end = MSM8625_INT_SDC2_1,
1273 .flags = IORESOURCE_IRQ,
1274 },
1275 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301276 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301277 .start = DMOV_SDC2_CHAN,
1278 .end = DMOV_SDC2_CHAN,
1279 .flags = IORESOURCE_DMA,
1280 },
1281 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301282 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301283 .start = DMOV_SDC2_CRCI,
1284 .end = DMOV_SDC2_CRCI,
1285 .flags = IORESOURCE_DMA,
1286 }
1287};
1288
1289static struct resource msm8625_resources_sdc3[] = {
1290 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301291 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301292 .start = MSM_SDC3_BASE,
1293 .end = MSM_SDC3_BASE + SZ_4K - 1,
1294 .flags = IORESOURCE_MEM,
1295 },
1296 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301297 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301298 .start = MSM8625_INT_SDC3_0,
1299 .end = MSM8625_INT_SDC3_1,
1300 .flags = IORESOURCE_IRQ,
1301 },
1302 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301303 .name = "dma_chnl",
Pratibhasagar Vc483d202012-08-21 14:37:17 +05301304 .start = DMOV_NAND_CHAN,
1305 .end = DMOV_NAND_CHAN,
Trilok Soniee75f6c2012-02-13 20:45:07 +05301306 .flags = IORESOURCE_DMA,
1307 },
1308 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301309 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301310 .start = DMOV_SDC3_CRCI,
1311 .end = DMOV_SDC3_CRCI,
1312 .flags = IORESOURCE_DMA,
1313 },
1314};
1315
1316static struct resource msm8625_resources_sdc4[] = {
1317 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301318 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301319 .start = MSM_SDC4_BASE,
1320 .end = MSM_SDC4_BASE + SZ_4K - 1,
1321 .flags = IORESOURCE_MEM,
1322 },
1323 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301324 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301325 .start = MSM8625_INT_SDC4_0,
1326 .end = MSM8625_INT_SDC4_1,
1327 .flags = IORESOURCE_IRQ,
1328 },
1329 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301330 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301331 .start = DMOV_SDC4_CHAN,
1332 .end = DMOV_SDC4_CHAN,
1333 .flags = IORESOURCE_DMA,
1334 },
1335 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301336 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301337 .start = DMOV_SDC4_CRCI,
1338 .end = DMOV_SDC4_CRCI,
1339 .flags = IORESOURCE_DMA,
1340 },
1341};
1342
1343struct platform_device msm8625_device_sdc1 = {
1344 .name = "msm_sdcc",
1345 .id = 1,
1346 .num_resources = ARRAY_SIZE(msm8625_resources_sdc1),
1347 .resource = msm8625_resources_sdc1,
1348 .dev = {
1349 .coherent_dma_mask = 0xffffffff,
1350 },
1351};
1352
1353struct platform_device msm8625_device_sdc2 = {
1354 .name = "msm_sdcc",
1355 .id = 2,
1356 .num_resources = ARRAY_SIZE(msm8625_resources_sdc2),
1357 .resource = msm8625_resources_sdc2,
1358 .dev = {
1359 .coherent_dma_mask = 0xffffffff,
1360 },
1361};
1362
1363struct platform_device msm8625_device_sdc3 = {
1364 .name = "msm_sdcc",
1365 .id = 3,
1366 .num_resources = ARRAY_SIZE(msm8625_resources_sdc3),
1367 .resource = msm8625_resources_sdc3,
1368 .dev = {
1369 .coherent_dma_mask = 0xffffffff,
1370 },
1371};
1372
1373struct platform_device msm8625_device_sdc4 = {
1374 .name = "msm_sdcc",
1375 .id = 4,
1376 .num_resources = ARRAY_SIZE(msm8625_resources_sdc4),
1377 .resource = msm8625_resources_sdc4,
1378 .dev = {
1379 .coherent_dma_mask = 0xffffffff,
1380 },
1381};
1382
1383static struct platform_device *msm8625_sdcc_devices[] __initdata = {
1384 &msm8625_device_sdc1,
1385 &msm8625_device_sdc2,
1386 &msm8625_device_sdc3,
1387 &msm8625_device_sdc4,
1388};
1389
1390int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
1391{
1392 struct platform_device *pdev;
1393
1394 if (controller < 1 || controller > 4)
1395 return -EINVAL;
1396
1397 if (cpu_is_msm8625())
1398 pdev = msm8625_sdcc_devices[controller-1];
1399 else
1400 pdev = msm_sdcc_devices[controller-1];
1401
1402 pdev->dev.platform_data = plat;
1403 return platform_device_register(pdev);
1404}
1405
Trilok Sonida63a8b2012-02-13 20:50:03 +05301406static struct resource msm8625_resources_hsusb_otg[] = {
1407 {
1408 .start = MSM_HSUSB_PHYS,
1409 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1410 .flags = IORESOURCE_MEM,
1411 },
1412 {
1413 .start = MSM8625_INT_USB_HS,
1414 .end = MSM8625_INT_USB_HS,
1415 .flags = IORESOURCE_IRQ,
1416 },
1417};
1418
1419struct platform_device msm8625_device_otg = {
1420 .name = "msm_otg",
1421 .id = -1,
1422 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_otg),
1423 .resource = msm8625_resources_hsusb_otg,
1424 .dev = {
1425 .dma_mask = &dma_mask,
1426 .coherent_dma_mask = 0xffffffffULL,
1427 },
1428};
1429
1430static struct resource msm8625_resources_gadget_peripheral[] = {
1431 {
1432 .start = MSM_HSUSB_PHYS,
1433 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1434 .flags = IORESOURCE_MEM,
1435 },
1436 {
1437 .start = MSM8625_INT_USB_HS,
1438 .end = MSM8625_INT_USB_HS,
1439 .flags = IORESOURCE_IRQ,
1440 },
1441};
1442
1443struct platform_device msm8625_device_gadget_peripheral = {
1444 .name = "msm_hsusb",
1445 .id = -1,
1446 .num_resources = ARRAY_SIZE(msm8625_resources_gadget_peripheral),
1447 .resource = msm8625_resources_gadget_peripheral,
1448 .dev = {
1449 .dma_mask = &dma_mask,
1450 .coherent_dma_mask = 0xffffffffULL,
1451 },
1452};
1453
1454static struct resource msm8625_resources_hsusb_host[] = {
1455 {
1456 .start = MSM_HSUSB_PHYS,
1457 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1458 .flags = IORESOURCE_MEM,
1459 },
1460 {
1461 .start = MSM8625_INT_USB_HS,
1462 .end = MSM8625_INT_USB_HS,
1463 .flags = IORESOURCE_IRQ,
1464 },
1465};
1466
1467struct platform_device msm8625_device_hsusb_host = {
1468 .name = "msm_hsusb_host",
1469 .id = 0,
1470 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_host),
1471 .resource = msm8625_resources_hsusb_host,
1472 .dev = {
1473 .dma_mask = &dma_mask,
1474 .coherent_dma_mask = 0xffffffffULL,
1475 },
1476};
1477
1478static struct platform_device *msm8625_host_devices[] = {
1479 &msm8625_device_hsusb_host,
1480};
1481
1482int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
1483{
1484 struct platform_device *pdev;
1485
1486 if (cpu_is_msm8625())
1487 pdev = msm8625_host_devices[host];
1488 else
1489 pdev = msm_host_devices[host];
1490 if (!pdev)
1491 return -ENODEV;
1492 pdev->dev.platform_data = plat;
1493 return platform_device_register(pdev);
1494}
1495
Trilok Soni88da2552012-02-13 21:01:24 +05301496#ifdef CONFIG_MSM_CAMERA_V4L2
1497static struct resource msm8625_csic0_resources[] = {
1498 {
1499 .name = "csic",
1500 .start = 0xA0F00000,
1501 .end = 0xA0F00000 + 0x00100000 - 1,
1502 .flags = IORESOURCE_MEM,
1503 },
1504 {
1505 .name = "csic",
1506 .start = MSM8625_INT_CSI_IRQ_0,
1507 .end = MSM8625_INT_CSI_IRQ_0,
1508 .flags = IORESOURCE_IRQ,
1509 },
1510};
1511
1512static struct resource msm8625_csic1_resources[] = {
1513 {
1514 .name = "csic",
1515 .start = 0xA1000000,
1516 .end = 0xA1000000 + 0x00100000 - 1,
1517 .flags = IORESOURCE_MEM,
1518 },
1519 {
1520 .name = "csic",
1521 .start = MSM8625_INT_CSI_IRQ_1,
1522 .end = MSM8625_INT_CSI_IRQ_1,
1523 .flags = IORESOURCE_IRQ,
1524 },
1525};
1526
1527struct platform_device msm8625_device_csic0 = {
1528 .name = "msm_csic",
1529 .id = 0,
1530 .resource = msm8625_csic0_resources,
1531 .num_resources = ARRAY_SIZE(msm8625_csic0_resources),
1532};
1533
1534struct platform_device msm8625_device_csic1 = {
1535 .name = "msm_csic",
1536 .id = 1,
1537 .resource = msm8625_csic1_resources,
1538 .num_resources = ARRAY_SIZE(msm8625_csic1_resources),
1539};
1540#endif
1541
Trilok Soniae4633d2012-02-13 21:08:32 +05301542static struct resource msm8625_mipi_dsi_resources[] = {
1543 {
1544 .name = "mipi_dsi",
1545 .start = MIPI_DSI_HW_BASE,
1546 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
1547 .flags = IORESOURCE_MEM,
1548 },
1549 {
1550 .start = MSM8625_INT_DSI_IRQ,
1551 .end = MSM8625_INT_DSI_IRQ,
1552 .flags = IORESOURCE_IRQ,
1553 },
1554};
1555
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301556static struct platform_device msm8625_mipi_dsi_device = {
Trilok Soniae4633d2012-02-13 21:08:32 +05301557 .name = "mipi_dsi",
1558 .id = 1,
1559 .num_resources = ARRAY_SIZE(msm8625_mipi_dsi_resources),
1560 .resource = msm8625_mipi_dsi_resources,
1561};
1562
1563static struct resource msm8625_mdp_resources[] = {
1564 {
1565 .name = "mdp",
1566 .start = MDP_BASE,
1567 .end = MDP_BASE + 0x000F1008 - 1,
1568 .flags = IORESOURCE_MEM,
1569 },
1570 {
1571 .start = MSM8625_INT_MDP,
1572 .end = MSM8625_INT_MDP,
1573 .flags = IORESOURCE_IRQ,
1574 },
1575};
1576
1577static struct platform_device msm8625_mdp_device = {
1578 .name = "mdp",
1579 .id = 0,
1580 .num_resources = ARRAY_SIZE(msm8625_mdp_resources),
1581 .resource = msm8625_mdp_resources,
1582};
1583
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301584struct platform_device mipi_dsi_device;
1585
Trilok Soniae4633d2012-02-13 21:08:32 +05301586void __init msm_fb_register_device(char *name, void *data)
1587{
1588 if (!strncmp(name, "mdp", 3)) {
1589 if (cpu_is_msm8625())
1590 msm_register_device(&msm8625_mdp_device, data);
1591 else
1592 msm_register_device(&msm_mdp_device, data);
1593 } else if (!strncmp(name, "mipi_dsi", 8)) {
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301594 if (cpu_is_msm8625()) {
Trilok Soniae4633d2012-02-13 21:08:32 +05301595 msm_register_device(&msm8625_mipi_dsi_device, data);
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301596 mipi_dsi_device = msm8625_mipi_dsi_device;
1597 } else {
Trilok Soniae4633d2012-02-13 21:08:32 +05301598 msm_register_device(&msm_mipi_dsi_device, data);
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301599 mipi_dsi_device = msm_mipi_dsi_device;
1600 }
Trilok Soniae4633d2012-02-13 21:08:32 +05301601 } else if (!strncmp(name, "lcdc", 4)) {
1602 msm_register_device(&msm_lcdc_device, data);
1603 } else {
1604 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
1605 }
1606}
1607
Trilok Soni664b95d2012-02-13 21:13:15 +05301608static struct resource msm8625_kgsl_3d0_resources[] = {
1609 {
1610 .name = KGSL_3D0_REG_MEMORY,
1611 .start = 0xA0000000,
1612 .end = 0xA001ffff,
1613 .flags = IORESOURCE_MEM,
1614 },
1615 {
1616 .name = KGSL_3D0_IRQ,
1617 .start = MSM8625_INT_GRAPHICS,
1618 .end = MSM8625_INT_GRAPHICS,
1619 .flags = IORESOURCE_IRQ,
1620 },
1621};
1622
1623struct platform_device msm8625_kgsl_3d0 = {
1624 .name = "kgsl-3d0",
1625 .id = 0,
1626 .num_resources = ARRAY_SIZE(msm8625_kgsl_3d0_resources),
1627 .resource = msm8625_kgsl_3d0_resources,
1628 .dev = {
1629 .platform_data = &kgsl_3d0_pdata,
1630 },
1631};
1632
Taniya Das364426e2012-09-28 17:09:51 +05301633static struct resource pl310_resources[] = {
1634 {
1635 .start = 0xC0400000,
1636 .end = 0xC0400000 + SZ_4K - 1,
1637 .flags = IORESOURCE_MEM,
1638 },
1639 {
1640 .name = "l2_irq",
1641 .start = MSM8625_INT_L2CC_INTR,
1642 .flags = IORESOURCE_IRQ,
1643 },
1644};
1645
1646static struct platform_device pl310_erp_device = {
1647 .name = "pl310_erp",
1648 .id = -1,
1649 .resource = pl310_resources,
1650 .num_resources = ARRAY_SIZE(pl310_resources),
1651};
1652
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301653enum {
1654 MSM8625,
1655 MSM8625A,
1656 MSM8625AB,
1657};
1658
1659static int __init msm8625_cpu_id(void)
1660{
1661 int raw_id, cpu;
1662
1663 raw_id = socinfo_get_raw_id();
1664 switch (raw_id) {
1665 /* Part number for 1GHz part */
1666 case 0x770:
1667 case 0x771:
1668 case 0x77C:
1669 case 0x780:
Kaushal Kumarc84b9c22012-10-12 12:47:55 +05301670 case 0x785: /* Edge-only MSM8125-0 */
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301671 case 0x8D0:
1672 cpu = MSM8625;
1673 break;
1674 /* Part number for 1.2GHz part */
1675 case 0x773:
1676 case 0x774:
1677 case 0x781:
1678 case 0x8D1:
1679 cpu = MSM8625A;
1680 break;
1681 case 0x775:
1682 case 0x776:
Kaushal Kumar5b700f32012-09-05 16:50:19 +05301683 case 0x779:
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301684 case 0x77D:
1685 case 0x782:
1686 case 0x8D2:
1687 cpu = MSM8625AB;
1688 break;
1689 default:
1690 pr_err("Invalid Raw ID\n");
1691 return -ENODEV;
1692 }
1693 return cpu;
1694}
1695
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301696static struct resource cpr_resources[] = {
1697 {
1698 .start = MSM8625_INT_CPR_IRQ0,
1699 .flags = IORESOURCE_IRQ,
1700 },
1701 {
1702 .start = MSM8625_CPR_PHYS,
1703 .end = MSM8625_CPR_PHYS + SZ_4K - 1,
1704 .flags = IORESOURCE_MEM,
1705 },
1706};
1707
1708/**
1709 * These are various Vdd levels supported by PMIC
1710 */
1711static uint32_t msm_c2_pmic_mv[] __initdata = {
Trilok Soni9573ce32012-09-02 03:50:18 +05301712 1350000, 1337500, 1325000, 1312500, 1300000,
1713 1287500, 1275000, 1262500, 1250000, 1237500,
1714 1225000, 1212500, 1200000, 1187500, 1175000,
1715 1162500, 1150000, 1137500, 1125000, 1112500,
1716 1100000, 1087500, 1075000, 1062500, 0,
1717 0, 0, 0, 0, 0,
1718 0, 1050000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301719};
1720
1721/**
1722 * This data will be based on CPR mode of operation
1723 */
1724static struct msm_cpr_mode msm_cpr_mode_data[] = {
1725 [NORMAL_MODE] = {
1726 .ring_osc_data = {
1727 {0, },
1728 {0, },
1729 {0, },
1730 {0, },
1731 {0, },
1732 {0, },
1733 {0, },
1734 {0, },
1735 },
1736 .ring_osc = 0,
1737 .step_quot = ~0,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301738 .tgt_volt_offset = 0,
Trilok Sonidb64ae92012-09-02 02:09:04 +05301739 .nom_Vmax = 1350000,
1740 .nom_Vmin = 1250000,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301741 .calibrated_uV = 1100000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301742 },
1743 [TURBO_MODE] = {
1744 .ring_osc_data = {
1745 {0, },
1746 {0, },
1747 {0, },
1748 {0, },
1749 {0, },
1750 {0, },
1751 {0, },
1752 {0, },
1753 },
1754 .ring_osc = 0,
1755 .step_quot = ~0,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301756 .tgt_volt_offset = 0,
Trilok Sonidb64ae92012-09-02 02:09:04 +05301757 .turbo_Vmax = 1350000,
Kaushal Kumar1f549fc2012-10-04 11:45:32 +05301758 .turbo_Vmin = 1150000,
Trilok Sonidb64ae92012-09-02 02:09:04 +05301759 .nom_Vmax = 1350000,
Kaushal Kumar1f549fc2012-10-04 11:45:32 +05301760 .nom_Vmin = 1150000,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301761 .calibrated_uV = 1300000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301762 },
1763};
1764
1765struct msm_cpr_vp_data vp_data = {
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301766 .min_volt = 1000000,
1767 .max_volt = 1350000,
1768 .default_volt = 1300000,
1769 .step_size = 12500,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301770};
1771
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301772static uint32_t
1773msm_cpr_get_quot(uint32_t max_quot, uint32_t max_freq, uint32_t new_freq)
1774{
1775 uint32_t quot;
1776
1777 /* This formula is as per chip characterization data */
Kaushal Kumarddd521c2012-09-18 19:50:53 +05301778 quot = max_quot - (((max_freq - new_freq) * 7) / 10);
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301779
1780 return quot;
1781}
1782
1783static void msm_cpr_clk_enable(void)
1784{
1785 uint32_t reg_val;
1786
1787 /* Select TCXO (19.2MHz) as clock source */
1788 reg_val = readl_relaxed(A11S_TEST_BUS_SEL_ADDR);
1789 reg_val |= RBCPR_CLK_MUX_SEL;
1790 writel_relaxed(reg_val, A11S_TEST_BUS_SEL_ADDR);
1791
1792 /* Get CPR out of reset */
1793 writel_relaxed(0x1, RBCPR_SW_RESET_N);
1794}
1795
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301796static struct msm_cpr_config msm_cpr_pdata = {
1797 .ref_clk_khz = 19200,
Kaushal Kumar3e60a102012-10-15 16:54:16 +05301798 .delay_us = 25000,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301799 .irq_line = 0,
1800 .cpr_mode_data = msm_cpr_mode_data,
1801 .tgt_count_div_N = 1,
1802 .floor = 0,
1803 .ceiling = 40,
1804 .sw_vlevel = 20,
1805 .up_threshold = 1,
Kaushal Kumar3e60a102012-10-15 16:54:16 +05301806 .dn_threshold = 3,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301807 .up_margin = 0,
1808 .dn_margin = 0,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301809 .max_nom_freq = 700800,
1810 .max_freq = 1401600,
1811 .max_quot = 0,
Kaushal Kumarecfc9182012-10-25 16:17:51 +05301812 .disable_cpr = false,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301813 .vp_data = &vp_data,
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301814 .get_quot = msm_cpr_get_quot,
1815 .clk_enable = msm_cpr_clk_enable,
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301816};
1817
1818static struct platform_device msm8625_device_cpr = {
1819 .name = "msm-cpr",
1820 .id = -1,
1821 .num_resources = ARRAY_SIZE(cpr_resources),
1822 .resource = cpr_resources,
1823 .dev = {
1824 .platform_data = &msm_cpr_pdata,
1825 },
1826};
1827
1828static struct platform_device msm8625_vp_device = {
1829 .name = "vp-regulator",
1830 .id = -1,
1831};
1832
1833static void __init msm_cpr_init(void)
1834{
1835 struct cpr_info_type *cpr_info = NULL;
1836 uint8_t ring_osc = 0;
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301837
1838 cpr_info = kzalloc(sizeof(struct cpr_info_type), GFP_KERNEL);
1839 if (!cpr_info) {
1840 pr_err("%s: Out of memory %d\n", __func__, -ENOMEM);
1841 return;
1842 }
1843
1844 msm_smem_get_cpr_info(cpr_info);
Kaushal Kumarecfc9182012-10-25 16:17:51 +05301845 msm_cpr_pdata.disable_cpr = cpr_info->disable_cpr;
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301846
1847 /**
1848 * Set the ring_osc based on efuse BIT(0)
1849 * CPR_fuse[0] = 0 selects 2nd RO (010)
1850 * CPR_fuse[0] = 1 select 3rd RO (011)
1851 */
1852 if (cpr_info->ring_osc == 0x0)
1853 ring_osc = 0x2;
1854 else if (cpr_info->ring_osc == 0x1)
1855 ring_osc = 0x3;
1856
1857 msm_cpr_mode_data[TURBO_MODE].ring_osc = ring_osc;
1858 msm_cpr_mode_data[NORMAL_MODE].ring_osc = ring_osc;
1859
1860 /* GCNT = 1000 nsec/52nsec (@TCX0=19.2Mhz) = 19.2 */
1861 msm_cpr_mode_data[TURBO_MODE].ring_osc_data[ring_osc].gcnt = 19;
1862 msm_cpr_mode_data[NORMAL_MODE].ring_osc_data[ring_osc].gcnt = 19;
1863
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301864 /**
1865 * The scaling factor and offset are as per chip characterization data
1866 * This formula is used since available fuse bits in the chip are not
1867 * enough to represent the value of maximum quot
1868 */
Trilok Soni7f311172012-09-02 15:15:33 +05301869 msm_cpr_pdata.max_quot = cpr_info->turbo_quot * 10 + 600;
Kaushal Kumarbcb46d92012-10-04 11:31:14 +05301870 /**
1871 * Fused Quot value for 1.2GHz on a 1.2GHz part is lower than
1872 * the quot value calculated using the scaling factor formula for
1873 * 1.2GHz when running on a 1.4GHz part. So, prop up the Quot for
1874 * a 1.2GHz part by a chip characterization recommended value.
1875 * Ditto for a 1.0GHz part.
1876 */
1877 if (msm8625_cpu_id() == MSM8625A) {
Kaushal Kumar3a9f6c82012-10-19 15:30:28 +05301878 msm_cpr_pdata.max_quot += 30;
Kaushal Kumarbcb46d92012-10-04 11:31:14 +05301879 if (msm_cpr_pdata.max_quot > 1400)
1880 msm_cpr_pdata.max_quot = 1400;
1881 } else if (msm8625_cpu_id() == MSM8625) {
Kaushal Kumar3a9f6c82012-10-19 15:30:28 +05301882 msm_cpr_pdata.max_quot += 50;
Kaushal Kumarbcb46d92012-10-04 11:31:14 +05301883 if (msm_cpr_pdata.max_quot > 1350)
1884 msm_cpr_pdata.max_quot = 1350;
1885 }
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301886
1887 /**
1888 * Bits 4:0 of pvs_fuse provide mapping to the safe boot up voltage.
1889 * Boot up mode is by default Turbo.
1890 */
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301891 msm_cpr_mode_data[TURBO_MODE].calibrated_uV =
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301892 msm_c2_pmic_mv[cpr_info->pvs_fuse & 0x1F];
1893
Kaushal Kumar1f549fc2012-10-04 11:45:32 +05301894 if ((cpr_info->floor_fuse & 0x3) == 0x0) {
1895 msm_cpr_mode_data[TURBO_MODE].nom_Vmin = 1000000;
1896 msm_cpr_mode_data[TURBO_MODE].turbo_Vmin = 1100000;
1897 } else if ((cpr_info->floor_fuse & 0x3) == 0x1) {
1898 msm_cpr_mode_data[TURBO_MODE].nom_Vmin = 1050000;
1899 msm_cpr_mode_data[TURBO_MODE].turbo_Vmin = 1100000;
1900 } else if ((cpr_info->floor_fuse & 0x3) == 0x2) {
1901 msm_cpr_mode_data[TURBO_MODE].nom_Vmin = 1100000;
1902 msm_cpr_mode_data[TURBO_MODE].turbo_Vmin = 1100000;
1903 }
1904
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301905 pr_debug("%s: cpr: ring_osc: 0x%x\n", __func__,
1906 msm_cpr_mode_data[TURBO_MODE].ring_osc);
1907 pr_debug("%s: cpr: turbo_quot: 0x%x\n", __func__, cpr_info->turbo_quot);
1908 pr_debug("%s: cpr: pvs_fuse: 0x%x\n", __func__, cpr_info->pvs_fuse);
Kaushal Kumar1f549fc2012-10-04 11:45:32 +05301909 pr_debug("%s: cpr: floor_fuse: 0x%x\n", __func__, cpr_info->floor_fuse);
1910 pr_debug("%s: cpr: nom_Vmin: %d, turbo_Vmin: %d\n", __func__,
1911 msm_cpr_mode_data[TURBO_MODE].nom_Vmin,
1912 msm_cpr_mode_data[TURBO_MODE].turbo_Vmin);
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301913 kfree(cpr_info);
1914
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301915 if (msm8625_cpu_id() == MSM8625A)
1916 msm_cpr_pdata.max_freq = 1209600;
1917 else if (msm8625_cpu_id() == MSM8625)
1918 msm_cpr_pdata.max_freq = 1008000;
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301919
Kaushal Kumard0e4c812012-08-22 16:30:09 +05301920 msm_cpr_clk_enable();
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05301921
1922 platform_device_register(&msm8625_vp_device);
1923 platform_device_register(&msm8625_device_cpr);
1924}
1925
Taniya Das7c9f0512011-12-02 14:26:46 +05301926static struct clk_lookup msm_clock_8625_dummy[] = {
1927 CLK_DUMMY("core_clk", adm_clk.c, "msm_dmov", 0),
1928 CLK_DUMMY("adsp_clk", adsp_clk.c, NULL, 0),
1929 CLK_DUMMY("ahb_m_clk", ahb_m_clk.c, NULL, 0),
1930 CLK_DUMMY("ahb_s_clk", ahb_s_clk.c, NULL, 0),
1931 CLK_DUMMY("cam_m_clk", cam_m_clk.c, NULL, 0),
1932 CLK_DUMMY("csi_clk", csi1_clk.c, NULL, 0),
1933 CLK_DUMMY("csi_pclk", csi1_p_clk.c, NULL, 0),
1934 CLK_DUMMY("csi_vfe_clk", csi1_vfe_clk.c, NULL, 0),
1935 CLK_DUMMY("dsi_byte_clk", dsi_byte_clk.c, NULL, 0),
1936 CLK_DUMMY("dsi_clk", dsi_clk.c, NULL, 0),
1937 CLK_DUMMY("dsi_esc_clk", dsi_esc_clk.c, NULL, 0),
1938 CLK_DUMMY("dsi_pixel_clk", dsi_pixel_clk.c, NULL, 0),
1939 CLK_DUMMY("dsi_ref_clk", dsi_ref_clk.c, NULL, 0),
1940 CLK_DUMMY("ebi1_clk", ebi1_clk.c, NULL, 0),
1941 CLK_DUMMY("ebi2_clk", ebi2_clk.c, NULL, 0),
1942 CLK_DUMMY("ecodec_clk", ecodec_clk.c, NULL, 0),
1943 CLK_DUMMY("gp_clk", gp_clk.c, NULL, 0),
1944 CLK_DUMMY("core_clk", gsbi1_qup_clk.c, "qup_i2c.0", 0),
1945 CLK_DUMMY("core_clk", gsbi2_qup_clk.c, "qup_i2c.1", 0),
1946 CLK_DUMMY("iface_clk", gsbi1_qup_p_clk.c, "qup_i2c.0", 0),
1947 CLK_DUMMY("iface_clk", gsbi2_qup_p_clk.c, "qup_i2c.1", 0),
1948 CLK_DUMMY("icodec_rx_clk", icodec_rx_clk.c, NULL, 0),
1949 CLK_DUMMY("icodec_tx_clk", icodec_tx_clk.c, NULL, 0),
1950 CLK_DUMMY("mem_clk", imem_clk.c, NULL, 0),
1951 CLK_DUMMY("mddi_clk", pmdh_clk.c, NULL, 0),
1952 CLK_DUMMY("mdp_clk", mdp_clk.c, NULL, 0),
1953 CLK_DUMMY("mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk.c, NULL, 0),
1954 CLK_DUMMY("mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk.c, NULL, 0),
1955 CLK_DUMMY("mdp_vsync_clk", mdp_vsync_clk.c, NULL, 0),
1956 CLK_DUMMY("mdp_dsi_pclk", mdp_dsi_p_clk.c, NULL, 0),
1957 CLK_DUMMY("pbus_clk", pbus_clk.c, NULL, 0),
1958 CLK_DUMMY("pcm_clk", pcm_clk.c, NULL, 0),
1959 CLK_DUMMY("sdac_clk", sdac_clk.c, NULL, 0),
1960 CLK_DUMMY("core_clk", sdc1_clk.c, "msm_sdcc.1", 0),
1961 CLK_DUMMY("iface_clk", sdc1_p_clk.c, "msm_sdcc.1", 0),
1962 CLK_DUMMY("core_clk", sdc2_clk.c, "msm_sdcc.2", 0),
1963 CLK_DUMMY("iface_clk", sdc2_p_clk.c, "msm_sdcc.2", 0),
1964 CLK_DUMMY("core_clk", sdc3_clk.c, "msm_sdcc.3", 0),
1965 CLK_DUMMY("iface_clk", sdc3_p_clk.c, "msm_sdcc.3", 0),
1966 CLK_DUMMY("core_clk", sdc4_clk.c, "msm_sdcc.4", 0),
1967 CLK_DUMMY("iface_clk", sdc4_p_clk.c, "msm_sdcc.4", 0),
1968 CLK_DUMMY("ref_clk", tsif_ref_clk.c, "msm_tsif.0", 0),
1969 CLK_DUMMY("iface_clk", tsif_p_clk.c, "msm_tsif.0", 0),
1970 CLK_DUMMY("core_clk", uart1_clk.c, "msm_serial.0", 0),
1971 CLK_DUMMY("core_clk", uart2_clk.c, "msm_serial.1", 0),
1972 CLK_DUMMY("core_clk", uart1dm_clk.c, "msm_serial_hs.0", 0),
1973 CLK_DUMMY("core_clk", uart2dm_clk.c, "msm_serial_hsl.0", 0),
1974 CLK_DUMMY("usb_hs_core_clk", usb_hs_core_clk.c, NULL, 0),
1975 CLK_DUMMY("usb_hs2_clk", usb_hs2_clk.c, NULL, 0),
1976 CLK_DUMMY("usb_hs_clk", usb_hs_clk.c, NULL, 0),
1977 CLK_DUMMY("usb_hs_pclk", usb_hs_p_clk.c, NULL, 0),
1978 CLK_DUMMY("usb_phy_clk", usb_phy_clk.c, NULL, 0),
1979 CLK_DUMMY("vdc_clk", vdc_clk.c, NULL, 0),
1980 CLK_DUMMY("ebi1_acpu_clk", ebi_acpu_clk.c, NULL, 0),
1981 CLK_DUMMY("ebi1_lcdc_clk", ebi_lcdc_clk.c, NULL, 0),
1982 CLK_DUMMY("ebi1_mddi_clk", ebi_mddi_clk.c, NULL, 0),
1983 CLK_DUMMY("ebi1_usb_clk", ebi_usb_clk.c, NULL, 0),
1984 CLK_DUMMY("ebi1_vfe_clk", ebi_vfe_clk.c, NULL, 0),
1985 CLK_DUMMY("mem_clk", ebi_adm_clk.c, "msm_dmov", 0),
1986};
1987
1988struct clock_init_data msm8625_dummy_clock_init_data __initdata = {
1989 .table = msm_clock_8625_dummy,
1990 .size = ARRAY_SIZE(msm_clock_8625_dummy),
1991};
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301992
Taniya Das6e0ff0d2012-10-12 11:38:32 +05301993
1994static int __init msm_gpio_config_gps(void)
1995{
1996 unsigned int gps_gpio = 7;
1997 int ret = 0;
1998
1999 if (!machine_is_msm8625_evb())
2000 return ret;
2001
2002 ret = gpio_tlmm_config(GPIO_CFG(gps_gpio, 0, GPIO_CFG_OUTPUT,
2003 GPIO_CFG_PULL_DOWN, GPIO_CFG_2MA), GPIO_CFG_ENABLE);
2004 if (ret < 0) {
2005 pr_err("gpio tlmm failed for gpio-%d\n", gps_gpio);
2006 return ret;
2007 }
2008
2009 ret = gpio_request(gps_gpio, "gnss-gpio");
2010 if (ret < 0) {
2011 pr_err("failed to request gpio-%d\n", gps_gpio);
2012 return ret;
2013 }
2014
2015 ret = gpio_direction_input(gps_gpio);
2016 if (ret < 0) {
2017 pr_err("failed to change direction for gpio-%d\n", gps_gpio);
2018 return ret;
2019 }
2020
2021 ret = gpio_export(gps_gpio, true);
2022 if (ret < 0)
2023 pr_err("failed to export gpio for user\n");
2024
2025 return ret;
2026}
2027
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002028int __init msm7x2x_misc_init(void)
2029{
Taniya Das7c9f0512011-12-02 14:26:46 +05302030 if (machine_is_msm8625_rumi3()) {
2031 msm_clock_init(&msm8625_dummy_clock_init_data);
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05302032 msm_cpr_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05302033 return 0;
Taniya Das7c9f0512011-12-02 14:26:46 +05302034 }
Taniya Das43bcdd62011-12-02 17:33:27 +05302035
Stephen Boydbb600ae2011-08-02 20:11:40 -07002036 msm_clock_init(&msm7x27a_clock_init_data);
Pankaj Kumarfee56a82012-04-17 14:26:49 +05302037 if (cpu_is_msm7x27aa() || cpu_is_msm7x25ab())
Matt Wagantallbf430eb2012-03-22 11:45:49 -07002038 platform_device_register(&msm7x27aa_device_acpuclk);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05302039 else if (cpu_is_msm8625()) {
2040 if (msm8625_cpu_id() == MSM8625)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07002041 platform_device_register(&msm7x27aa_device_acpuclk);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05302042 else if (msm8625_cpu_id() == MSM8625A)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07002043 platform_device_register(&msm8625_device_acpuclk);
Kaushal Kumar86473f02012-06-28 19:35:58 +05302044 else if (msm8625_cpu_id() == MSM8625AB)
2045 platform_device_register(&msm8625ab_device_acpuclk);
Matt Wagantallbf430eb2012-03-22 11:45:49 -07002046 } else {
2047 platform_device_register(&msm7x27a_device_acpuclk);
2048 }
Kaushal Kumarc0e5d672012-07-31 16:07:49 +05302049
2050 if (cpu_is_msm8625() &&
2051 (SOCINFO_VERSION_MAJOR(socinfo_get_version()) >= 2))
2052 msm_cpr_init();
2053
Taniya Das364426e2012-09-28 17:09:51 +05302054 if (!cpu_is_msm8625())
2055 pl310_resources[1].start = INT_L2CC_INTR;
2056
2057 platform_device_register(&pl310_erp_device);
2058
Taniya Das6e0ff0d2012-10-12 11:38:32 +05302059 if (msm_gpio_config_gps() < 0)
2060 pr_err("Error for gpio config for GPS gpio\n");
2061
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002062 return 0;
2063}
2064
2065#ifdef CONFIG_CACHE_L2X0
2066static int __init msm7x27x_cache_init(void)
2067{
2068 int aux_ctrl = 0;
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05302069 int pctrl = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002070
2071 /* Way Size 010(0x2) 32KB */
2072 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
2073 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
2074 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
2075
Taniya Das379b5682011-12-02 14:53:46 +05302076 if (cpu_is_msm8625()) {
2077 /* Way Size 011(0x3) 64KB */
2078 aux_ctrl |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
2079 (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | \
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05302080 (0X1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) | \
2081 (0x1 << L2X0_AUX_CTRL_L2_FORCE_NWA_SHIFT);
2082
2083 /* Write Prefetch Control settings */
2084 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
2085 pctrl |= (0x3 << L2X0_PREFETCH_CTRL_OFFSET_SHIFT) | \
2086 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_INC_SHIFT) | \
2087 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_SHIFT);
2088 writel_relaxed(pctrl , MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
Taniya Das379b5682011-12-02 14:53:46 +05302089 }
2090
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002091 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05302092 if (cpu_is_msm8625()) {
2093 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
2094 pr_info("Prfetch Ctrl: 0x%08x\n", pctrl);
2095 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002096
2097 return 0;
2098}
2099#else
pankaj kumar80d7cb62011-08-23 13:37:55 +05302100static int __init msm7x27x_cache_init(void){ return 0; }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002101#endif
2102
2103void __init msm_common_io_init(void)
2104{
2105 msm_map_common_io();
Taniya Das43bcdd62011-12-02 17:33:27 +05302106 if (socinfo_init() < 0)
2107 pr_err("%s: socinfo_init() failed!\n", __func__);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002108 msm7x27x_cache_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05302109}
2110
2111void __init msm8625_init_irq(void)
2112{
Trilok Soni1a9fdee2012-05-28 19:54:11 +05302113 msm_gic_irq_extn_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05302114 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
2115 (void *)MSM_QGIC_CPU_BASE);
Taniya Das43bcdd62011-12-02 17:33:27 +05302116}
2117
2118void __init msm8625_map_io(void)
2119{
2120 msm_map_msm8625_io();
2121
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07002122 if (socinfo_init() < 0)
2123 pr_err("%s: socinfo_init() failed!\n", __func__);
Taniya Das379b5682011-12-02 14:53:46 +05302124 msm7x27x_cache_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002125}
2126
Taniya Das43bcdd62011-12-02 17:33:27 +05302127static int msm7627a_init_gpio(void)
2128{
Taniya Das6684d622012-01-12 10:29:09 +05302129 if (cpu_is_msm8625())
2130 platform_device_register(&msm8625_device_gpio);
2131 else
2132 platform_device_register(&msm_device_gpio);
Taniya Das43bcdd62011-12-02 17:33:27 +05302133 return 0;
2134}
2135postcore_initcall(msm7627a_init_gpio);
Taniya Das9d0c3c52012-05-04 14:40:55 +05302136
2137static int msm7627a_panic_handler(struct notifier_block *this,
2138 unsigned long event, void *ptr)
2139{
2140 flush_cache_all();
2141 outer_flush_all();
2142 return NOTIFY_DONE;
2143}
2144
2145static struct notifier_block panic_handler = {
2146 .notifier_call = msm7627a_panic_handler,
Aparna Mallavarapua9990472012-09-26 12:25:24 +05302147 .priority = INT_MAX,
Taniya Das9d0c3c52012-05-04 14:40:55 +05302148};
2149
2150static int __init panic_register(void)
2151{
2152 atomic_notifier_chain_register(&panic_notifier_list,
2153 &panic_handler);
2154 return 0;
2155}
2156module_init(panic_register);