blob: 96984fbb62f36c430eba41139a774d75643566f8 [file] [log] [blame]
Taniya Das2e948192011-12-20 11:15:13 +05301/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#include <linux/kernel.h>
14#include <linux/platform_device.h>
15#include <linux/dma-mapping.h>
Jordan Crouse914de9b2012-07-09 13:49:46 -060016#include <mach/kgsl.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070017#include <linux/regulator/machine.h>
Taniya Das2e948192011-12-20 11:15:13 +053018#include <linux/init.h>
Taniya Das43bcdd62011-12-02 17:33:27 +053019#include <linux/irq.h>
Taniya Das9d0c3c52012-05-04 14:40:55 +053020#include <linux/notifier.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070021#include <mach/irqs.h>
22#include <mach/msm_iomap.h>
23#include <mach/board.h>
24#include <mach/dma.h>
25#include <mach/dal_axi.h>
26#include <asm/mach/flash.h>
Taniya Das43bcdd62011-12-02 17:33:27 +053027#include <asm/hardware/gic.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070028#include <asm/hardware/cache-l2x0.h>
29#include <asm/mach/mmc.h>
Taniya Das9d0c3c52012-05-04 14:40:55 +053030#include <asm/cacheflush.h>
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070031#include <mach/rpc_hsusb.h>
32#include <mach/socinfo.h>
33
34#include "devices.h"
35#include "devices-msm7x2xa.h"
36#include "footswitch.h"
Matt Wagantall6d9ebee2011-08-26 12:15:24 -070037#include "acpuclock.h"
Murali Nalajala41786ab2012-03-06 10:47:32 +053038#include "spm.h"
Taniya Dasfcb35002012-03-09 15:28:12 +053039#include "mpm-8625.h"
Murali Nalajala2a0bbda2012-03-28 12:12:54 +053040#include "irq.h"
41#include "pm.h"
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070042
43/* Address of GSBI blocks */
44#define MSM_GSBI0_PHYS 0xA1200000
45#define MSM_GSBI1_PHYS 0xA1300000
46
47/* GSBI QUPe devices */
48#define MSM_GSBI0_QUP_PHYS (MSM_GSBI0_PHYS + 0x80000)
49#define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000)
50
51static struct resource gsbi0_qup_i2c_resources[] = {
52 {
53 .name = "qup_phys_addr",
54 .start = MSM_GSBI0_QUP_PHYS,
55 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
56 .flags = IORESOURCE_MEM,
57 },
58 {
59 .name = "gsbi_qup_i2c_addr",
60 .start = MSM_GSBI0_PHYS,
61 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
62 .flags = IORESOURCE_MEM,
63 },
64 {
65 .name = "qup_err_intr",
66 .start = INT_PWB_I2C,
67 .end = INT_PWB_I2C,
68 .flags = IORESOURCE_IRQ,
69 },
70};
71
72/* Use GSBI0 QUP for /dev/i2c-0 */
73struct platform_device msm_gsbi0_qup_i2c_device = {
74 .name = "qup_i2c",
75 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
76 .num_resources = ARRAY_SIZE(gsbi0_qup_i2c_resources),
77 .resource = gsbi0_qup_i2c_resources,
78};
79
80static struct resource gsbi1_qup_i2c_resources[] = {
81 {
82 .name = "qup_phys_addr",
83 .start = MSM_GSBI1_QUP_PHYS,
84 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
85 .flags = IORESOURCE_MEM,
86 },
87 {
88 .name = "gsbi_qup_i2c_addr",
89 .start = MSM_GSBI1_PHYS,
90 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
91 .flags = IORESOURCE_MEM,
92 },
93 {
94 .name = "qup_err_intr",
95 .start = INT_ARM11_DMA,
96 .end = INT_ARM11_DMA,
97 .flags = IORESOURCE_IRQ,
98 },
99};
100
101/* Use GSBI1 QUP for /dev/i2c-1 */
102struct platform_device msm_gsbi1_qup_i2c_device = {
103 .name = "qup_i2c",
104 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
105 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
106 .resource = gsbi1_qup_i2c_resources,
107};
108
109#define MSM_HSUSB_PHYS 0xA0800000
110static struct resource resources_hsusb_otg[] = {
111 {
112 .start = MSM_HSUSB_PHYS,
113 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
114 .flags = IORESOURCE_MEM,
115 },
116 {
117 .start = INT_USB_HS,
118 .end = INT_USB_HS,
119 .flags = IORESOURCE_IRQ,
120 },
121};
122
123static u64 dma_mask = 0xffffffffULL;
124struct platform_device msm_device_otg = {
125 .name = "msm_otg",
126 .id = -1,
127 .num_resources = ARRAY_SIZE(resources_hsusb_otg),
128 .resource = resources_hsusb_otg,
129 .dev = {
130 .dma_mask = &dma_mask,
131 .coherent_dma_mask = 0xffffffffULL,
132 },
133};
134
135static struct resource resources_gadget_peripheral[] = {
136 {
137 .start = MSM_HSUSB_PHYS,
138 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
139 .flags = IORESOURCE_MEM,
140 },
141 {
142 .start = INT_USB_HS,
143 .end = INT_USB_HS,
144 .flags = IORESOURCE_IRQ,
145 },
146};
147
148struct platform_device msm_device_gadget_peripheral = {
149 .name = "msm_hsusb",
150 .id = -1,
151 .num_resources = ARRAY_SIZE(resources_gadget_peripheral),
152 .resource = resources_gadget_peripheral,
153 .dev = {
154 .dma_mask = &dma_mask,
155 .coherent_dma_mask = 0xffffffffULL,
156 },
157};
158
159static struct resource resources_hsusb_host[] = {
160 {
161 .start = MSM_HSUSB_PHYS,
162 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
163 .flags = IORESOURCE_MEM,
164 },
165 {
166 .start = INT_USB_HS,
167 .end = INT_USB_HS,
168 .flags = IORESOURCE_IRQ,
169 },
170};
171
172struct platform_device msm_device_hsusb_host = {
173 .name = "msm_hsusb_host",
174 .id = 0,
175 .num_resources = ARRAY_SIZE(resources_hsusb_host),
176 .resource = resources_hsusb_host,
177 .dev = {
178 .dma_mask = &dma_mask,
179 .coherent_dma_mask = 0xffffffffULL,
180 },
181};
182
183static struct platform_device *msm_host_devices[] = {
184 &msm_device_hsusb_host,
185};
186
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700187static struct resource msm_dmov_resource[] = {
188 {
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700189 .start = INT_ADM_AARM,
190 .flags = IORESOURCE_IRQ,
191 },
192 {
193 .start = 0xA9700000,
194 .end = 0xA9700000 + SZ_4K - 1,
195 .flags = IORESOURCE_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700196 },
197};
198
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700199static struct msm_dmov_pdata msm_dmov_pdata = {
200 .sd = 3,
201 .sd_size = 0x400,
202};
203
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700204struct platform_device msm_device_dmov = {
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700205 .name = "msm_dmov",
206 .id = -1,
207 .resource = msm_dmov_resource,
208 .num_resources = ARRAY_SIZE(msm_dmov_resource),
209 .dev = {
210 .platform_data = &msm_dmov_pdata,
211 },
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700212};
213
Matt Wagantallbf430eb2012-03-22 11:45:49 -0700214static struct acpuclk_pdata msm7x27a_acpuclk_pdata = {
215 .max_speed_delta_khz = 400000,
216};
217
218struct platform_device msm7x27a_device_acpuclk = {
219 .name = "acpuclk-7627",
220 .id = -1,
221 .dev.platform_data = &msm7x27a_acpuclk_pdata,
222};
223
224static struct acpuclk_pdata msm7x27aa_acpuclk_pdata = {
225 .max_speed_delta_khz = 504000,
226};
227
228struct platform_device msm7x27aa_device_acpuclk = {
229 .name = "acpuclk-7627",
230 .id = -1,
231 .dev.platform_data = &msm7x27aa_acpuclk_pdata,
232};
233
234static struct acpuclk_pdata msm8625_acpuclk_pdata = {
235 /* TODO: Need to update speed delta from H/w Team */
236 .max_speed_delta_khz = 604800,
237};
238
Kaushal Kumar86473f02012-06-28 19:35:58 +0530239static struct acpuclk_pdata msm8625ab_acpuclk_pdata = {
240 .max_speed_delta_khz = 801600,
241};
242
Matt Wagantallbf430eb2012-03-22 11:45:49 -0700243struct platform_device msm8625_device_acpuclk = {
244 .name = "acpuclk-7627",
245 .id = -1,
246 .dev.platform_data = &msm8625_acpuclk_pdata,
247};
248
Kaushal Kumar86473f02012-06-28 19:35:58 +0530249struct platform_device msm8625ab_device_acpuclk = {
250 .name = "acpuclk-7627",
251 .id = -1,
252 .dev.platform_data = &msm8625ab_acpuclk_pdata,
253};
254
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700255struct platform_device msm_device_smd = {
256 .name = "msm_smd",
257 .id = -1,
258};
259
Angshuman Sarkarfb1cce92012-02-21 15:20:43 +0530260static struct resource smd_8625_resource[] = {
261 {
262 .name = "a9_m2a_0",
263 .start = MSM8625_INT_A9_M2A_0,
264 .flags = IORESOURCE_IRQ,
265 },
266 {
267 .name = "a9_m2a_5",
268 .start = MSM8625_INT_A9_M2A_5,
269 .flags = IORESOURCE_IRQ,
270 },
271};
272
273static struct smd_subsystem_config smd_8625_config_list[] = {
274 {
275 .irq_config_id = SMD_MODEM,
276 .subsys_name = "modem",
277 .edge = SMD_APPS_MODEM,
278
279 .smd_int.irq_name = "a9_m2a_0",
280 .smd_int.flags = IRQF_TRIGGER_RISING,
281 .smd_int.irq_id = -1,
282 .smd_int.device_name = "smd_dev",
283 .smd_int.dev_id = 0,
284
285 .smd_int.out_bit_pos = 1,
286 .smd_int.out_base = (void __iomem *)MSM_CSR_BASE,
287 .smd_int.out_offset = 0x400 + (0) * 4,
288
289 .smsm_int.irq_name = "a9_m2a_5",
290 .smsm_int.flags = IRQF_TRIGGER_RISING,
291 .smsm_int.irq_id = -1,
292 .smsm_int.device_name = "smsm_dev",
293 .smsm_int.dev_id = 0,
294
295 .smsm_int.out_bit_pos = 1,
296 .smsm_int.out_base = (void __iomem *)MSM_CSR_BASE,
297 .smsm_int.out_offset = 0x400 + (5) * 4,
298
299 }
300};
301
302static struct smd_platform smd_8625_platform_data = {
303 .num_ss_configs = ARRAY_SIZE(smd_8625_config_list),
304 .smd_ss_configs = smd_8625_config_list,
305};
306
307struct platform_device msm8625_device_smd = {
308 .name = "msm_smd",
309 .id = -1,
310 .resource = smd_8625_resource,
311 .num_resources = ARRAY_SIZE(smd_8625_resource),
312 .dev = {
313 .platform_data = &smd_8625_platform_data,
314 }
315};
316
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +0530317static struct resource resources_adsp[] = {
318 {
319 .start = INT_ADSP_A9_A11,
320 .end = INT_ADSP_A9_A11,
321 .flags = IORESOURCE_IRQ,
322 },
323};
324
325struct platform_device msm_adsp_device = {
326 .name = "msm_adsp",
327 .id = -1,
328 .num_resources = ARRAY_SIZE(resources_adsp),
329 .resource = resources_adsp,
330};
331
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700332static struct resource resources_uart1[] = {
333 {
334 .start = INT_UART1,
335 .end = INT_UART1,
336 .flags = IORESOURCE_IRQ,
337 },
338 {
Taniya Das13b811a2011-12-09 18:33:45 +0530339 .start = MSM7XXX_UART1_PHYS,
340 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700341 .flags = IORESOURCE_MEM,
342 },
343};
344
345struct platform_device msm_device_uart1 = {
346 .name = "msm_serial",
347 .id = 0,
348 .num_resources = ARRAY_SIZE(resources_uart1),
349 .resource = resources_uart1,
350};
351
352#define MSM_UART1DM_PHYS 0xA0200000
353static struct resource msm_uart1_dm_resources[] = {
354 {
355 .start = MSM_UART1DM_PHYS,
356 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
357 .flags = IORESOURCE_MEM,
358 },
359 {
360 .start = INT_UART1DM_IRQ,
361 .end = INT_UART1DM_IRQ,
362 .flags = IORESOURCE_IRQ,
363 },
364 {
365 .start = INT_UART1DM_RX,
366 .end = INT_UART1DM_RX,
367 .flags = IORESOURCE_IRQ,
368 },
369 {
370 .start = DMOV_HSUART1_TX_CHAN,
371 .end = DMOV_HSUART1_RX_CHAN,
372 .name = "uartdm_channels",
373 .flags = IORESOURCE_DMA,
374 },
375 {
376 .start = DMOV_HSUART1_TX_CRCI,
377 .end = DMOV_HSUART1_RX_CRCI,
378 .name = "uartdm_crci",
379 .flags = IORESOURCE_DMA,
380 },
381};
382
383static u64 msm_uart_dm1_dma_mask = DMA_BIT_MASK(32);
384struct platform_device msm_device_uart_dm1 = {
385 .name = "msm_serial_hs",
386 .id = 0,
387 .num_resources = ARRAY_SIZE(msm_uart1_dm_resources),
388 .resource = msm_uart1_dm_resources,
389 .dev = {
390 .dma_mask = &msm_uart_dm1_dma_mask,
391 .coherent_dma_mask = DMA_BIT_MASK(32),
392 },
393};
394
395#define MSM_UART2DM_PHYS 0xA0300000
396static struct resource msm_uart2dm_resources[] = {
397 {
398 .start = MSM_UART2DM_PHYS,
399 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
400 .name = "uartdm_resource",
401 .flags = IORESOURCE_MEM,
402 },
403 {
404 .start = INT_UART2DM_IRQ,
405 .end = INT_UART2DM_IRQ,
406 .flags = IORESOURCE_IRQ,
407 },
408};
409
410struct platform_device msm_device_uart_dm2 = {
411 .name = "msm_serial_hsl",
412 .id = 0,
413 .num_resources = ARRAY_SIZE(msm_uart2dm_resources),
414 .resource = msm_uart2dm_resources,
415};
416
417#define MSM_NAND_PHYS 0xA0A00000
418#define MSM_NANDC01_PHYS 0xA0A40000
419#define MSM_NANDC10_PHYS 0xA0A80000
420#define MSM_NANDC11_PHYS 0xA0AC0000
421#define EBI2_REG_BASE 0xA0D00000
422static struct resource resources_nand[] = {
423 [0] = {
424 .name = "msm_nand_dmac",
425 .start = DMOV_NAND_CHAN,
426 .end = DMOV_NAND_CHAN,
427 .flags = IORESOURCE_DMA,
428 },
429 [1] = {
430 .name = "msm_nand_phys",
431 .start = MSM_NAND_PHYS,
432 .end = MSM_NAND_PHYS + 0x7FF,
433 .flags = IORESOURCE_MEM,
434 },
435 [2] = {
436 .name = "msm_nandc01_phys",
437 .start = MSM_NANDC01_PHYS,
438 .end = MSM_NANDC01_PHYS + 0x7FF,
439 .flags = IORESOURCE_MEM,
440 },
441 [3] = {
442 .name = "msm_nandc10_phys",
443 .start = MSM_NANDC10_PHYS,
444 .end = MSM_NANDC10_PHYS + 0x7FF,
445 .flags = IORESOURCE_MEM,
446 },
447 [4] = {
448 .name = "msm_nandc11_phys",
449 .start = MSM_NANDC11_PHYS,
450 .end = MSM_NANDC11_PHYS + 0x7FF,
451 .flags = IORESOURCE_MEM,
452 },
453 [5] = {
454 .name = "ebi2_reg_base",
455 .start = EBI2_REG_BASE,
456 .end = EBI2_REG_BASE + 0x60,
457 .flags = IORESOURCE_MEM,
458 },
459};
460
Sujit Reddy Thummaec9b3252012-04-23 15:53:45 +0530461struct flash_platform_data msm_nand_data = {
462 .version = VERSION_2,
463};
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700464
465struct platform_device msm_device_nand = {
466 .name = "msm_nand",
467 .id = -1,
468 .num_resources = ARRAY_SIZE(resources_nand),
469 .resource = resources_nand,
470 .dev = {
471 .platform_data = &msm_nand_data,
472 },
473};
474
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530475static struct msm_pm_irq_calls msm7x27a_pm_irq_calls = {
476 .irq_pending = msm_irq_pending,
477 .idle_sleep_allowed = msm_irq_idle_sleep_allowed,
478 .enter_sleep1 = msm_irq_enter_sleep1,
479 .enter_sleep2 = msm_irq_enter_sleep2,
480 .exit_sleep1 = msm_irq_exit_sleep1,
481 .exit_sleep2 = msm_irq_exit_sleep2,
482 .exit_sleep3 = msm_irq_exit_sleep3,
483};
484
485static struct msm_pm_irq_calls msm8625_pm_irq_calls = {
486 .irq_pending = msm_gic_spi_ppi_pending,
487 .idle_sleep_allowed = msm_gic_irq_idle_sleep_allowed,
488 .enter_sleep1 = msm_gic_irq_enter_sleep1,
489 .enter_sleep2 = msm_gic_irq_enter_sleep2,
490 .exit_sleep1 = msm_gic_irq_exit_sleep1,
491 .exit_sleep2 = msm_gic_irq_exit_sleep2,
492 .exit_sleep3 = msm_gic_irq_exit_sleep3,
493};
494
Stephen Boyd986c9632012-04-24 16:31:45 -0700495void __init msm_pm_register_irqs(void)
Murali Nalajala2a0bbda2012-03-28 12:12:54 +0530496{
497 if (cpu_is_msm8625())
498 msm_pm_set_irq_extns(&msm8625_pm_irq_calls);
499 else
500 msm_pm_set_irq_extns(&msm7x27a_pm_irq_calls);
501
502}
503
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700504#define MSM_SDC1_BASE 0xA0400000
505#define MSM_SDC2_BASE 0xA0500000
506#define MSM_SDC3_BASE 0xA0600000
507#define MSM_SDC4_BASE 0xA0700000
508static struct resource resources_sdc1[] = {
509 {
510 .start = MSM_SDC1_BASE,
511 .end = MSM_SDC1_BASE + SZ_4K - 1,
512 .flags = IORESOURCE_MEM,
513 },
514 {
515 .start = INT_SDC1_0,
516 .end = INT_SDC1_1,
517 .flags = IORESOURCE_IRQ,
518 },
519 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700520 .name = "sdcc_dma_chnl",
521 .start = DMOV_SDC1_CHAN,
522 .end = DMOV_SDC1_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700523 .flags = IORESOURCE_DMA,
524 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700525 {
526 .name = "sdcc_dma_crci",
527 .start = DMOV_SDC1_CRCI,
528 .end = DMOV_SDC1_CRCI,
529 .flags = IORESOURCE_DMA,
530 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700531};
532
533static struct resource resources_sdc2[] = {
534 {
535 .start = MSM_SDC2_BASE,
536 .end = MSM_SDC2_BASE + SZ_4K - 1,
537 .flags = IORESOURCE_MEM,
538 },
539 {
540 .start = INT_SDC2_0,
541 .end = INT_SDC2_1,
542 .flags = IORESOURCE_IRQ,
543 },
544 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700545 .name = "sdcc_dma_chnl",
546 .start = DMOV_SDC2_CHAN,
547 .end = DMOV_SDC2_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700548 .flags = IORESOURCE_DMA,
549 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700550 {
551 .name = "sdcc_dma_crci",
552 .start = DMOV_SDC2_CRCI,
553 .end = DMOV_SDC2_CRCI,
554 .flags = IORESOURCE_DMA,
555 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700556};
557
558static struct resource resources_sdc3[] = {
559 {
560 .start = MSM_SDC3_BASE,
561 .end = MSM_SDC3_BASE + SZ_4K - 1,
562 .flags = IORESOURCE_MEM,
563 },
564 {
565 .start = INT_SDC3_0,
566 .end = INT_SDC3_1,
567 .flags = IORESOURCE_IRQ,
568 },
569 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700570 .name = "sdcc_dma_chnl",
Subhash Jadavanif29aefd2012-06-21 00:43:15 +0530571 .start = DMOV_NAND_CHAN,
572 .end = DMOV_NAND_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700573 .flags = IORESOURCE_DMA,
574 },
575 {
576 .name = "sdcc_dma_crci",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530577 .start = DMOV_SDC3_CRCI,
578 .end = DMOV_SDC3_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700579 .flags = IORESOURCE_DMA,
580 },
581};
582
583static struct resource resources_sdc4[] = {
584 {
585 .start = MSM_SDC4_BASE,
586 .end = MSM_SDC4_BASE + SZ_4K - 1,
587 .flags = IORESOURCE_MEM,
588 },
589 {
590 .start = INT_SDC4_0,
591 .end = INT_SDC4_1,
592 .flags = IORESOURCE_IRQ,
593 },
594 {
Krishna Konda25786ec2011-07-25 16:21:36 -0700595 .name = "sdcc_dma_chnl",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530596 .start = DMOV_SDC4_CHAN,
597 .end = DMOV_SDC4_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700598 .flags = IORESOURCE_DMA,
599 },
600 {
601 .name = "sdcc_dma_crci",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530602 .start = DMOV_SDC4_CRCI,
603 .end = DMOV_SDC4_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700604 .flags = IORESOURCE_DMA,
605 },
606};
607
608struct platform_device msm_device_sdc1 = {
609 .name = "msm_sdcc",
610 .id = 1,
611 .num_resources = ARRAY_SIZE(resources_sdc1),
612 .resource = resources_sdc1,
613 .dev = {
614 .coherent_dma_mask = 0xffffffff,
615 },
616};
617
618struct platform_device msm_device_sdc2 = {
619 .name = "msm_sdcc",
620 .id = 2,
621 .num_resources = ARRAY_SIZE(resources_sdc2),
622 .resource = resources_sdc2,
623 .dev = {
624 .coherent_dma_mask = 0xffffffff,
625 },
626};
627
628struct platform_device msm_device_sdc3 = {
629 .name = "msm_sdcc",
630 .id = 3,
631 .num_resources = ARRAY_SIZE(resources_sdc3),
632 .resource = resources_sdc3,
633 .dev = {
634 .coherent_dma_mask = 0xffffffff,
635 },
636};
637
638struct platform_device msm_device_sdc4 = {
639 .name = "msm_sdcc",
640 .id = 4,
641 .num_resources = ARRAY_SIZE(resources_sdc4),
642 .resource = resources_sdc4,
643 .dev = {
644 .coherent_dma_mask = 0xffffffff,
645 },
646};
647
648static struct platform_device *msm_sdcc_devices[] __initdata = {
649 &msm_device_sdc1,
650 &msm_device_sdc2,
651 &msm_device_sdc3,
652 &msm_device_sdc4,
653};
654
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530655#ifdef CONFIG_MSM_CAMERA_V4L2
Suresh Vankadara6050cef52012-04-16 21:44:59 +0530656static int apps_reset;
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530657static struct resource msm_csic0_resources[] = {
658 {
659 .name = "csic",
660 .start = 0xA0F00000,
661 .end = 0xA0F00000 + 0x00100000 - 1,
662 .flags = IORESOURCE_MEM,
663 },
664 {
665 .name = "csic",
666 .start = INT_CSI_IRQ_0,
667 .end = INT_CSI_IRQ_0,
668 .flags = IORESOURCE_IRQ,
669 },
670};
671
672static struct resource msm_csic1_resources[] = {
673 {
674 .name = "csic",
675 .start = 0xA1000000,
676 .end = 0xA1000000 + 0x00100000 - 1,
677 .flags = IORESOURCE_MEM,
678 },
679 {
680 .name = "csic",
681 .start = INT_CSI_IRQ_1,
682 .end = INT_CSI_IRQ_1,
683 .flags = IORESOURCE_IRQ,
684 },
685};
686
687struct platform_device msm7x27a_device_csic0 = {
688 .name = "msm_csic",
689 .id = 0,
690 .resource = msm_csic0_resources,
691 .num_resources = ARRAY_SIZE(msm_csic0_resources),
692};
693
694struct platform_device msm7x27a_device_csic1 = {
695 .name = "msm_csic",
696 .id = 1,
697 .resource = msm_csic1_resources,
698 .num_resources = ARRAY_SIZE(msm_csic1_resources),
699};
700
701static struct resource msm_clkctl_resources[] = {
702 {
703 .name = "clk_ctl",
Taniya Das13b811a2011-12-09 18:33:45 +0530704 .start = MSM7XXX_CLK_CTL_PHYS,
705 .end = MSM7XXX_CLK_CTL_PHYS + MSM7XXX_CLK_CTL_SIZE - 1,
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530706 .flags = IORESOURCE_MEM,
707 },
708};
709struct platform_device msm7x27a_device_clkctl = {
710 .name = "msm_clk_ctl",
711 .id = 0,
712 .resource = msm_clkctl_resources,
713 .num_resources = ARRAY_SIZE(msm_clkctl_resources),
Suresh Vankadara6050cef52012-04-16 21:44:59 +0530714 .dev = {
715 .platform_data = &apps_reset,
716 },
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530717};
718
719struct platform_device msm7x27a_device_vfe = {
720 .name = "msm_vfe",
721 .id = 0,
722};
723
724#endif
725
Murali Nalajala41786ab2012-03-06 10:47:32 +0530726/* Command sequence for simple WFI */
727static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Murali Nalajala2250a272012-03-13 15:56:59 +0530728 0x04, 0x03, 0x04, 0x0f,
Murali Nalajala41786ab2012-03-06 10:47:32 +0530729};
730
731/* Command sequence for GDFS, this won't send any interrupt to the modem */
732static uint8_t spm_pc_without_modem[] __initdata = {
733 0x20, 0x00, 0x30, 0x10,
Murali Nalajala2250a272012-03-13 15:56:59 +0530734 0x03, 0x1e, 0x0e, 0x3e,
735 0x4e, 0x4e, 0x4e, 0x4e,
736 0x4e, 0x4e, 0x4e, 0x4e,
737 0x4e, 0x4e, 0x4e, 0x4e,
738 0x4e, 0x4e, 0x4e, 0x4e,
739 0x2E, 0x0f,
Murali Nalajala41786ab2012-03-06 10:47:32 +0530740};
741
742static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
743 [0] = {
744 .mode = MSM_SPM_MODE_CLOCK_GATING,
745 .notify_rpm = false,
746 .cmd = spm_wfi_cmd_sequence,
747 },
748 [1] = {
749 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
750 .notify_rpm = false,
751 .cmd = spm_pc_without_modem,
752 },
753};
754
755static struct msm_spm_platform_data msm_spm_data[] __initdata = {
756 [0] = {
757 .reg_base_addr = MSM_SAW0_BASE,
758 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
759 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
760 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
761 .modes = msm_spm_seq_list,
762 },
763 [1] = {
764 .reg_base_addr = MSM_SAW1_BASE,
765 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
766 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
767 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
768 .modes = msm_spm_seq_list,
769 },
770};
771
772void __init msm8x25_spm_device_init(void)
773{
774 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
775}
776
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700777#define MDP_BASE 0xAA200000
778#define MIPI_DSI_HW_BASE 0xA1100000
779
780static struct resource msm_mipi_dsi_resources[] = {
781 {
782 .name = "mipi_dsi",
783 .start = MIPI_DSI_HW_BASE,
784 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
785 .flags = IORESOURCE_MEM,
786 },
787 {
788 .start = INT_DSI_IRQ,
789 .end = INT_DSI_IRQ,
790 .flags = IORESOURCE_IRQ,
791 },
792};
793
794static struct platform_device msm_mipi_dsi_device = {
795 .name = "mipi_dsi",
796 .id = 1,
797 .num_resources = ARRAY_SIZE(msm_mipi_dsi_resources),
798 .resource = msm_mipi_dsi_resources,
799};
800
801static struct resource msm_mdp_resources[] = {
802 {
803 .name = "mdp",
804 .start = MDP_BASE,
805 .end = MDP_BASE + 0x000F1008 - 1,
806 .flags = IORESOURCE_MEM,
807 },
808 {
809 .start = INT_MDP,
810 .end = INT_MDP,
811 .flags = IORESOURCE_IRQ,
812 },
813};
814
815static struct platform_device msm_mdp_device = {
816 .name = "mdp",
817 .id = 0,
818 .num_resources = ARRAY_SIZE(msm_mdp_resources),
819 .resource = msm_mdp_resources,
820};
821
822static struct platform_device msm_lcdc_device = {
823 .name = "lcdc",
824 .id = 0,
825};
826
827static struct resource kgsl_3d0_resources[] = {
828 {
829 .name = KGSL_3D0_REG_MEMORY,
830 .start = 0xA0000000,
831 .end = 0xA001ffff,
832 .flags = IORESOURCE_MEM,
833 },
834 {
835 .name = KGSL_3D0_IRQ,
836 .start = INT_GRAPHICS,
837 .end = INT_GRAPHICS,
838 .flags = IORESOURCE_IRQ,
839 },
840};
841
842static struct kgsl_device_platform_data kgsl_3d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600843 .pwrlevel = {
844 {
845 .gpu_freq = 245760000,
846 .bus_freq = 200000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700847 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600848 {
Lynus Vazeaf0aac2012-01-05 12:28:47 +0530849 .gpu_freq = 192000000,
850 .bus_freq = 160000000,
851 },
852 {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600853 .gpu_freq = 133330000,
854 .bus_freq = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700855 },
856 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600857 .init_level = 0,
Lynus Vazeaf0aac2012-01-05 12:28:47 +0530858 .num_levels = 3,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600859 .set_grp_async = set_grp_xbar_async,
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700860 .idle_timeout = HZ,
Lynus Vazfe4bede2012-04-06 11:53:30 -0700861 .strtstp_sleepwake = true,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600862 .nap_allowed = false,
863 .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700864};
865
866struct platform_device msm_kgsl_3d0 = {
867 .name = "kgsl-3d0",
868 .id = 0,
869 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
870 .resource = kgsl_3d0_resources,
871 .dev = {
872 .platform_data = &kgsl_3d0_pdata,
873 },
874};
875
876void __init msm7x25a_kgsl_3d0_init(void)
877{
Pankaj Kumarfee56a82012-04-17 14:26:49 +0530878 if (cpu_is_msm7x25a() || cpu_is_msm7x25aa() || cpu_is_msm7x25ab()) {
Lynus Vaz971610e2012-01-06 11:00:32 +0530879 kgsl_3d0_pdata.num_levels = 2;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600880 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 133330000;
881 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 160000000;
882 kgsl_3d0_pdata.pwrlevel[1].gpu_freq = 96000000;
883 kgsl_3d0_pdata.pwrlevel[1].bus_freq = 0;
Rajesh Kemisettidf6e62f2012-03-12 14:02:30 +0530884 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700885}
886
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700887void __init msm8x25_kgsl_3d0_init(void)
888{
Lynus Vazfe4bede2012-04-06 11:53:30 -0700889 if (cpu_is_msm8625()) {
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700890 kgsl_3d0_pdata.idle_timeout = HZ/5;
Lynus Vazfe4bede2012-04-06 11:53:30 -0700891 kgsl_3d0_pdata.strtstp_sleepwake = false;
Ranjhith Kalisamy24696322012-04-11 22:09:17 +0530892 /* 8x25 supports a higher GPU frequency */
893 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 300000000;
894 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 200000000;
Lynus Vazfe4bede2012-04-06 11:53:30 -0700895 }
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700896}
897
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700898static void __init msm_register_device(struct platform_device *pdev, void *data)
899{
900 int ret;
901
902 pdev->dev.platform_data = data;
903
904 ret = platform_device_register(pdev);
905
906 if (ret)
907 dev_err(&pdev->dev,
908 "%s: platform_device_register() failed = %d\n",
909 __func__, ret);
910}
911
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700912
913#define PERPH_WEB_BLOCK_ADDR (0xA9D00040)
914#define PDM0_CTL_OFFSET (0x04)
915#define SIZE_8B (0x08)
916
917static struct resource resources_led[] = {
918 {
919 .start = PERPH_WEB_BLOCK_ADDR,
920 .end = PERPH_WEB_BLOCK_ADDR + (SIZE_8B) - 1,
921 .name = "led-gpio-pdm",
922 .flags = IORESOURCE_MEM,
923 },
924};
925
926static struct led_info msm_kpbl_pdm_led_pdata = {
927 .name = "keyboard-backlight",
928};
929
930struct platform_device led_pdev = {
931 .name = "leds-msm-pdm",
932 /* use pdev id to represent pdm id */
933 .id = 0,
934 .num_resources = ARRAY_SIZE(resources_led),
935 .resource = resources_led,
936 .dev = {
937 .platform_data = &msm_kpbl_pdm_led_pdata,
938 },
939};
940
Manish Dewangan3a260992011-06-24 18:01:34 +0530941struct platform_device asoc_msm_pcm = {
942 .name = "msm-dsp-audio",
943 .id = 0,
944};
945
946struct platform_device asoc_msm_dai0 = {
947 .name = "msm-codec-dai",
948 .id = 0,
949};
950
951struct platform_device asoc_msm_dai1 = {
952 .name = "msm-cpu-dai",
953 .id = 0,
954};
955
Taniya Das2e948192011-12-20 11:15:13 +0530956static struct resource gpio_resources[] = {
957 {
958 .start = INT_GPIO_GROUP1,
959 .flags = IORESOURCE_IRQ,
960 },
961 {
962 .start = INT_GPIO_GROUP2,
963 .flags = IORESOURCE_IRQ,
964 },
965};
966
967static struct platform_device msm_device_gpio = {
968 .name = "msmgpio",
969 .id = -1,
970 .resource = gpio_resources,
971 .num_resources = ARRAY_SIZE(gpio_resources),
972};
973
Taniya Das43bcdd62011-12-02 17:33:27 +0530974struct platform_device *msm_footswitch_devices[] = {
Matt Wagantalld6fbf232012-05-03 20:09:28 -0700975 FS_PCOM(FS_GFX3D, "vdd", "kgsl-3d0.0"),
Taniya Das43bcdd62011-12-02 17:33:27 +0530976};
977unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);
978
979/* MSM8625 Devices */
980
981static struct resource msm8625_resources_uart1[] = {
982 {
983 .start = MSM8625_INT_UART1,
984 .end = MSM8625_INT_UART1,
985 .flags = IORESOURCE_IRQ,
986 },
987 {
Taniya Das13b811a2011-12-09 18:33:45 +0530988 .start = MSM7XXX_UART1_PHYS,
989 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Taniya Das43bcdd62011-12-02 17:33:27 +0530990 .flags = IORESOURCE_MEM,
991 },
992};
993
994struct platform_device msm8625_device_uart1 = {
995 .name = "msm_serial",
996 .id = 0,
997 .num_resources = ARRAY_SIZE(msm8625_resources_uart1),
998 .resource = msm8625_resources_uart1,
999};
1000
Trilok Soni269fff42012-02-13 20:35:30 +05301001static struct resource msm8625_uart1_dm_resources[] = {
1002 {
1003 .start = MSM_UART1DM_PHYS,
1004 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
1005 .flags = IORESOURCE_MEM,
1006 },
1007 {
1008 .start = MSM8625_INT_UART1DM_IRQ,
1009 .end = MSM8625_INT_UART1DM_IRQ,
1010 .flags = IORESOURCE_IRQ,
1011 },
1012 {
1013 .start = MSM8625_INT_UART1DM_RX,
1014 .end = MSM8625_INT_UART1DM_RX,
1015 .flags = IORESOURCE_IRQ,
1016 },
1017 {
1018 .start = DMOV_HSUART1_TX_CHAN,
1019 .end = DMOV_HSUART1_RX_CHAN,
1020 .name = "uartdm_channels",
1021 .flags = IORESOURCE_DMA,
1022 },
1023 {
1024 .start = DMOV_HSUART1_TX_CRCI,
1025 .end = DMOV_HSUART1_RX_CRCI,
1026 .name = "uartdm_crci",
1027 .flags = IORESOURCE_DMA,
1028 },
1029};
1030
1031struct platform_device msm8625_device_uart_dm1 = {
1032 .name = "msm_serial_hs",
1033 .id = 0,
1034 .num_resources = ARRAY_SIZE(msm8625_uart1_dm_resources),
1035 .resource = msm8625_uart1_dm_resources,
1036 .dev = {
1037 .dma_mask = &msm_uart_dm1_dma_mask,
1038 .coherent_dma_mask = DMA_BIT_MASK(32),
1039 },
1040};
1041
1042static struct resource msm8625_uart2dm_resources[] = {
1043 {
1044 .start = MSM_UART2DM_PHYS,
1045 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
1046 .name = "uartdm_resource",
1047 .flags = IORESOURCE_MEM,
1048 },
1049 {
1050 .start = MSM8625_INT_UART2DM_IRQ,
1051 .end = MSM8625_INT_UART2DM_IRQ,
1052 .flags = IORESOURCE_IRQ,
1053 },
1054};
1055
1056struct platform_device msm8625_device_uart_dm2 = {
1057 .name = "msm_serial_hsl",
1058 .id = 0,
1059 .num_resources = ARRAY_SIZE(msm8625_uart2dm_resources),
1060 .resource = msm8625_uart2dm_resources,
1061};
1062
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +05301063static struct resource msm8625_resources_adsp[] = {
1064 {
1065 .start = MSM8625_INT_ADSP_A9_A11,
1066 .end = MSM8625_INT_ADSP_A9_A11,
1067 .flags = IORESOURCE_IRQ,
1068 },
1069};
1070
1071struct platform_device msm8625_device_adsp = {
1072 .name = "msm_adsp",
1073 .id = -1,
1074 .num_resources = ARRAY_SIZE(msm8625_resources_adsp),
1075 .resource = msm8625_resources_adsp,
1076};
1077
Taniya Das43bcdd62011-12-02 17:33:27 +05301078static struct resource msm8625_dmov_resource[] = {
1079 {
1080 .start = MSM8625_INT_ADM_AARM,
1081 .flags = IORESOURCE_IRQ,
1082 },
1083 {
1084 .start = 0xA9700000,
1085 .end = 0xA9700000 + SZ_4K - 1,
1086 .flags = IORESOURCE_MEM,
1087 },
1088};
1089
1090struct platform_device msm8625_device_dmov = {
1091 .name = "msm_dmov",
1092 .id = -1,
1093 .resource = msm8625_dmov_resource,
1094 .num_resources = ARRAY_SIZE(msm8625_dmov_resource),
1095 .dev = {
1096 .platform_data = &msm_dmov_pdata,
1097 },
1098};
Taniya Das2e948192011-12-20 11:15:13 +05301099
Taniya Das9d187142011-12-02 15:53:25 +05301100static struct resource gsbi0_msm8625_qup_resources[] = {
1101 {
1102 .name = "qup_phys_addr",
1103 .start = MSM_GSBI0_QUP_PHYS,
1104 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
1105 .flags = IORESOURCE_MEM,
1106 },
1107 {
1108 .name = "gsbi_qup_i2c_addr",
1109 .start = MSM_GSBI0_PHYS,
1110 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
1111 .flags = IORESOURCE_MEM,
1112 },
1113 {
1114 .name = "qup_err_intr",
1115 .start = MSM8625_INT_PWB_I2C,
1116 .end = MSM8625_INT_PWB_I2C,
1117 .flags = IORESOURCE_IRQ,
1118 },
1119};
1120
1121/* Use GSBI0 QUP for /dev/i2c-0 */
Taniya Dase3027e22012-02-27 16:32:27 +05301122struct platform_device msm8625_gsbi0_qup_i2c_device = {
Taniya Das9d187142011-12-02 15:53:25 +05301123 .name = "qup_i2c",
1124 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
1125 .num_resources = ARRAY_SIZE(gsbi0_msm8625_qup_resources),
1126 .resource = gsbi0_msm8625_qup_resources,
1127};
1128
Trilok Soni633e59c2012-02-13 20:28:30 +05301129static struct resource gsbi1_msm8625_qup_i2c_resources[] = {
1130 {
1131 .name = "qup_phys_addr",
1132 .start = MSM_GSBI1_QUP_PHYS,
1133 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
1134 .flags = IORESOURCE_MEM,
1135 },
1136 {
1137 .name = "gsbi_qup_i2c_addr",
1138 .start = MSM_GSBI1_PHYS,
1139 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
1140 .flags = IORESOURCE_MEM,
1141 },
1142 {
1143 .name = "qup_err_intr",
1144 .start = MSM8625_INT_ARM11_DMA,
1145 .end = MSM8625_INT_ARM11_DMA,
1146 .flags = IORESOURCE_IRQ,
1147 },
1148};
1149
1150/* Use GSBI1 QUP for /dev/i2c-1 */
Taniya Dase3027e22012-02-27 16:32:27 +05301151struct platform_device msm8625_gsbi1_qup_i2c_device = {
Trilok Soni633e59c2012-02-13 20:28:30 +05301152 .name = "qup_i2c",
1153 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
1154 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
1155 .resource = gsbi1_msm8625_qup_i2c_resources,
1156};
1157
Taniya Das6684d622012-01-12 10:29:09 +05301158static struct resource msm8625_gpio_resources[] = {
1159 {
1160 .start = MSM8625_INT_GPIO_GROUP1,
1161 .flags = IORESOURCE_IRQ,
1162 },
1163 {
1164 .start = MSM8625_INT_GPIO_GROUP2,
1165 .flags = IORESOURCE_IRQ,
1166 },
1167};
1168
1169static struct platform_device msm8625_device_gpio = {
1170 .name = "msmgpio",
1171 .id = -1,
1172 .resource = msm8625_gpio_resources,
1173 .num_resources = ARRAY_SIZE(msm8625_gpio_resources),
1174};
1175
Trilok Soniee75f6c2012-02-13 20:45:07 +05301176static struct resource msm8625_resources_sdc1[] = {
1177 {
1178 .start = MSM_SDC1_BASE,
1179 .end = MSM_SDC1_BASE + SZ_4K - 1,
1180 .flags = IORESOURCE_MEM,
1181 },
1182 {
1183 .start = MSM8625_INT_SDC1_0,
1184 .end = MSM8625_INT_SDC1_1,
1185 .flags = IORESOURCE_IRQ,
1186 },
1187 {
1188 .name = "sdcc_dma_chnl",
1189 .start = DMOV_SDC1_CHAN,
1190 .end = DMOV_SDC1_CHAN,
1191 .flags = IORESOURCE_DMA,
1192 },
1193 {
1194 .name = "sdcc_dma_crci",
1195 .start = DMOV_SDC1_CRCI,
1196 .end = DMOV_SDC1_CRCI,
1197 .flags = IORESOURCE_DMA,
1198 }
1199};
1200
1201static struct resource msm8625_resources_sdc2[] = {
1202 {
1203 .start = MSM_SDC2_BASE,
1204 .end = MSM_SDC2_BASE + SZ_4K - 1,
1205 .flags = IORESOURCE_MEM,
1206 },
1207 {
1208 .start = MSM8625_INT_SDC2_0,
1209 .end = MSM8625_INT_SDC2_1,
1210 .flags = IORESOURCE_IRQ,
1211 },
1212 {
1213 .name = "sdcc_dma_chnl",
1214 .start = DMOV_SDC2_CHAN,
1215 .end = DMOV_SDC2_CHAN,
1216 .flags = IORESOURCE_DMA,
1217 },
1218 {
1219 .name = "sdcc_dma_crci",
1220 .start = DMOV_SDC2_CRCI,
1221 .end = DMOV_SDC2_CRCI,
1222 .flags = IORESOURCE_DMA,
1223 }
1224};
1225
1226static struct resource msm8625_resources_sdc3[] = {
1227 {
1228 .start = MSM_SDC3_BASE,
1229 .end = MSM_SDC3_BASE + SZ_4K - 1,
1230 .flags = IORESOURCE_MEM,
1231 },
1232 {
1233 .start = MSM8625_INT_SDC3_0,
1234 .end = MSM8625_INT_SDC3_1,
1235 .flags = IORESOURCE_IRQ,
1236 },
1237 {
1238 .name = "sdcc_dma_chnl",
1239 .start = DMOV_SDC3_CHAN,
1240 .end = DMOV_SDC3_CHAN,
1241 .flags = IORESOURCE_DMA,
1242 },
1243 {
1244 .name = "sdcc_dma_crci",
1245 .start = DMOV_SDC3_CRCI,
1246 .end = DMOV_SDC3_CRCI,
1247 .flags = IORESOURCE_DMA,
1248 },
1249};
1250
1251static struct resource msm8625_resources_sdc4[] = {
1252 {
1253 .start = MSM_SDC4_BASE,
1254 .end = MSM_SDC4_BASE + SZ_4K - 1,
1255 .flags = IORESOURCE_MEM,
1256 },
1257 {
1258 .start = MSM8625_INT_SDC4_0,
1259 .end = MSM8625_INT_SDC4_1,
1260 .flags = IORESOURCE_IRQ,
1261 },
1262 {
1263 .name = "sdcc_dma_chnl",
1264 .start = DMOV_SDC4_CHAN,
1265 .end = DMOV_SDC4_CHAN,
1266 .flags = IORESOURCE_DMA,
1267 },
1268 {
1269 .name = "sdcc_dma_crci",
1270 .start = DMOV_SDC4_CRCI,
1271 .end = DMOV_SDC4_CRCI,
1272 .flags = IORESOURCE_DMA,
1273 },
1274};
1275
1276struct platform_device msm8625_device_sdc1 = {
1277 .name = "msm_sdcc",
1278 .id = 1,
1279 .num_resources = ARRAY_SIZE(msm8625_resources_sdc1),
1280 .resource = msm8625_resources_sdc1,
1281 .dev = {
1282 .coherent_dma_mask = 0xffffffff,
1283 },
1284};
1285
1286struct platform_device msm8625_device_sdc2 = {
1287 .name = "msm_sdcc",
1288 .id = 2,
1289 .num_resources = ARRAY_SIZE(msm8625_resources_sdc2),
1290 .resource = msm8625_resources_sdc2,
1291 .dev = {
1292 .coherent_dma_mask = 0xffffffff,
1293 },
1294};
1295
1296struct platform_device msm8625_device_sdc3 = {
1297 .name = "msm_sdcc",
1298 .id = 3,
1299 .num_resources = ARRAY_SIZE(msm8625_resources_sdc3),
1300 .resource = msm8625_resources_sdc3,
1301 .dev = {
1302 .coherent_dma_mask = 0xffffffff,
1303 },
1304};
1305
1306struct platform_device msm8625_device_sdc4 = {
1307 .name = "msm_sdcc",
1308 .id = 4,
1309 .num_resources = ARRAY_SIZE(msm8625_resources_sdc4),
1310 .resource = msm8625_resources_sdc4,
1311 .dev = {
1312 .coherent_dma_mask = 0xffffffff,
1313 },
1314};
1315
1316static struct platform_device *msm8625_sdcc_devices[] __initdata = {
1317 &msm8625_device_sdc1,
1318 &msm8625_device_sdc2,
1319 &msm8625_device_sdc3,
1320 &msm8625_device_sdc4,
1321};
1322
1323int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
1324{
1325 struct platform_device *pdev;
1326
1327 if (controller < 1 || controller > 4)
1328 return -EINVAL;
1329
1330 if (cpu_is_msm8625())
1331 pdev = msm8625_sdcc_devices[controller-1];
1332 else
1333 pdev = msm_sdcc_devices[controller-1];
1334
1335 pdev->dev.platform_data = plat;
1336 return platform_device_register(pdev);
1337}
1338
Trilok Sonida63a8b2012-02-13 20:50:03 +05301339static struct resource msm8625_resources_hsusb_otg[] = {
1340 {
1341 .start = MSM_HSUSB_PHYS,
1342 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1343 .flags = IORESOURCE_MEM,
1344 },
1345 {
1346 .start = MSM8625_INT_USB_HS,
1347 .end = MSM8625_INT_USB_HS,
1348 .flags = IORESOURCE_IRQ,
1349 },
1350};
1351
1352struct platform_device msm8625_device_otg = {
1353 .name = "msm_otg",
1354 .id = -1,
1355 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_otg),
1356 .resource = msm8625_resources_hsusb_otg,
1357 .dev = {
1358 .dma_mask = &dma_mask,
1359 .coherent_dma_mask = 0xffffffffULL,
1360 },
1361};
1362
1363static struct resource msm8625_resources_gadget_peripheral[] = {
1364 {
1365 .start = MSM_HSUSB_PHYS,
1366 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1367 .flags = IORESOURCE_MEM,
1368 },
1369 {
1370 .start = MSM8625_INT_USB_HS,
1371 .end = MSM8625_INT_USB_HS,
1372 .flags = IORESOURCE_IRQ,
1373 },
1374};
1375
1376struct platform_device msm8625_device_gadget_peripheral = {
1377 .name = "msm_hsusb",
1378 .id = -1,
1379 .num_resources = ARRAY_SIZE(msm8625_resources_gadget_peripheral),
1380 .resource = msm8625_resources_gadget_peripheral,
1381 .dev = {
1382 .dma_mask = &dma_mask,
1383 .coherent_dma_mask = 0xffffffffULL,
1384 },
1385};
1386
1387static struct resource msm8625_resources_hsusb_host[] = {
1388 {
1389 .start = MSM_HSUSB_PHYS,
1390 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1391 .flags = IORESOURCE_MEM,
1392 },
1393 {
1394 .start = MSM8625_INT_USB_HS,
1395 .end = MSM8625_INT_USB_HS,
1396 .flags = IORESOURCE_IRQ,
1397 },
1398};
1399
1400struct platform_device msm8625_device_hsusb_host = {
1401 .name = "msm_hsusb_host",
1402 .id = 0,
1403 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_host),
1404 .resource = msm8625_resources_hsusb_host,
1405 .dev = {
1406 .dma_mask = &dma_mask,
1407 .coherent_dma_mask = 0xffffffffULL,
1408 },
1409};
1410
1411static struct platform_device *msm8625_host_devices[] = {
1412 &msm8625_device_hsusb_host,
1413};
1414
1415int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
1416{
1417 struct platform_device *pdev;
1418
1419 if (cpu_is_msm8625())
1420 pdev = msm8625_host_devices[host];
1421 else
1422 pdev = msm_host_devices[host];
1423 if (!pdev)
1424 return -ENODEV;
1425 pdev->dev.platform_data = plat;
1426 return platform_device_register(pdev);
1427}
1428
Trilok Soni88da2552012-02-13 21:01:24 +05301429#ifdef CONFIG_MSM_CAMERA_V4L2
1430static struct resource msm8625_csic0_resources[] = {
1431 {
1432 .name = "csic",
1433 .start = 0xA0F00000,
1434 .end = 0xA0F00000 + 0x00100000 - 1,
1435 .flags = IORESOURCE_MEM,
1436 },
1437 {
1438 .name = "csic",
1439 .start = MSM8625_INT_CSI_IRQ_0,
1440 .end = MSM8625_INT_CSI_IRQ_0,
1441 .flags = IORESOURCE_IRQ,
1442 },
1443};
1444
1445static struct resource msm8625_csic1_resources[] = {
1446 {
1447 .name = "csic",
1448 .start = 0xA1000000,
1449 .end = 0xA1000000 + 0x00100000 - 1,
1450 .flags = IORESOURCE_MEM,
1451 },
1452 {
1453 .name = "csic",
1454 .start = MSM8625_INT_CSI_IRQ_1,
1455 .end = MSM8625_INT_CSI_IRQ_1,
1456 .flags = IORESOURCE_IRQ,
1457 },
1458};
1459
1460struct platform_device msm8625_device_csic0 = {
1461 .name = "msm_csic",
1462 .id = 0,
1463 .resource = msm8625_csic0_resources,
1464 .num_resources = ARRAY_SIZE(msm8625_csic0_resources),
1465};
1466
1467struct platform_device msm8625_device_csic1 = {
1468 .name = "msm_csic",
1469 .id = 1,
1470 .resource = msm8625_csic1_resources,
1471 .num_resources = ARRAY_SIZE(msm8625_csic1_resources),
1472};
1473#endif
1474
Trilok Soniae4633d2012-02-13 21:08:32 +05301475static struct resource msm8625_mipi_dsi_resources[] = {
1476 {
1477 .name = "mipi_dsi",
1478 .start = MIPI_DSI_HW_BASE,
1479 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
1480 .flags = IORESOURCE_MEM,
1481 },
1482 {
1483 .start = MSM8625_INT_DSI_IRQ,
1484 .end = MSM8625_INT_DSI_IRQ,
1485 .flags = IORESOURCE_IRQ,
1486 },
1487};
1488
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301489static struct platform_device msm8625_mipi_dsi_device = {
Trilok Soniae4633d2012-02-13 21:08:32 +05301490 .name = "mipi_dsi",
1491 .id = 1,
1492 .num_resources = ARRAY_SIZE(msm8625_mipi_dsi_resources),
1493 .resource = msm8625_mipi_dsi_resources,
1494};
1495
1496static struct resource msm8625_mdp_resources[] = {
1497 {
1498 .name = "mdp",
1499 .start = MDP_BASE,
1500 .end = MDP_BASE + 0x000F1008 - 1,
1501 .flags = IORESOURCE_MEM,
1502 },
1503 {
1504 .start = MSM8625_INT_MDP,
1505 .end = MSM8625_INT_MDP,
1506 .flags = IORESOURCE_IRQ,
1507 },
1508};
1509
1510static struct platform_device msm8625_mdp_device = {
1511 .name = "mdp",
1512 .id = 0,
1513 .num_resources = ARRAY_SIZE(msm8625_mdp_resources),
1514 .resource = msm8625_mdp_resources,
1515};
1516
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301517struct platform_device mipi_dsi_device;
1518
Trilok Soniae4633d2012-02-13 21:08:32 +05301519void __init msm_fb_register_device(char *name, void *data)
1520{
1521 if (!strncmp(name, "mdp", 3)) {
1522 if (cpu_is_msm8625())
1523 msm_register_device(&msm8625_mdp_device, data);
1524 else
1525 msm_register_device(&msm_mdp_device, data);
1526 } else if (!strncmp(name, "mipi_dsi", 8)) {
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301527 if (cpu_is_msm8625()) {
Trilok Soniae4633d2012-02-13 21:08:32 +05301528 msm_register_device(&msm8625_mipi_dsi_device, data);
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301529 mipi_dsi_device = msm8625_mipi_dsi_device;
1530 } else {
Trilok Soniae4633d2012-02-13 21:08:32 +05301531 msm_register_device(&msm_mipi_dsi_device, data);
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301532 mipi_dsi_device = msm_mipi_dsi_device;
1533 }
Trilok Soniae4633d2012-02-13 21:08:32 +05301534 } else if (!strncmp(name, "lcdc", 4)) {
1535 msm_register_device(&msm_lcdc_device, data);
1536 } else {
1537 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
1538 }
1539}
1540
Trilok Soni664b95d2012-02-13 21:13:15 +05301541static struct resource msm8625_kgsl_3d0_resources[] = {
1542 {
1543 .name = KGSL_3D0_REG_MEMORY,
1544 .start = 0xA0000000,
1545 .end = 0xA001ffff,
1546 .flags = IORESOURCE_MEM,
1547 },
1548 {
1549 .name = KGSL_3D0_IRQ,
1550 .start = MSM8625_INT_GRAPHICS,
1551 .end = MSM8625_INT_GRAPHICS,
1552 .flags = IORESOURCE_IRQ,
1553 },
1554};
1555
1556struct platform_device msm8625_kgsl_3d0 = {
1557 .name = "kgsl-3d0",
1558 .id = 0,
1559 .num_resources = ARRAY_SIZE(msm8625_kgsl_3d0_resources),
1560 .resource = msm8625_kgsl_3d0_resources,
1561 .dev = {
1562 .platform_data = &kgsl_3d0_pdata,
1563 },
1564};
1565
Taniya Das7c9f0512011-12-02 14:26:46 +05301566static struct clk_lookup msm_clock_8625_dummy[] = {
1567 CLK_DUMMY("core_clk", adm_clk.c, "msm_dmov", 0),
1568 CLK_DUMMY("adsp_clk", adsp_clk.c, NULL, 0),
1569 CLK_DUMMY("ahb_m_clk", ahb_m_clk.c, NULL, 0),
1570 CLK_DUMMY("ahb_s_clk", ahb_s_clk.c, NULL, 0),
1571 CLK_DUMMY("cam_m_clk", cam_m_clk.c, NULL, 0),
1572 CLK_DUMMY("csi_clk", csi1_clk.c, NULL, 0),
1573 CLK_DUMMY("csi_pclk", csi1_p_clk.c, NULL, 0),
1574 CLK_DUMMY("csi_vfe_clk", csi1_vfe_clk.c, NULL, 0),
1575 CLK_DUMMY("dsi_byte_clk", dsi_byte_clk.c, NULL, 0),
1576 CLK_DUMMY("dsi_clk", dsi_clk.c, NULL, 0),
1577 CLK_DUMMY("dsi_esc_clk", dsi_esc_clk.c, NULL, 0),
1578 CLK_DUMMY("dsi_pixel_clk", dsi_pixel_clk.c, NULL, 0),
1579 CLK_DUMMY("dsi_ref_clk", dsi_ref_clk.c, NULL, 0),
1580 CLK_DUMMY("ebi1_clk", ebi1_clk.c, NULL, 0),
1581 CLK_DUMMY("ebi2_clk", ebi2_clk.c, NULL, 0),
1582 CLK_DUMMY("ecodec_clk", ecodec_clk.c, NULL, 0),
1583 CLK_DUMMY("gp_clk", gp_clk.c, NULL, 0),
1584 CLK_DUMMY("core_clk", gsbi1_qup_clk.c, "qup_i2c.0", 0),
1585 CLK_DUMMY("core_clk", gsbi2_qup_clk.c, "qup_i2c.1", 0),
1586 CLK_DUMMY("iface_clk", gsbi1_qup_p_clk.c, "qup_i2c.0", 0),
1587 CLK_DUMMY("iface_clk", gsbi2_qup_p_clk.c, "qup_i2c.1", 0),
1588 CLK_DUMMY("icodec_rx_clk", icodec_rx_clk.c, NULL, 0),
1589 CLK_DUMMY("icodec_tx_clk", icodec_tx_clk.c, NULL, 0),
1590 CLK_DUMMY("mem_clk", imem_clk.c, NULL, 0),
1591 CLK_DUMMY("mddi_clk", pmdh_clk.c, NULL, 0),
1592 CLK_DUMMY("mdp_clk", mdp_clk.c, NULL, 0),
1593 CLK_DUMMY("mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk.c, NULL, 0),
1594 CLK_DUMMY("mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk.c, NULL, 0),
1595 CLK_DUMMY("mdp_vsync_clk", mdp_vsync_clk.c, NULL, 0),
1596 CLK_DUMMY("mdp_dsi_pclk", mdp_dsi_p_clk.c, NULL, 0),
1597 CLK_DUMMY("pbus_clk", pbus_clk.c, NULL, 0),
1598 CLK_DUMMY("pcm_clk", pcm_clk.c, NULL, 0),
1599 CLK_DUMMY("sdac_clk", sdac_clk.c, NULL, 0),
1600 CLK_DUMMY("core_clk", sdc1_clk.c, "msm_sdcc.1", 0),
1601 CLK_DUMMY("iface_clk", sdc1_p_clk.c, "msm_sdcc.1", 0),
1602 CLK_DUMMY("core_clk", sdc2_clk.c, "msm_sdcc.2", 0),
1603 CLK_DUMMY("iface_clk", sdc2_p_clk.c, "msm_sdcc.2", 0),
1604 CLK_DUMMY("core_clk", sdc3_clk.c, "msm_sdcc.3", 0),
1605 CLK_DUMMY("iface_clk", sdc3_p_clk.c, "msm_sdcc.3", 0),
1606 CLK_DUMMY("core_clk", sdc4_clk.c, "msm_sdcc.4", 0),
1607 CLK_DUMMY("iface_clk", sdc4_p_clk.c, "msm_sdcc.4", 0),
1608 CLK_DUMMY("ref_clk", tsif_ref_clk.c, "msm_tsif.0", 0),
1609 CLK_DUMMY("iface_clk", tsif_p_clk.c, "msm_tsif.0", 0),
1610 CLK_DUMMY("core_clk", uart1_clk.c, "msm_serial.0", 0),
1611 CLK_DUMMY("core_clk", uart2_clk.c, "msm_serial.1", 0),
1612 CLK_DUMMY("core_clk", uart1dm_clk.c, "msm_serial_hs.0", 0),
1613 CLK_DUMMY("core_clk", uart2dm_clk.c, "msm_serial_hsl.0", 0),
1614 CLK_DUMMY("usb_hs_core_clk", usb_hs_core_clk.c, NULL, 0),
1615 CLK_DUMMY("usb_hs2_clk", usb_hs2_clk.c, NULL, 0),
1616 CLK_DUMMY("usb_hs_clk", usb_hs_clk.c, NULL, 0),
1617 CLK_DUMMY("usb_hs_pclk", usb_hs_p_clk.c, NULL, 0),
1618 CLK_DUMMY("usb_phy_clk", usb_phy_clk.c, NULL, 0),
1619 CLK_DUMMY("vdc_clk", vdc_clk.c, NULL, 0),
1620 CLK_DUMMY("ebi1_acpu_clk", ebi_acpu_clk.c, NULL, 0),
1621 CLK_DUMMY("ebi1_lcdc_clk", ebi_lcdc_clk.c, NULL, 0),
1622 CLK_DUMMY("ebi1_mddi_clk", ebi_mddi_clk.c, NULL, 0),
1623 CLK_DUMMY("ebi1_usb_clk", ebi_usb_clk.c, NULL, 0),
1624 CLK_DUMMY("ebi1_vfe_clk", ebi_vfe_clk.c, NULL, 0),
1625 CLK_DUMMY("mem_clk", ebi_adm_clk.c, "msm_dmov", 0),
1626};
1627
1628struct clock_init_data msm8625_dummy_clock_init_data __initdata = {
1629 .table = msm_clock_8625_dummy,
1630 .size = ARRAY_SIZE(msm_clock_8625_dummy),
1631};
1632
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301633enum {
1634 MSM8625,
1635 MSM8625A,
Kaushal Kumar86473f02012-06-28 19:35:58 +05301636 MSM8625AB,
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301637};
1638
1639static int __init msm8625_cpu_id(void)
1640{
1641 int raw_id, cpu;
1642
1643 raw_id = socinfo_get_raw_id();
1644 switch (raw_id) {
1645 /* Part number for 1GHz part */
1646 case 0x770:
1647 case 0x771:
1648 case 0x780:
1649 cpu = MSM8625;
1650 break;
1651 /* Part number for 1.2GHz part */
1652 case 0x773:
1653 case 0x774:
1654 case 0x781:
1655 cpu = MSM8625A;
1656 break;
Kaushal Kumar86473f02012-06-28 19:35:58 +05301657 case 0x775:
1658 case 0x776:
1659 case 0x782:
1660 cpu = MSM8625AB;
1661 break;
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301662 default:
1663 pr_err("Invalid Raw ID\n");
1664 return -ENODEV;
1665 }
1666 return cpu;
1667}
1668
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001669int __init msm7x2x_misc_init(void)
1670{
Taniya Das7c9f0512011-12-02 14:26:46 +05301671 if (machine_is_msm8625_rumi3()) {
1672 msm_clock_init(&msm8625_dummy_clock_init_data);
Taniya Das43bcdd62011-12-02 17:33:27 +05301673 return 0;
Taniya Das7c9f0512011-12-02 14:26:46 +05301674 }
Taniya Das43bcdd62011-12-02 17:33:27 +05301675
Stephen Boydbb600ae2011-08-02 20:11:40 -07001676 msm_clock_init(&msm7x27a_clock_init_data);
Pankaj Kumarfee56a82012-04-17 14:26:49 +05301677 if (cpu_is_msm7x27aa() || cpu_is_msm7x25ab())
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001678 platform_device_register(&msm7x27aa_device_acpuclk);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301679 else if (cpu_is_msm8625()) {
1680 if (msm8625_cpu_id() == MSM8625)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001681 platform_device_register(&msm7x27aa_device_acpuclk);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301682 else if (msm8625_cpu_id() == MSM8625A)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001683 platform_device_register(&msm8625_device_acpuclk);
Kaushal Kumar86473f02012-06-28 19:35:58 +05301684 else if (msm8625_cpu_id() == MSM8625AB)
1685 platform_device_register(&msm8625ab_device_acpuclk);
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001686 } else {
1687 platform_device_register(&msm7x27a_device_acpuclk);
1688 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001689 return 0;
1690}
1691
1692#ifdef CONFIG_CACHE_L2X0
1693static int __init msm7x27x_cache_init(void)
1694{
1695 int aux_ctrl = 0;
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301696 int pctrl = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001697
1698 /* Way Size 010(0x2) 32KB */
1699 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
1700 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
1701 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
1702
Taniya Das379b5682011-12-02 14:53:46 +05301703 if (cpu_is_msm8625()) {
1704 /* Way Size 011(0x3) 64KB */
1705 aux_ctrl |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
1706 (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | \
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301707 (0X1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) | \
1708 (0x1 << L2X0_AUX_CTRL_L2_FORCE_NWA_SHIFT);
1709
1710 /* Write Prefetch Control settings */
1711 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
1712 pctrl |= (0x3 << L2X0_PREFETCH_CTRL_OFFSET_SHIFT) | \
1713 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_INC_SHIFT) | \
1714 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_SHIFT);
1715 writel_relaxed(pctrl , MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
Taniya Das379b5682011-12-02 14:53:46 +05301716 }
1717
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001718 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301719 if (cpu_is_msm8625()) {
1720 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
1721 pr_info("Prfetch Ctrl: 0x%08x\n", pctrl);
1722 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001723
1724 return 0;
1725}
1726#else
pankaj kumar80d7cb62011-08-23 13:37:55 +05301727static int __init msm7x27x_cache_init(void){ return 0; }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001728#endif
1729
1730void __init msm_common_io_init(void)
1731{
1732 msm_map_common_io();
Taniya Das43bcdd62011-12-02 17:33:27 +05301733 if (socinfo_init() < 0)
1734 pr_err("%s: socinfo_init() failed!\n", __func__);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001735 msm7x27x_cache_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301736}
1737
1738void __init msm8625_init_irq(void)
1739{
Trilok Soni1a9fdee2012-05-28 19:54:11 +05301740 msm_gic_irq_extn_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301741 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1742 (void *)MSM_QGIC_CPU_BASE);
Taniya Das43bcdd62011-12-02 17:33:27 +05301743}
1744
1745void __init msm8625_map_io(void)
1746{
1747 msm_map_msm8625_io();
1748
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001749 if (socinfo_init() < 0)
1750 pr_err("%s: socinfo_init() failed!\n", __func__);
Taniya Das379b5682011-12-02 14:53:46 +05301751 msm7x27x_cache_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001752}
1753
Taniya Das43bcdd62011-12-02 17:33:27 +05301754static int msm7627a_init_gpio(void)
1755{
Taniya Das6684d622012-01-12 10:29:09 +05301756 if (cpu_is_msm8625())
1757 platform_device_register(&msm8625_device_gpio);
1758 else
1759 platform_device_register(&msm_device_gpio);
Taniya Das43bcdd62011-12-02 17:33:27 +05301760 return 0;
1761}
1762postcore_initcall(msm7627a_init_gpio);
Taniya Das9d0c3c52012-05-04 14:40:55 +05301763
1764static int msm7627a_panic_handler(struct notifier_block *this,
1765 unsigned long event, void *ptr)
1766{
1767 flush_cache_all();
1768 outer_flush_all();
1769 return NOTIFY_DONE;
1770}
1771
1772static struct notifier_block panic_handler = {
1773 .notifier_call = msm7627a_panic_handler,
1774};
1775
1776static int __init panic_register(void)
1777{
1778 atomic_notifier_chain_register(&panic_notifier_list,
1779 &panic_handler);
1780 return 0;
1781}
1782module_init(panic_register);