blob: 1fcf7dcc1bf3661a6a8eb2f0d04b40c218532868 [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 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530510 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700511 .start = MSM_SDC1_BASE,
512 .end = MSM_SDC1_BASE + SZ_4K - 1,
513 .flags = IORESOURCE_MEM,
514 },
515 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530516 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700517 .start = INT_SDC1_0,
518 .end = INT_SDC1_1,
519 .flags = IORESOURCE_IRQ,
520 },
521 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530522 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700523 .start = DMOV_SDC1_CHAN,
524 .end = DMOV_SDC1_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700525 .flags = IORESOURCE_DMA,
526 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700527 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530528 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700529 .start = DMOV_SDC1_CRCI,
530 .end = DMOV_SDC1_CRCI,
531 .flags = IORESOURCE_DMA,
532 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700533};
534
535static struct resource resources_sdc2[] = {
536 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530537 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700538 .start = MSM_SDC2_BASE,
539 .end = MSM_SDC2_BASE + SZ_4K - 1,
540 .flags = IORESOURCE_MEM,
541 },
542 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530543 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700544 .start = INT_SDC2_0,
545 .end = INT_SDC2_1,
546 .flags = IORESOURCE_IRQ,
547 },
548 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530549 .name = "dma_chnl",
Krishna Konda25786ec2011-07-25 16:21:36 -0700550 .start = DMOV_SDC2_CHAN,
551 .end = DMOV_SDC2_CHAN,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700552 .flags = IORESOURCE_DMA,
553 },
Krishna Konda25786ec2011-07-25 16:21:36 -0700554 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530555 .name = "dma_crci",
Krishna Konda25786ec2011-07-25 16:21:36 -0700556 .start = DMOV_SDC2_CRCI,
557 .end = DMOV_SDC2_CRCI,
558 .flags = IORESOURCE_DMA,
559 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700560};
561
562static struct resource resources_sdc3[] = {
563 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530564 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700565 .start = MSM_SDC3_BASE,
566 .end = MSM_SDC3_BASE + SZ_4K - 1,
567 .flags = IORESOURCE_MEM,
568 },
569 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530570 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700571 .start = INT_SDC3_0,
572 .end = INT_SDC3_1,
573 .flags = IORESOURCE_IRQ,
574 },
575 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530576 .name = "dma_chnl",
Subhash Jadavanif29aefd2012-06-21 00:43:15 +0530577 .start = DMOV_NAND_CHAN,
578 .end = DMOV_NAND_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700579 .flags = IORESOURCE_DMA,
580 },
581 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530582 .name = "dma_crci",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530583 .start = DMOV_SDC3_CRCI,
584 .end = DMOV_SDC3_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700585 .flags = IORESOURCE_DMA,
586 },
587};
588
589static struct resource resources_sdc4[] = {
590 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530591 .name = "core_mem",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700592 .start = MSM_SDC4_BASE,
593 .end = MSM_SDC4_BASE + SZ_4K - 1,
594 .flags = IORESOURCE_MEM,
595 },
596 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530597 .name = "core_irq",
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700598 .start = INT_SDC4_0,
599 .end = INT_SDC4_1,
600 .flags = IORESOURCE_IRQ,
601 },
602 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530603 .name = "dma_chnl",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530604 .start = DMOV_SDC4_CHAN,
605 .end = DMOV_SDC4_CHAN,
Krishna Konda25786ec2011-07-25 16:21:36 -0700606 .flags = IORESOURCE_DMA,
607 },
608 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +0530609 .name = "dma_crci",
Sujit Reddy Thumma119bfbb2011-10-12 11:52:21 +0530610 .start = DMOV_SDC4_CRCI,
611 .end = DMOV_SDC4_CRCI,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700612 .flags = IORESOURCE_DMA,
613 },
614};
615
616struct platform_device msm_device_sdc1 = {
617 .name = "msm_sdcc",
618 .id = 1,
619 .num_resources = ARRAY_SIZE(resources_sdc1),
620 .resource = resources_sdc1,
621 .dev = {
622 .coherent_dma_mask = 0xffffffff,
623 },
624};
625
626struct platform_device msm_device_sdc2 = {
627 .name = "msm_sdcc",
628 .id = 2,
629 .num_resources = ARRAY_SIZE(resources_sdc2),
630 .resource = resources_sdc2,
631 .dev = {
632 .coherent_dma_mask = 0xffffffff,
633 },
634};
635
636struct platform_device msm_device_sdc3 = {
637 .name = "msm_sdcc",
638 .id = 3,
639 .num_resources = ARRAY_SIZE(resources_sdc3),
640 .resource = resources_sdc3,
641 .dev = {
642 .coherent_dma_mask = 0xffffffff,
643 },
644};
645
646struct platform_device msm_device_sdc4 = {
647 .name = "msm_sdcc",
648 .id = 4,
649 .num_resources = ARRAY_SIZE(resources_sdc4),
650 .resource = resources_sdc4,
651 .dev = {
652 .coherent_dma_mask = 0xffffffff,
653 },
654};
655
656static struct platform_device *msm_sdcc_devices[] __initdata = {
657 &msm_device_sdc1,
658 &msm_device_sdc2,
659 &msm_device_sdc3,
660 &msm_device_sdc4,
661};
662
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530663#ifdef CONFIG_MSM_CAMERA_V4L2
Suresh Vankadara6050cef52012-04-16 21:44:59 +0530664static int apps_reset;
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530665static struct resource msm_csic0_resources[] = {
666 {
667 .name = "csic",
668 .start = 0xA0F00000,
669 .end = 0xA0F00000 + 0x00100000 - 1,
670 .flags = IORESOURCE_MEM,
671 },
672 {
673 .name = "csic",
674 .start = INT_CSI_IRQ_0,
675 .end = INT_CSI_IRQ_0,
676 .flags = IORESOURCE_IRQ,
677 },
678};
679
680static struct resource msm_csic1_resources[] = {
681 {
682 .name = "csic",
683 .start = 0xA1000000,
684 .end = 0xA1000000 + 0x00100000 - 1,
685 .flags = IORESOURCE_MEM,
686 },
687 {
688 .name = "csic",
689 .start = INT_CSI_IRQ_1,
690 .end = INT_CSI_IRQ_1,
691 .flags = IORESOURCE_IRQ,
692 },
693};
694
695struct platform_device msm7x27a_device_csic0 = {
696 .name = "msm_csic",
697 .id = 0,
698 .resource = msm_csic0_resources,
699 .num_resources = ARRAY_SIZE(msm_csic0_resources),
700};
701
702struct platform_device msm7x27a_device_csic1 = {
703 .name = "msm_csic",
704 .id = 1,
705 .resource = msm_csic1_resources,
706 .num_resources = ARRAY_SIZE(msm_csic1_resources),
707};
708
709static struct resource msm_clkctl_resources[] = {
710 {
711 .name = "clk_ctl",
Taniya Das13b811a2011-12-09 18:33:45 +0530712 .start = MSM7XXX_CLK_CTL_PHYS,
713 .end = MSM7XXX_CLK_CTL_PHYS + MSM7XXX_CLK_CTL_SIZE - 1,
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530714 .flags = IORESOURCE_MEM,
715 },
716};
717struct platform_device msm7x27a_device_clkctl = {
718 .name = "msm_clk_ctl",
719 .id = 0,
720 .resource = msm_clkctl_resources,
721 .num_resources = ARRAY_SIZE(msm_clkctl_resources),
Suresh Vankadara6050cef52012-04-16 21:44:59 +0530722 .dev = {
723 .platform_data = &apps_reset,
724 },
Suresh Vankadara20cd3be72012-01-18 00:34:06 +0530725};
726
727struct platform_device msm7x27a_device_vfe = {
728 .name = "msm_vfe",
729 .id = 0,
730};
731
732#endif
733
Murali Nalajala41786ab2012-03-06 10:47:32 +0530734/* Command sequence for simple WFI */
735static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Murali Nalajala2250a272012-03-13 15:56:59 +0530736 0x04, 0x03, 0x04, 0x0f,
Murali Nalajala41786ab2012-03-06 10:47:32 +0530737};
738
739/* Command sequence for GDFS, this won't send any interrupt to the modem */
740static uint8_t spm_pc_without_modem[] __initdata = {
741 0x20, 0x00, 0x30, 0x10,
Murali Nalajala2250a272012-03-13 15:56:59 +0530742 0x03, 0x1e, 0x0e, 0x3e,
743 0x4e, 0x4e, 0x4e, 0x4e,
744 0x4e, 0x4e, 0x4e, 0x4e,
745 0x4e, 0x4e, 0x4e, 0x4e,
746 0x4e, 0x4e, 0x4e, 0x4e,
747 0x2E, 0x0f,
Murali Nalajala41786ab2012-03-06 10:47:32 +0530748};
749
750static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
751 [0] = {
752 .mode = MSM_SPM_MODE_CLOCK_GATING,
753 .notify_rpm = false,
754 .cmd = spm_wfi_cmd_sequence,
755 },
756 [1] = {
757 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
758 .notify_rpm = false,
759 .cmd = spm_pc_without_modem,
760 },
761};
762
763static struct msm_spm_platform_data msm_spm_data[] __initdata = {
764 [0] = {
765 .reg_base_addr = MSM_SAW0_BASE,
766 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
767 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
768 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
769 .modes = msm_spm_seq_list,
770 },
771 [1] = {
772 .reg_base_addr = MSM_SAW1_BASE,
773 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x0,
774 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
775 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
776 .modes = msm_spm_seq_list,
777 },
778};
779
780void __init msm8x25_spm_device_init(void)
781{
782 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
783}
784
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700785#define MDP_BASE 0xAA200000
786#define MIPI_DSI_HW_BASE 0xA1100000
787
788static struct resource msm_mipi_dsi_resources[] = {
789 {
790 .name = "mipi_dsi",
791 .start = MIPI_DSI_HW_BASE,
792 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
793 .flags = IORESOURCE_MEM,
794 },
795 {
796 .start = INT_DSI_IRQ,
797 .end = INT_DSI_IRQ,
798 .flags = IORESOURCE_IRQ,
799 },
800};
801
802static struct platform_device msm_mipi_dsi_device = {
803 .name = "mipi_dsi",
804 .id = 1,
805 .num_resources = ARRAY_SIZE(msm_mipi_dsi_resources),
806 .resource = msm_mipi_dsi_resources,
807};
808
809static struct resource msm_mdp_resources[] = {
810 {
811 .name = "mdp",
812 .start = MDP_BASE,
813 .end = MDP_BASE + 0x000F1008 - 1,
814 .flags = IORESOURCE_MEM,
815 },
816 {
817 .start = INT_MDP,
818 .end = INT_MDP,
819 .flags = IORESOURCE_IRQ,
820 },
821};
822
823static struct platform_device msm_mdp_device = {
824 .name = "mdp",
825 .id = 0,
826 .num_resources = ARRAY_SIZE(msm_mdp_resources),
827 .resource = msm_mdp_resources,
828};
829
830static struct platform_device msm_lcdc_device = {
831 .name = "lcdc",
832 .id = 0,
833};
834
835static struct resource kgsl_3d0_resources[] = {
836 {
837 .name = KGSL_3D0_REG_MEMORY,
838 .start = 0xA0000000,
839 .end = 0xA001ffff,
840 .flags = IORESOURCE_MEM,
841 },
842 {
843 .name = KGSL_3D0_IRQ,
844 .start = INT_GRAPHICS,
845 .end = INT_GRAPHICS,
846 .flags = IORESOURCE_IRQ,
847 },
848};
849
850static struct kgsl_device_platform_data kgsl_3d0_pdata = {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600851 .pwrlevel = {
852 {
853 .gpu_freq = 245760000,
854 .bus_freq = 200000000,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700855 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600856 {
Lynus Vazeaf0aac2012-01-05 12:28:47 +0530857 .gpu_freq = 192000000,
858 .bus_freq = 160000000,
859 },
860 {
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600861 .gpu_freq = 133330000,
862 .bus_freq = 0,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700863 },
864 },
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600865 .init_level = 0,
Lynus Vazeaf0aac2012-01-05 12:28:47 +0530866 .num_levels = 3,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600867 .set_grp_async = set_grp_xbar_async,
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700868 .idle_timeout = HZ,
Lynus Vazfe4bede2012-04-06 11:53:30 -0700869 .strtstp_sleepwake = true,
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600870 .nap_allowed = false,
871 .clk_map = KGSL_CLK_CORE | KGSL_CLK_IFACE | KGSL_CLK_MEM,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700872};
873
874struct platform_device msm_kgsl_3d0 = {
875 .name = "kgsl-3d0",
876 .id = 0,
877 .num_resources = ARRAY_SIZE(kgsl_3d0_resources),
878 .resource = kgsl_3d0_resources,
879 .dev = {
880 .platform_data = &kgsl_3d0_pdata,
881 },
882};
883
884void __init msm7x25a_kgsl_3d0_init(void)
885{
Pankaj Kumarfee56a82012-04-17 14:26:49 +0530886 if (cpu_is_msm7x25a() || cpu_is_msm7x25aa() || cpu_is_msm7x25ab()) {
Lynus Vaz971610e2012-01-06 11:00:32 +0530887 kgsl_3d0_pdata.num_levels = 2;
Lucille Sylvesterdce84cd2011-10-12 14:15:37 -0600888 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 133330000;
889 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 160000000;
890 kgsl_3d0_pdata.pwrlevel[1].gpu_freq = 96000000;
891 kgsl_3d0_pdata.pwrlevel[1].bus_freq = 0;
Rajesh Kemisettidf6e62f2012-03-12 14:02:30 +0530892 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700893}
894
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700895void __init msm8x25_kgsl_3d0_init(void)
896{
Lynus Vazfe4bede2012-04-06 11:53:30 -0700897 if (cpu_is_msm8625()) {
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700898 kgsl_3d0_pdata.idle_timeout = HZ/5;
Lynus Vazfe4bede2012-04-06 11:53:30 -0700899 kgsl_3d0_pdata.strtstp_sleepwake = false;
Ranjhith Kalisamy24696322012-04-11 22:09:17 +0530900 /* 8x25 supports a higher GPU frequency */
Rajesh Kemisettid41dd802012-07-24 11:31:47 +0530901 kgsl_3d0_pdata.pwrlevel[0].gpu_freq = 320000000;
Ranjhith Kalisamy24696322012-04-11 22:09:17 +0530902 kgsl_3d0_pdata.pwrlevel[0].bus_freq = 200000000;
Lynus Vazfe4bede2012-04-06 11:53:30 -0700903 }
Sudhakara Rao Tentu38ad6e12012-03-30 15:25:18 -0700904}
905
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700906static void __init msm_register_device(struct platform_device *pdev, void *data)
907{
908 int ret;
909
910 pdev->dev.platform_data = data;
911
912 ret = platform_device_register(pdev);
913
914 if (ret)
915 dev_err(&pdev->dev,
916 "%s: platform_device_register() failed = %d\n",
917 __func__, ret);
918}
919
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -0700920
921#define PERPH_WEB_BLOCK_ADDR (0xA9D00040)
922#define PDM0_CTL_OFFSET (0x04)
923#define SIZE_8B (0x08)
924
925static struct resource resources_led[] = {
926 {
927 .start = PERPH_WEB_BLOCK_ADDR,
928 .end = PERPH_WEB_BLOCK_ADDR + (SIZE_8B) - 1,
929 .name = "led-gpio-pdm",
930 .flags = IORESOURCE_MEM,
931 },
932};
933
934static struct led_info msm_kpbl_pdm_led_pdata = {
935 .name = "keyboard-backlight",
936};
937
938struct platform_device led_pdev = {
939 .name = "leds-msm-pdm",
940 /* use pdev id to represent pdm id */
941 .id = 0,
942 .num_resources = ARRAY_SIZE(resources_led),
943 .resource = resources_led,
944 .dev = {
945 .platform_data = &msm_kpbl_pdm_led_pdata,
946 },
947};
948
Manish Dewangan3a260992011-06-24 18:01:34 +0530949struct platform_device asoc_msm_pcm = {
950 .name = "msm-dsp-audio",
951 .id = 0,
952};
953
954struct platform_device asoc_msm_dai0 = {
955 .name = "msm-codec-dai",
956 .id = 0,
957};
958
959struct platform_device asoc_msm_dai1 = {
960 .name = "msm-cpu-dai",
961 .id = 0,
962};
963
Taniya Das2e948192011-12-20 11:15:13 +0530964static struct resource gpio_resources[] = {
965 {
966 .start = INT_GPIO_GROUP1,
967 .flags = IORESOURCE_IRQ,
968 },
969 {
970 .start = INT_GPIO_GROUP2,
971 .flags = IORESOURCE_IRQ,
972 },
973};
974
975static struct platform_device msm_device_gpio = {
976 .name = "msmgpio",
977 .id = -1,
978 .resource = gpio_resources,
979 .num_resources = ARRAY_SIZE(gpio_resources),
980};
981
Taniya Das43bcdd62011-12-02 17:33:27 +0530982struct platform_device *msm_footswitch_devices[] = {
Matt Wagantalld6fbf232012-05-03 20:09:28 -0700983 FS_PCOM(FS_GFX3D, "vdd", "kgsl-3d0.0"),
Taniya Das43bcdd62011-12-02 17:33:27 +0530984};
985unsigned msm_num_footswitch_devices = ARRAY_SIZE(msm_footswitch_devices);
986
987/* MSM8625 Devices */
988
989static struct resource msm8625_resources_uart1[] = {
990 {
991 .start = MSM8625_INT_UART1,
992 .end = MSM8625_INT_UART1,
993 .flags = IORESOURCE_IRQ,
994 },
995 {
Taniya Das13b811a2011-12-09 18:33:45 +0530996 .start = MSM7XXX_UART1_PHYS,
997 .end = MSM7XXX_UART1_PHYS + MSM7XXX_UART1_SIZE - 1,
Taniya Das43bcdd62011-12-02 17:33:27 +0530998 .flags = IORESOURCE_MEM,
999 },
1000};
1001
1002struct platform_device msm8625_device_uart1 = {
1003 .name = "msm_serial",
1004 .id = 0,
1005 .num_resources = ARRAY_SIZE(msm8625_resources_uart1),
1006 .resource = msm8625_resources_uart1,
1007};
1008
Trilok Soni269fff42012-02-13 20:35:30 +05301009static struct resource msm8625_uart1_dm_resources[] = {
1010 {
1011 .start = MSM_UART1DM_PHYS,
1012 .end = MSM_UART1DM_PHYS + PAGE_SIZE - 1,
1013 .flags = IORESOURCE_MEM,
1014 },
1015 {
1016 .start = MSM8625_INT_UART1DM_IRQ,
1017 .end = MSM8625_INT_UART1DM_IRQ,
1018 .flags = IORESOURCE_IRQ,
1019 },
1020 {
1021 .start = MSM8625_INT_UART1DM_RX,
1022 .end = MSM8625_INT_UART1DM_RX,
1023 .flags = IORESOURCE_IRQ,
1024 },
1025 {
1026 .start = DMOV_HSUART1_TX_CHAN,
1027 .end = DMOV_HSUART1_RX_CHAN,
1028 .name = "uartdm_channels",
1029 .flags = IORESOURCE_DMA,
1030 },
1031 {
1032 .start = DMOV_HSUART1_TX_CRCI,
1033 .end = DMOV_HSUART1_RX_CRCI,
1034 .name = "uartdm_crci",
1035 .flags = IORESOURCE_DMA,
1036 },
1037};
1038
1039struct platform_device msm8625_device_uart_dm1 = {
1040 .name = "msm_serial_hs",
1041 .id = 0,
1042 .num_resources = ARRAY_SIZE(msm8625_uart1_dm_resources),
1043 .resource = msm8625_uart1_dm_resources,
1044 .dev = {
1045 .dma_mask = &msm_uart_dm1_dma_mask,
1046 .coherent_dma_mask = DMA_BIT_MASK(32),
1047 },
1048};
1049
1050static struct resource msm8625_uart2dm_resources[] = {
1051 {
1052 .start = MSM_UART2DM_PHYS,
1053 .end = MSM_UART2DM_PHYS + PAGE_SIZE - 1,
1054 .name = "uartdm_resource",
1055 .flags = IORESOURCE_MEM,
1056 },
1057 {
1058 .start = MSM8625_INT_UART2DM_IRQ,
1059 .end = MSM8625_INT_UART2DM_IRQ,
1060 .flags = IORESOURCE_IRQ,
1061 },
1062};
1063
1064struct platform_device msm8625_device_uart_dm2 = {
1065 .name = "msm_serial_hsl",
1066 .id = 0,
1067 .num_resources = ARRAY_SIZE(msm8625_uart2dm_resources),
1068 .resource = msm8625_uart2dm_resources,
1069};
1070
Laxminath Kasam5faa1ca2012-02-15 12:06:45 +05301071static struct resource msm8625_resources_adsp[] = {
1072 {
1073 .start = MSM8625_INT_ADSP_A9_A11,
1074 .end = MSM8625_INT_ADSP_A9_A11,
1075 .flags = IORESOURCE_IRQ,
1076 },
1077};
1078
1079struct platform_device msm8625_device_adsp = {
1080 .name = "msm_adsp",
1081 .id = -1,
1082 .num_resources = ARRAY_SIZE(msm8625_resources_adsp),
1083 .resource = msm8625_resources_adsp,
1084};
1085
Taniya Das43bcdd62011-12-02 17:33:27 +05301086static struct resource msm8625_dmov_resource[] = {
1087 {
1088 .start = MSM8625_INT_ADM_AARM,
1089 .flags = IORESOURCE_IRQ,
1090 },
1091 {
1092 .start = 0xA9700000,
1093 .end = 0xA9700000 + SZ_4K - 1,
1094 .flags = IORESOURCE_MEM,
1095 },
1096};
1097
1098struct platform_device msm8625_device_dmov = {
1099 .name = "msm_dmov",
1100 .id = -1,
1101 .resource = msm8625_dmov_resource,
1102 .num_resources = ARRAY_SIZE(msm8625_dmov_resource),
1103 .dev = {
1104 .platform_data = &msm_dmov_pdata,
1105 },
1106};
Taniya Das2e948192011-12-20 11:15:13 +05301107
Taniya Das9d187142011-12-02 15:53:25 +05301108static struct resource gsbi0_msm8625_qup_resources[] = {
1109 {
1110 .name = "qup_phys_addr",
1111 .start = MSM_GSBI0_QUP_PHYS,
1112 .end = MSM_GSBI0_QUP_PHYS + SZ_4K - 1,
1113 .flags = IORESOURCE_MEM,
1114 },
1115 {
1116 .name = "gsbi_qup_i2c_addr",
1117 .start = MSM_GSBI0_PHYS,
1118 .end = MSM_GSBI0_PHYS + SZ_4K - 1,
1119 .flags = IORESOURCE_MEM,
1120 },
1121 {
1122 .name = "qup_err_intr",
1123 .start = MSM8625_INT_PWB_I2C,
1124 .end = MSM8625_INT_PWB_I2C,
1125 .flags = IORESOURCE_IRQ,
1126 },
1127};
1128
1129/* Use GSBI0 QUP for /dev/i2c-0 */
Taniya Dase3027e22012-02-27 16:32:27 +05301130struct platform_device msm8625_gsbi0_qup_i2c_device = {
Taniya Das9d187142011-12-02 15:53:25 +05301131 .name = "qup_i2c",
1132 .id = MSM_GSBI0_QUP_I2C_BUS_ID,
1133 .num_resources = ARRAY_SIZE(gsbi0_msm8625_qup_resources),
1134 .resource = gsbi0_msm8625_qup_resources,
1135};
1136
Trilok Soni633e59c2012-02-13 20:28:30 +05301137static struct resource gsbi1_msm8625_qup_i2c_resources[] = {
1138 {
1139 .name = "qup_phys_addr",
1140 .start = MSM_GSBI1_QUP_PHYS,
1141 .end = MSM_GSBI1_QUP_PHYS + SZ_4K - 1,
1142 .flags = IORESOURCE_MEM,
1143 },
1144 {
1145 .name = "gsbi_qup_i2c_addr",
1146 .start = MSM_GSBI1_PHYS,
1147 .end = MSM_GSBI1_PHYS + SZ_4K - 1,
1148 .flags = IORESOURCE_MEM,
1149 },
1150 {
1151 .name = "qup_err_intr",
1152 .start = MSM8625_INT_ARM11_DMA,
1153 .end = MSM8625_INT_ARM11_DMA,
1154 .flags = IORESOURCE_IRQ,
1155 },
1156};
1157
1158/* Use GSBI1 QUP for /dev/i2c-1 */
Taniya Dase3027e22012-02-27 16:32:27 +05301159struct platform_device msm8625_gsbi1_qup_i2c_device = {
Trilok Soni633e59c2012-02-13 20:28:30 +05301160 .name = "qup_i2c",
1161 .id = MSM_GSBI1_QUP_I2C_BUS_ID,
1162 .num_resources = ARRAY_SIZE(gsbi1_qup_i2c_resources),
1163 .resource = gsbi1_msm8625_qup_i2c_resources,
1164};
1165
Taniya Das6684d622012-01-12 10:29:09 +05301166static struct resource msm8625_gpio_resources[] = {
1167 {
1168 .start = MSM8625_INT_GPIO_GROUP1,
1169 .flags = IORESOURCE_IRQ,
1170 },
1171 {
1172 .start = MSM8625_INT_GPIO_GROUP2,
1173 .flags = IORESOURCE_IRQ,
1174 },
1175};
1176
1177static struct platform_device msm8625_device_gpio = {
1178 .name = "msmgpio",
1179 .id = -1,
1180 .resource = msm8625_gpio_resources,
1181 .num_resources = ARRAY_SIZE(msm8625_gpio_resources),
1182};
1183
Trilok Soniee75f6c2012-02-13 20:45:07 +05301184static struct resource msm8625_resources_sdc1[] = {
1185 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301186 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301187 .start = MSM_SDC1_BASE,
1188 .end = MSM_SDC1_BASE + SZ_4K - 1,
1189 .flags = IORESOURCE_MEM,
1190 },
1191 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301192 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301193 .start = MSM8625_INT_SDC1_0,
1194 .end = MSM8625_INT_SDC1_1,
1195 .flags = IORESOURCE_IRQ,
1196 },
1197 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301198 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301199 .start = DMOV_SDC1_CHAN,
1200 .end = DMOV_SDC1_CHAN,
1201 .flags = IORESOURCE_DMA,
1202 },
1203 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301204 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301205 .start = DMOV_SDC1_CRCI,
1206 .end = DMOV_SDC1_CRCI,
1207 .flags = IORESOURCE_DMA,
1208 }
1209};
1210
1211static struct resource msm8625_resources_sdc2[] = {
1212 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301213 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301214 .start = MSM_SDC2_BASE,
1215 .end = MSM_SDC2_BASE + SZ_4K - 1,
1216 .flags = IORESOURCE_MEM,
1217 },
1218 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301219 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301220 .start = MSM8625_INT_SDC2_0,
1221 .end = MSM8625_INT_SDC2_1,
1222 .flags = IORESOURCE_IRQ,
1223 },
1224 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301225 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301226 .start = DMOV_SDC2_CHAN,
1227 .end = DMOV_SDC2_CHAN,
1228 .flags = IORESOURCE_DMA,
1229 },
1230 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301231 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301232 .start = DMOV_SDC2_CRCI,
1233 .end = DMOV_SDC2_CRCI,
1234 .flags = IORESOURCE_DMA,
1235 }
1236};
1237
1238static struct resource msm8625_resources_sdc3[] = {
1239 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301240 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301241 .start = MSM_SDC3_BASE,
1242 .end = MSM_SDC3_BASE + SZ_4K - 1,
1243 .flags = IORESOURCE_MEM,
1244 },
1245 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301246 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301247 .start = MSM8625_INT_SDC3_0,
1248 .end = MSM8625_INT_SDC3_1,
1249 .flags = IORESOURCE_IRQ,
1250 },
1251 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301252 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301253 .start = DMOV_SDC3_CHAN,
1254 .end = DMOV_SDC3_CHAN,
1255 .flags = IORESOURCE_DMA,
1256 },
1257 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301258 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301259 .start = DMOV_SDC3_CRCI,
1260 .end = DMOV_SDC3_CRCI,
1261 .flags = IORESOURCE_DMA,
1262 },
1263};
1264
1265static struct resource msm8625_resources_sdc4[] = {
1266 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301267 .name = "core_mem",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301268 .start = MSM_SDC4_BASE,
1269 .end = MSM_SDC4_BASE + SZ_4K - 1,
1270 .flags = IORESOURCE_MEM,
1271 },
1272 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301273 .name = "core_irq",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301274 .start = MSM8625_INT_SDC4_0,
1275 .end = MSM8625_INT_SDC4_1,
1276 .flags = IORESOURCE_IRQ,
1277 },
1278 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301279 .name = "dma_chnl",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301280 .start = DMOV_SDC4_CHAN,
1281 .end = DMOV_SDC4_CHAN,
1282 .flags = IORESOURCE_DMA,
1283 },
1284 {
Sujit Reddy Thumma1dfac2c2012-07-30 10:15:39 +05301285 .name = "dma_crci",
Trilok Soniee75f6c2012-02-13 20:45:07 +05301286 .start = DMOV_SDC4_CRCI,
1287 .end = DMOV_SDC4_CRCI,
1288 .flags = IORESOURCE_DMA,
1289 },
1290};
1291
1292struct platform_device msm8625_device_sdc1 = {
1293 .name = "msm_sdcc",
1294 .id = 1,
1295 .num_resources = ARRAY_SIZE(msm8625_resources_sdc1),
1296 .resource = msm8625_resources_sdc1,
1297 .dev = {
1298 .coherent_dma_mask = 0xffffffff,
1299 },
1300};
1301
1302struct platform_device msm8625_device_sdc2 = {
1303 .name = "msm_sdcc",
1304 .id = 2,
1305 .num_resources = ARRAY_SIZE(msm8625_resources_sdc2),
1306 .resource = msm8625_resources_sdc2,
1307 .dev = {
1308 .coherent_dma_mask = 0xffffffff,
1309 },
1310};
1311
1312struct platform_device msm8625_device_sdc3 = {
1313 .name = "msm_sdcc",
1314 .id = 3,
1315 .num_resources = ARRAY_SIZE(msm8625_resources_sdc3),
1316 .resource = msm8625_resources_sdc3,
1317 .dev = {
1318 .coherent_dma_mask = 0xffffffff,
1319 },
1320};
1321
1322struct platform_device msm8625_device_sdc4 = {
1323 .name = "msm_sdcc",
1324 .id = 4,
1325 .num_resources = ARRAY_SIZE(msm8625_resources_sdc4),
1326 .resource = msm8625_resources_sdc4,
1327 .dev = {
1328 .coherent_dma_mask = 0xffffffff,
1329 },
1330};
1331
1332static struct platform_device *msm8625_sdcc_devices[] __initdata = {
1333 &msm8625_device_sdc1,
1334 &msm8625_device_sdc2,
1335 &msm8625_device_sdc3,
1336 &msm8625_device_sdc4,
1337};
1338
1339int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
1340{
1341 struct platform_device *pdev;
1342
1343 if (controller < 1 || controller > 4)
1344 return -EINVAL;
1345
1346 if (cpu_is_msm8625())
1347 pdev = msm8625_sdcc_devices[controller-1];
1348 else
1349 pdev = msm_sdcc_devices[controller-1];
1350
1351 pdev->dev.platform_data = plat;
1352 return platform_device_register(pdev);
1353}
1354
Trilok Sonida63a8b2012-02-13 20:50:03 +05301355static struct resource msm8625_resources_hsusb_otg[] = {
1356 {
1357 .start = MSM_HSUSB_PHYS,
1358 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1359 .flags = IORESOURCE_MEM,
1360 },
1361 {
1362 .start = MSM8625_INT_USB_HS,
1363 .end = MSM8625_INT_USB_HS,
1364 .flags = IORESOURCE_IRQ,
1365 },
1366};
1367
1368struct platform_device msm8625_device_otg = {
1369 .name = "msm_otg",
1370 .id = -1,
1371 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_otg),
1372 .resource = msm8625_resources_hsusb_otg,
1373 .dev = {
1374 .dma_mask = &dma_mask,
1375 .coherent_dma_mask = 0xffffffffULL,
1376 },
1377};
1378
1379static struct resource msm8625_resources_gadget_peripheral[] = {
1380 {
1381 .start = MSM_HSUSB_PHYS,
1382 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1383 .flags = IORESOURCE_MEM,
1384 },
1385 {
1386 .start = MSM8625_INT_USB_HS,
1387 .end = MSM8625_INT_USB_HS,
1388 .flags = IORESOURCE_IRQ,
1389 },
1390};
1391
1392struct platform_device msm8625_device_gadget_peripheral = {
1393 .name = "msm_hsusb",
1394 .id = -1,
1395 .num_resources = ARRAY_SIZE(msm8625_resources_gadget_peripheral),
1396 .resource = msm8625_resources_gadget_peripheral,
1397 .dev = {
1398 .dma_mask = &dma_mask,
1399 .coherent_dma_mask = 0xffffffffULL,
1400 },
1401};
1402
1403static struct resource msm8625_resources_hsusb_host[] = {
1404 {
1405 .start = MSM_HSUSB_PHYS,
1406 .end = MSM_HSUSB_PHYS + SZ_1K - 1,
1407 .flags = IORESOURCE_MEM,
1408 },
1409 {
1410 .start = MSM8625_INT_USB_HS,
1411 .end = MSM8625_INT_USB_HS,
1412 .flags = IORESOURCE_IRQ,
1413 },
1414};
1415
1416struct platform_device msm8625_device_hsusb_host = {
1417 .name = "msm_hsusb_host",
1418 .id = 0,
1419 .num_resources = ARRAY_SIZE(msm8625_resources_hsusb_host),
1420 .resource = msm8625_resources_hsusb_host,
1421 .dev = {
1422 .dma_mask = &dma_mask,
1423 .coherent_dma_mask = 0xffffffffULL,
1424 },
1425};
1426
1427static struct platform_device *msm8625_host_devices[] = {
1428 &msm8625_device_hsusb_host,
1429};
1430
1431int msm_add_host(unsigned int host, struct msm_usb_host_platform_data *plat)
1432{
1433 struct platform_device *pdev;
1434
1435 if (cpu_is_msm8625())
1436 pdev = msm8625_host_devices[host];
1437 else
1438 pdev = msm_host_devices[host];
1439 if (!pdev)
1440 return -ENODEV;
1441 pdev->dev.platform_data = plat;
1442 return platform_device_register(pdev);
1443}
1444
Trilok Soni88da2552012-02-13 21:01:24 +05301445#ifdef CONFIG_MSM_CAMERA_V4L2
1446static struct resource msm8625_csic0_resources[] = {
1447 {
1448 .name = "csic",
1449 .start = 0xA0F00000,
1450 .end = 0xA0F00000 + 0x00100000 - 1,
1451 .flags = IORESOURCE_MEM,
1452 },
1453 {
1454 .name = "csic",
1455 .start = MSM8625_INT_CSI_IRQ_0,
1456 .end = MSM8625_INT_CSI_IRQ_0,
1457 .flags = IORESOURCE_IRQ,
1458 },
1459};
1460
1461static struct resource msm8625_csic1_resources[] = {
1462 {
1463 .name = "csic",
1464 .start = 0xA1000000,
1465 .end = 0xA1000000 + 0x00100000 - 1,
1466 .flags = IORESOURCE_MEM,
1467 },
1468 {
1469 .name = "csic",
1470 .start = MSM8625_INT_CSI_IRQ_1,
1471 .end = MSM8625_INT_CSI_IRQ_1,
1472 .flags = IORESOURCE_IRQ,
1473 },
1474};
1475
1476struct platform_device msm8625_device_csic0 = {
1477 .name = "msm_csic",
1478 .id = 0,
1479 .resource = msm8625_csic0_resources,
1480 .num_resources = ARRAY_SIZE(msm8625_csic0_resources),
1481};
1482
1483struct platform_device msm8625_device_csic1 = {
1484 .name = "msm_csic",
1485 .id = 1,
1486 .resource = msm8625_csic1_resources,
1487 .num_resources = ARRAY_SIZE(msm8625_csic1_resources),
1488};
1489#endif
1490
Trilok Soniae4633d2012-02-13 21:08:32 +05301491static struct resource msm8625_mipi_dsi_resources[] = {
1492 {
1493 .name = "mipi_dsi",
1494 .start = MIPI_DSI_HW_BASE,
1495 .end = MIPI_DSI_HW_BASE + 0x000F0000 - 1,
1496 .flags = IORESOURCE_MEM,
1497 },
1498 {
1499 .start = MSM8625_INT_DSI_IRQ,
1500 .end = MSM8625_INT_DSI_IRQ,
1501 .flags = IORESOURCE_IRQ,
1502 },
1503};
1504
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301505static struct platform_device msm8625_mipi_dsi_device = {
Trilok Soniae4633d2012-02-13 21:08:32 +05301506 .name = "mipi_dsi",
1507 .id = 1,
1508 .num_resources = ARRAY_SIZE(msm8625_mipi_dsi_resources),
1509 .resource = msm8625_mipi_dsi_resources,
1510};
1511
1512static struct resource msm8625_mdp_resources[] = {
1513 {
1514 .name = "mdp",
1515 .start = MDP_BASE,
1516 .end = MDP_BASE + 0x000F1008 - 1,
1517 .flags = IORESOURCE_MEM,
1518 },
1519 {
1520 .start = MSM8625_INT_MDP,
1521 .end = MSM8625_INT_MDP,
1522 .flags = IORESOURCE_IRQ,
1523 },
1524};
1525
1526static struct platform_device msm8625_mdp_device = {
1527 .name = "mdp",
1528 .id = 0,
1529 .num_resources = ARRAY_SIZE(msm8625_mdp_resources),
1530 .resource = msm8625_mdp_resources,
1531};
1532
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301533struct platform_device mipi_dsi_device;
1534
Trilok Soniae4633d2012-02-13 21:08:32 +05301535void __init msm_fb_register_device(char *name, void *data)
1536{
1537 if (!strncmp(name, "mdp", 3)) {
1538 if (cpu_is_msm8625())
1539 msm_register_device(&msm8625_mdp_device, data);
1540 else
1541 msm_register_device(&msm_mdp_device, data);
1542 } else if (!strncmp(name, "mipi_dsi", 8)) {
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301543 if (cpu_is_msm8625()) {
Trilok Soniae4633d2012-02-13 21:08:32 +05301544 msm_register_device(&msm8625_mipi_dsi_device, data);
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301545 mipi_dsi_device = msm8625_mipi_dsi_device;
1546 } else {
Trilok Soniae4633d2012-02-13 21:08:32 +05301547 msm_register_device(&msm_mipi_dsi_device, data);
Padmanabhan Komanduru0b9517b2012-07-02 18:31:23 +05301548 mipi_dsi_device = msm_mipi_dsi_device;
1549 }
Trilok Soniae4633d2012-02-13 21:08:32 +05301550 } else if (!strncmp(name, "lcdc", 4)) {
1551 msm_register_device(&msm_lcdc_device, data);
1552 } else {
1553 printk(KERN_ERR "%s: unknown device! %s\n", __func__, name);
1554 }
1555}
1556
Trilok Soni664b95d2012-02-13 21:13:15 +05301557static struct resource msm8625_kgsl_3d0_resources[] = {
1558 {
1559 .name = KGSL_3D0_REG_MEMORY,
1560 .start = 0xA0000000,
1561 .end = 0xA001ffff,
1562 .flags = IORESOURCE_MEM,
1563 },
1564 {
1565 .name = KGSL_3D0_IRQ,
1566 .start = MSM8625_INT_GRAPHICS,
1567 .end = MSM8625_INT_GRAPHICS,
1568 .flags = IORESOURCE_IRQ,
1569 },
1570};
1571
1572struct platform_device msm8625_kgsl_3d0 = {
1573 .name = "kgsl-3d0",
1574 .id = 0,
1575 .num_resources = ARRAY_SIZE(msm8625_kgsl_3d0_resources),
1576 .resource = msm8625_kgsl_3d0_resources,
1577 .dev = {
1578 .platform_data = &kgsl_3d0_pdata,
1579 },
1580};
1581
Taniya Das7c9f0512011-12-02 14:26:46 +05301582static struct clk_lookup msm_clock_8625_dummy[] = {
1583 CLK_DUMMY("core_clk", adm_clk.c, "msm_dmov", 0),
1584 CLK_DUMMY("adsp_clk", adsp_clk.c, NULL, 0),
1585 CLK_DUMMY("ahb_m_clk", ahb_m_clk.c, NULL, 0),
1586 CLK_DUMMY("ahb_s_clk", ahb_s_clk.c, NULL, 0),
1587 CLK_DUMMY("cam_m_clk", cam_m_clk.c, NULL, 0),
1588 CLK_DUMMY("csi_clk", csi1_clk.c, NULL, 0),
1589 CLK_DUMMY("csi_pclk", csi1_p_clk.c, NULL, 0),
1590 CLK_DUMMY("csi_vfe_clk", csi1_vfe_clk.c, NULL, 0),
1591 CLK_DUMMY("dsi_byte_clk", dsi_byte_clk.c, NULL, 0),
1592 CLK_DUMMY("dsi_clk", dsi_clk.c, NULL, 0),
1593 CLK_DUMMY("dsi_esc_clk", dsi_esc_clk.c, NULL, 0),
1594 CLK_DUMMY("dsi_pixel_clk", dsi_pixel_clk.c, NULL, 0),
1595 CLK_DUMMY("dsi_ref_clk", dsi_ref_clk.c, NULL, 0),
1596 CLK_DUMMY("ebi1_clk", ebi1_clk.c, NULL, 0),
1597 CLK_DUMMY("ebi2_clk", ebi2_clk.c, NULL, 0),
1598 CLK_DUMMY("ecodec_clk", ecodec_clk.c, NULL, 0),
1599 CLK_DUMMY("gp_clk", gp_clk.c, NULL, 0),
1600 CLK_DUMMY("core_clk", gsbi1_qup_clk.c, "qup_i2c.0", 0),
1601 CLK_DUMMY("core_clk", gsbi2_qup_clk.c, "qup_i2c.1", 0),
1602 CLK_DUMMY("iface_clk", gsbi1_qup_p_clk.c, "qup_i2c.0", 0),
1603 CLK_DUMMY("iface_clk", gsbi2_qup_p_clk.c, "qup_i2c.1", 0),
1604 CLK_DUMMY("icodec_rx_clk", icodec_rx_clk.c, NULL, 0),
1605 CLK_DUMMY("icodec_tx_clk", icodec_tx_clk.c, NULL, 0),
1606 CLK_DUMMY("mem_clk", imem_clk.c, NULL, 0),
1607 CLK_DUMMY("mddi_clk", pmdh_clk.c, NULL, 0),
1608 CLK_DUMMY("mdp_clk", mdp_clk.c, NULL, 0),
1609 CLK_DUMMY("mdp_lcdc_pclk_clk", mdp_lcdc_pclk_clk.c, NULL, 0),
1610 CLK_DUMMY("mdp_lcdc_pad_pclk_clk", mdp_lcdc_pad_pclk_clk.c, NULL, 0),
1611 CLK_DUMMY("mdp_vsync_clk", mdp_vsync_clk.c, NULL, 0),
1612 CLK_DUMMY("mdp_dsi_pclk", mdp_dsi_p_clk.c, NULL, 0),
1613 CLK_DUMMY("pbus_clk", pbus_clk.c, NULL, 0),
1614 CLK_DUMMY("pcm_clk", pcm_clk.c, NULL, 0),
1615 CLK_DUMMY("sdac_clk", sdac_clk.c, NULL, 0),
1616 CLK_DUMMY("core_clk", sdc1_clk.c, "msm_sdcc.1", 0),
1617 CLK_DUMMY("iface_clk", sdc1_p_clk.c, "msm_sdcc.1", 0),
1618 CLK_DUMMY("core_clk", sdc2_clk.c, "msm_sdcc.2", 0),
1619 CLK_DUMMY("iface_clk", sdc2_p_clk.c, "msm_sdcc.2", 0),
1620 CLK_DUMMY("core_clk", sdc3_clk.c, "msm_sdcc.3", 0),
1621 CLK_DUMMY("iface_clk", sdc3_p_clk.c, "msm_sdcc.3", 0),
1622 CLK_DUMMY("core_clk", sdc4_clk.c, "msm_sdcc.4", 0),
1623 CLK_DUMMY("iface_clk", sdc4_p_clk.c, "msm_sdcc.4", 0),
1624 CLK_DUMMY("ref_clk", tsif_ref_clk.c, "msm_tsif.0", 0),
1625 CLK_DUMMY("iface_clk", tsif_p_clk.c, "msm_tsif.0", 0),
1626 CLK_DUMMY("core_clk", uart1_clk.c, "msm_serial.0", 0),
1627 CLK_DUMMY("core_clk", uart2_clk.c, "msm_serial.1", 0),
1628 CLK_DUMMY("core_clk", uart1dm_clk.c, "msm_serial_hs.0", 0),
1629 CLK_DUMMY("core_clk", uart2dm_clk.c, "msm_serial_hsl.0", 0),
1630 CLK_DUMMY("usb_hs_core_clk", usb_hs_core_clk.c, NULL, 0),
1631 CLK_DUMMY("usb_hs2_clk", usb_hs2_clk.c, NULL, 0),
1632 CLK_DUMMY("usb_hs_clk", usb_hs_clk.c, NULL, 0),
1633 CLK_DUMMY("usb_hs_pclk", usb_hs_p_clk.c, NULL, 0),
1634 CLK_DUMMY("usb_phy_clk", usb_phy_clk.c, NULL, 0),
1635 CLK_DUMMY("vdc_clk", vdc_clk.c, NULL, 0),
1636 CLK_DUMMY("ebi1_acpu_clk", ebi_acpu_clk.c, NULL, 0),
1637 CLK_DUMMY("ebi1_lcdc_clk", ebi_lcdc_clk.c, NULL, 0),
1638 CLK_DUMMY("ebi1_mddi_clk", ebi_mddi_clk.c, NULL, 0),
1639 CLK_DUMMY("ebi1_usb_clk", ebi_usb_clk.c, NULL, 0),
1640 CLK_DUMMY("ebi1_vfe_clk", ebi_vfe_clk.c, NULL, 0),
1641 CLK_DUMMY("mem_clk", ebi_adm_clk.c, "msm_dmov", 0),
1642};
1643
1644struct clock_init_data msm8625_dummy_clock_init_data __initdata = {
1645 .table = msm_clock_8625_dummy,
1646 .size = ARRAY_SIZE(msm_clock_8625_dummy),
1647};
1648
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301649enum {
1650 MSM8625,
1651 MSM8625A,
Kaushal Kumar86473f02012-06-28 19:35:58 +05301652 MSM8625AB,
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301653};
1654
1655static int __init msm8625_cpu_id(void)
1656{
1657 int raw_id, cpu;
1658
1659 raw_id = socinfo_get_raw_id();
1660 switch (raw_id) {
1661 /* Part number for 1GHz part */
1662 case 0x770:
1663 case 0x771:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301664 case 0x77C:
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301665 case 0x780:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301666 case 0x8D0:
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301667 cpu = MSM8625;
1668 break;
1669 /* Part number for 1.2GHz part */
1670 case 0x773:
1671 case 0x774:
1672 case 0x781:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301673 case 0x8D1:
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301674 cpu = MSM8625A;
1675 break;
Kaushal Kumar86473f02012-06-28 19:35:58 +05301676 case 0x775:
1677 case 0x776:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301678 case 0x77D:
Kaushal Kumar86473f02012-06-28 19:35:58 +05301679 case 0x782:
Kaushal Kumar8f516512012-08-03 19:43:24 +05301680 case 0x8D2:
Kaushal Kumar86473f02012-06-28 19:35:58 +05301681 cpu = MSM8625AB;
1682 break;
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301683 default:
1684 pr_err("Invalid Raw ID\n");
1685 return -ENODEV;
1686 }
1687 return cpu;
1688}
1689
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001690int __init msm7x2x_misc_init(void)
1691{
Taniya Das7c9f0512011-12-02 14:26:46 +05301692 if (machine_is_msm8625_rumi3()) {
1693 msm_clock_init(&msm8625_dummy_clock_init_data);
Taniya Das43bcdd62011-12-02 17:33:27 +05301694 return 0;
Taniya Das7c9f0512011-12-02 14:26:46 +05301695 }
Taniya Das43bcdd62011-12-02 17:33:27 +05301696
Stephen Boydbb600ae2011-08-02 20:11:40 -07001697 msm_clock_init(&msm7x27a_clock_init_data);
Pankaj Kumarfee56a82012-04-17 14:26:49 +05301698 if (cpu_is_msm7x27aa() || cpu_is_msm7x25ab())
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001699 platform_device_register(&msm7x27aa_device_acpuclk);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301700 else if (cpu_is_msm8625()) {
1701 if (msm8625_cpu_id() == MSM8625)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001702 platform_device_register(&msm7x27aa_device_acpuclk);
Pankaj Kumar50c705c2012-01-10 12:02:07 +05301703 else if (msm8625_cpu_id() == MSM8625A)
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001704 platform_device_register(&msm8625_device_acpuclk);
Kaushal Kumar86473f02012-06-28 19:35:58 +05301705 else if (msm8625_cpu_id() == MSM8625AB)
1706 platform_device_register(&msm8625ab_device_acpuclk);
Matt Wagantallbf430eb2012-03-22 11:45:49 -07001707 } else {
1708 platform_device_register(&msm7x27a_device_acpuclk);
1709 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001710 return 0;
1711}
1712
1713#ifdef CONFIG_CACHE_L2X0
1714static int __init msm7x27x_cache_init(void)
1715{
1716 int aux_ctrl = 0;
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301717 int pctrl = 0;
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001718
1719 /* Way Size 010(0x2) 32KB */
1720 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
1721 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
1722 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
1723
Taniya Das379b5682011-12-02 14:53:46 +05301724 if (cpu_is_msm8625()) {
1725 /* Way Size 011(0x3) 64KB */
1726 aux_ctrl |= (0x3 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
1727 (0x1 << L2X0_AUX_CTRL_DATA_PREFETCH_SHIFT) | \
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301728 (0X1 << L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT) | \
1729 (0x1 << L2X0_AUX_CTRL_L2_FORCE_NWA_SHIFT);
1730
1731 /* Write Prefetch Control settings */
1732 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
1733 pctrl |= (0x3 << L2X0_PREFETCH_CTRL_OFFSET_SHIFT) | \
1734 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_INC_SHIFT) | \
1735 (0x1 << L2X0_PREFETCH_CTRL_WRAP8_SHIFT);
1736 writel_relaxed(pctrl , MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
Taniya Das379b5682011-12-02 14:53:46 +05301737 }
1738
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001739 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
Prachee Ramsinghani86b1f652012-04-03 16:01:30 +05301740 if (cpu_is_msm8625()) {
1741 pctrl = readl_relaxed(MSM_L2CC_BASE + L2X0_PREFETCH_CTRL);
1742 pr_info("Prfetch Ctrl: 0x%08x\n", pctrl);
1743 }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001744
1745 return 0;
1746}
1747#else
pankaj kumar80d7cb62011-08-23 13:37:55 +05301748static int __init msm7x27x_cache_init(void){ return 0; }
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001749#endif
1750
1751void __init msm_common_io_init(void)
1752{
1753 msm_map_common_io();
Taniya Das43bcdd62011-12-02 17:33:27 +05301754 if (socinfo_init() < 0)
1755 pr_err("%s: socinfo_init() failed!\n", __func__);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001756 msm7x27x_cache_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301757}
1758
1759void __init msm8625_init_irq(void)
1760{
Trilok Soni1a9fdee2012-05-28 19:54:11 +05301761 msm_gic_irq_extn_init();
Taniya Das43bcdd62011-12-02 17:33:27 +05301762 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1763 (void *)MSM_QGIC_CPU_BASE);
Taniya Das43bcdd62011-12-02 17:33:27 +05301764}
1765
1766void __init msm8625_map_io(void)
1767{
1768 msm_map_msm8625_io();
1769
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001770 if (socinfo_init() < 0)
1771 pr_err("%s: socinfo_init() failed!\n", __func__);
Taniya Das379b5682011-12-02 14:53:46 +05301772 msm7x27x_cache_init();
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001773}
1774
Taniya Das43bcdd62011-12-02 17:33:27 +05301775static int msm7627a_init_gpio(void)
1776{
Taniya Das6684d622012-01-12 10:29:09 +05301777 if (cpu_is_msm8625())
1778 platform_device_register(&msm8625_device_gpio);
1779 else
1780 platform_device_register(&msm_device_gpio);
Taniya Das43bcdd62011-12-02 17:33:27 +05301781 return 0;
1782}
1783postcore_initcall(msm7627a_init_gpio);
Taniya Das9d0c3c52012-05-04 14:40:55 +05301784
1785static int msm7627a_panic_handler(struct notifier_block *this,
1786 unsigned long event, void *ptr)
1787{
1788 flush_cache_all();
1789 outer_flush_all();
1790 return NOTIFY_DONE;
1791}
1792
1793static struct notifier_block panic_handler = {
1794 .notifier_call = msm7627a_panic_handler,
1795};
1796
1797static int __init panic_register(void)
1798{
1799 atomic_notifier_chain_register(&panic_notifier_list,
1800 &panic_handler);
1801 return 0;
1802}
1803module_init(panic_register);