blob: 0b204a0d1c88596eb0377f7438ee5548a2d0402e [file] [log] [blame]
Ofir Cohen06789f12012-01-16 09:43:13 +02001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -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
14#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/irq.h>
17#include <linux/io.h>
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -070018#include <linux/msm_tsens.h>
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -070019#include <linux/platform_data/qcom_crypto_device.h>
Amit Blay5e4ec192011-10-20 09:16:54 +020020#include <linux/dma-mapping.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070021#include <asm/hardware/gic.h>
Sahitya Tummala38295432011-09-29 10:08:45 +053022#include <asm/mach/flash.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070023#include <mach/board.h>
24#include <mach/msm_iomap.h>
Amit Blay5e4ec192011-10-20 09:16:54 +020025#include <mach/msm_hsusb.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070026#include <mach/irqs.h>
27#include <mach/socinfo.h>
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -060028#include <mach/rpm.h>
Gagan Mac7a827642011-09-22 19:42:21 -060029#include <mach/msm_bus_board.h>
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -070030#include <asm/hardware/cache-l2x0.h>
Yan He092b7272011-09-21 15:25:03 -070031#include <mach/msm_sps.h>
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070032#include <mach/dma.h>
Matt Wagantall7cca4642012-02-01 16:43:24 -080033#include "pm.h"
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070034#include "devices.h"
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -060035#include "mpm.h"
36#include "spm.h"
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -060037#include "rpm_resources.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -070038#include "msm_watchdog.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060039#include "rpm_stats.h"
40#include "rpm_log.h"
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070041
Harini Jayaramaneba52672011-09-08 15:13:00 -060042/* Address of GSBI blocks */
43#define MSM_GSBI1_PHYS 0x16000000
44#define MSM_GSBI2_PHYS 0x16100000
45#define MSM_GSBI3_PHYS 0x16200000
Rohit Vaswani09666872011-08-23 17:41:54 -070046#define MSM_GSBI4_PHYS 0x16300000
Harini Jayaramaneba52672011-09-08 15:13:00 -060047#define MSM_GSBI5_PHYS 0x16400000
48
Rohit Vaswani09666872011-08-23 17:41:54 -070049#define MSM_UART4DM_PHYS (MSM_GSBI4_PHYS + 0x40000)
50
Harini Jayaramaneba52672011-09-08 15:13:00 -060051/* GSBI QUP devices */
52#define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000)
53#define MSM_GSBI2_QUP_PHYS (MSM_GSBI2_PHYS + 0x80000)
54#define MSM_GSBI3_QUP_PHYS (MSM_GSBI3_PHYS + 0x80000)
55#define MSM_GSBI4_QUP_PHYS (MSM_GSBI4_PHYS + 0x80000)
56#define MSM_GSBI5_QUP_PHYS (MSM_GSBI5_PHYS + 0x80000)
57#define MSM_QUP_SIZE SZ_4K
58
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070059/* Address of SSBI CMD */
60#define MSM_PMIC1_SSBI_CMD_PHYS 0x00500000
61#define MSM_PMIC_SSBI_SIZE SZ_4K
62
Jeff Ohlstein7e668552011-10-06 16:17:25 -070063static struct msm_watchdog_pdata msm_watchdog_pdata = {
64 .pet_time = 10000,
65 .bark_time = 11000,
66 .has_secure = true,
67};
68
69struct platform_device msm9615_device_watchdog = {
70 .name = "msm_watchdog",
71 .id = -1,
72 .dev = {
73 .platform_data = &msm_watchdog_pdata,
74 },
75};
76
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070077static struct resource msm_dmov_resource[] = {
78 {
79 .start = ADM_0_SCSS_1_IRQ,
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070080 .flags = IORESOURCE_IRQ,
81 },
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -070082 {
83 .start = 0x18320000,
84 .end = 0x18320000 + SZ_1M - 1,
85 .flags = IORESOURCE_MEM,
86 },
87};
88
89static struct msm_dmov_pdata msm_dmov_pdata = {
90 .sd = 1,
91 .sd_size = 0x800,
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070092};
93
94struct platform_device msm9615_device_dmov = {
95 .name = "msm_dmov",
96 .id = -1,
97 .resource = msm_dmov_resource,
98 .num_resources = ARRAY_SIZE(msm_dmov_resource),
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -070099 .dev = {
100 .platform_data = &msm_dmov_pdata,
101 },
Jeff Ohlsteind19bf442011-09-09 12:48:18 -0700102};
103
Ofir Cohen40a4e862011-12-08 15:17:52 +0200104#define MSM_USB_BAM_BASE 0x12502000
Ofir Cohen010009b2012-01-26 16:49:17 +0200105#define MSM_USB_BAM_SIZE SZ_16K
106#define MSM_HSIC_BAM_BASE 0x12542000
107#define MSM_HSIC_BAM_SIZE SZ_16K
Ofir Cohen40a4e862011-12-08 15:17:52 +0200108
Amit Blay5e4ec192011-10-20 09:16:54 +0200109static struct resource resources_otg[] = {
110 {
111 .start = MSM9615_HSUSB_PHYS,
112 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_SIZE - 1,
113 .flags = IORESOURCE_MEM,
114 },
115 {
116 .start = USB1_HS_IRQ,
117 .end = USB1_HS_IRQ,
118 .flags = IORESOURCE_IRQ,
119 },
120};
121
122struct platform_device msm_device_otg = {
123 .name = "msm_otg",
124 .id = -1,
125 .num_resources = ARRAY_SIZE(resources_otg),
126 .resource = resources_otg,
127 .dev = {
128 .coherent_dma_mask = DMA_BIT_MASK(32),
129 },
130};
131
132static struct resource resources_hsusb[] = {
133 {
134 .start = MSM9615_HSUSB_PHYS,
135 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_SIZE - 1,
136 .flags = IORESOURCE_MEM,
137 },
138 {
139 .start = USB1_HS_IRQ,
140 .end = USB1_HS_IRQ,
141 .flags = IORESOURCE_IRQ,
142 },
143};
144
Ofir Cohen40a4e862011-12-08 15:17:52 +0200145static struct resource resources_usb_bam[] = {
146 {
147 .name = "usb_bam_addr",
148 .start = MSM_USB_BAM_BASE,
Ofir Cohen010009b2012-01-26 16:49:17 +0200149 .end = MSM_USB_BAM_BASE + MSM_USB_BAM_SIZE - 1,
Ofir Cohen40a4e862011-12-08 15:17:52 +0200150 .flags = IORESOURCE_MEM,
151 },
152 {
153 .name = "usb_bam_irq",
154 .start = USB1_HS_BAM_IRQ,
155 .end = USB1_HS_BAM_IRQ,
156 .flags = IORESOURCE_IRQ,
157 },
Ofir Cohen010009b2012-01-26 16:49:17 +0200158 {
159 .name = "hsic_bam_addr",
160 .start = MSM_HSIC_BAM_BASE,
161 .end = MSM_HSIC_BAM_BASE + MSM_HSIC_BAM_SIZE - 1,
162 .flags = IORESOURCE_MEM,
163 },
164 {
165 .name = "hsic_bam_irq",
166 .start = USB_HSIC_BAM_IRQ,
167 .end = USB_HSIC_BAM_IRQ,
168 .flags = IORESOURCE_IRQ,
169 },
Ofir Cohen40a4e862011-12-08 15:17:52 +0200170};
171
172struct platform_device msm_device_usb_bam = {
173 .name = "usb_bam",
174 .id = -1,
175 .num_resources = ARRAY_SIZE(resources_usb_bam),
176 .resource = resources_usb_bam,
177};
178
Amit Blay5e4ec192011-10-20 09:16:54 +0200179struct platform_device msm_device_gadget_peripheral = {
180 .name = "msm_hsusb",
181 .id = -1,
182 .num_resources = ARRAY_SIZE(resources_hsusb),
183 .resource = resources_hsusb,
184 .dev = {
185 .coherent_dma_mask = DMA_BIT_MASK(32),
186 },
187};
188
Ofir Cohen06789f12012-01-16 09:43:13 +0200189static struct resource resources_hsic_peripheral[] = {
190 {
191 .start = MSM9615_HSIC_PHYS,
192 .end = MSM9615_HSIC_PHYS + MSM9615_HSIC_SIZE - 1,
193 .flags = IORESOURCE_MEM,
194 },
195 {
196 .start = USB_HSIC_IRQ,
197 .end = USB_HSIC_IRQ,
198 .flags = IORESOURCE_IRQ,
199 },
200};
201
202struct platform_device msm_device_hsic_peripheral = {
203 .name = "msm_hsic_peripheral",
204 .id = -1,
205 .num_resources = ARRAY_SIZE(resources_hsic_peripheral),
206 .resource = resources_hsic_peripheral,
207 .dev = {
208 .coherent_dma_mask = DMA_BIT_MASK(32),
209 },
210};
211
Amit Blay6a8d4f32011-11-21 10:36:25 +0200212static struct resource resources_hsusb_host[] = {
213 {
214 .start = MSM9615_HSUSB_PHYS,
215 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_PHYS - 1,
216 .flags = IORESOURCE_MEM,
217 },
218 {
219 .start = USB1_HS_IRQ,
220 .end = USB1_HS_IRQ,
221 .flags = IORESOURCE_IRQ,
222 },
223};
224
225static u64 dma_mask = DMA_BIT_MASK(32);
226struct platform_device msm_device_hsusb_host = {
227 .name = "msm_hsusb_host",
228 .id = -1,
229 .num_resources = ARRAY_SIZE(resources_hsusb_host),
230 .resource = resources_hsusb_host,
231 .dev = {
232 .dma_mask = &dma_mask,
233 .coherent_dma_mask = 0xffffffff,
234 },
235};
236
Lena Salman65bcf372012-02-14 15:33:32 +0200237static struct resource resources_hsic_host[] = {
238 {
239 .start = MSM9615_HSIC_PHYS,
240 .end = MSM9615_HSIC_PHYS + MSM9615_HSIC_SIZE - 1,
241 .flags = IORESOURCE_MEM,
242 },
243 {
244 .start = USB_HSIC_IRQ,
245 .end = USB_HSIC_IRQ,
246 .flags = IORESOURCE_IRQ,
247 },
248};
249
250struct platform_device msm_device_hsic_host = {
251 .name = "msm_hsic_host",
252 .id = -1,
253 .num_resources = ARRAY_SIZE(resources_hsic_host),
254 .resource = resources_hsic_host,
255 .dev = {
256 .dma_mask = &dma_mask,
257 .coherent_dma_mask = 0xffffffff,
258 },
259};
260
Rohit Vaswani09666872011-08-23 17:41:54 -0700261static struct resource resources_uart_gsbi4[] = {
262 {
263 .start = GSBI4_UARTDM_IRQ,
264 .end = GSBI4_UARTDM_IRQ,
265 .flags = IORESOURCE_IRQ,
266 },
267 {
268 .start = MSM_UART4DM_PHYS,
269 .end = MSM_UART4DM_PHYS + PAGE_SIZE - 1,
270 .name = "uartdm_resource",
271 .flags = IORESOURCE_MEM,
272 },
273 {
274 .start = MSM_GSBI4_PHYS,
275 .end = MSM_GSBI4_PHYS + PAGE_SIZE - 1,
276 .name = "gsbi_resource",
277 .flags = IORESOURCE_MEM,
278 },
279};
280
281struct platform_device msm9615_device_uart_gsbi4 = {
282 .name = "msm_serial_hsl",
283 .id = 0,
284 .num_resources = ARRAY_SIZE(resources_uart_gsbi4),
285 .resource = resources_uart_gsbi4,
286};
287
Harini Jayaramaneba52672011-09-08 15:13:00 -0600288static struct resource resources_qup_i2c_gsbi5[] = {
289 {
290 .name = "gsbi_qup_i2c_addr",
291 .start = MSM_GSBI5_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600292 .end = MSM_GSBI5_PHYS + 4 - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600293 .flags = IORESOURCE_MEM,
294 },
295 {
296 .name = "qup_phys_addr",
297 .start = MSM_GSBI5_QUP_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600298 .end = MSM_GSBI5_QUP_PHYS + MSM_QUP_SIZE - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600299 .flags = IORESOURCE_MEM,
300 },
301 {
302 .name = "qup_err_intr",
303 .start = GSBI5_QUP_IRQ,
304 .end = GSBI5_QUP_IRQ,
305 .flags = IORESOURCE_IRQ,
306 },
307};
308
309struct platform_device msm9615_device_qup_i2c_gsbi5 = {
310 .name = "qup_i2c",
311 .id = 0,
312 .num_resources = ARRAY_SIZE(resources_qup_i2c_gsbi5),
313 .resource = resources_qup_i2c_gsbi5,
314};
315
Harini Jayaraman738c9312011-09-08 15:22:38 -0600316static struct resource resources_qup_spi_gsbi3[] = {
317 {
318 .name = "spi_base",
319 .start = MSM_GSBI3_QUP_PHYS,
320 .end = MSM_GSBI3_QUP_PHYS + SZ_4K - 1,
321 .flags = IORESOURCE_MEM,
322 },
323 {
324 .name = "gsbi_base",
325 .start = MSM_GSBI3_PHYS,
326 .end = MSM_GSBI3_PHYS + 4 - 1,
327 .flags = IORESOURCE_MEM,
328 },
329 {
330 .name = "spi_irq_in",
331 .start = GSBI3_QUP_IRQ,
332 .end = GSBI3_QUP_IRQ,
333 .flags = IORESOURCE_IRQ,
334 },
335};
336
337struct platform_device msm9615_device_qup_spi_gsbi3 = {
338 .name = "spi_qsd",
339 .id = 0,
340 .num_resources = ARRAY_SIZE(resources_qup_spi_gsbi3),
341 .resource = resources_qup_spi_gsbi3,
342};
343
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700344#define LPASS_SLIMBUS_PHYS 0x28080000
345#define LPASS_SLIMBUS_BAM_PHYS 0x28084000
346#define LPASS_SLIMBUS_SLEW (MSM9615_TLMM_PHYS + 0x207C)
347/* Board info for the slimbus slave device */
348static struct resource slimbus_res[] = {
349 {
350 .start = LPASS_SLIMBUS_PHYS,
351 .end = LPASS_SLIMBUS_PHYS + 8191,
352 .flags = IORESOURCE_MEM,
353 .name = "slimbus_physical",
354 },
355 {
356 .start = LPASS_SLIMBUS_BAM_PHYS,
357 .end = LPASS_SLIMBUS_BAM_PHYS + 8191,
358 .flags = IORESOURCE_MEM,
359 .name = "slimbus_bam_physical",
360 },
361 {
362 .start = LPASS_SLIMBUS_SLEW,
363 .end = LPASS_SLIMBUS_SLEW + 4 - 1,
364 .flags = IORESOURCE_MEM,
365 .name = "slimbus_slew_reg",
366 },
367 {
368 .start = SLIMBUS0_CORE_EE1_IRQ,
369 .end = SLIMBUS0_CORE_EE1_IRQ,
370 .flags = IORESOURCE_IRQ,
371 .name = "slimbus_irq",
372 },
373 {
374 .start = SLIMBUS0_BAM_EE1_IRQ,
375 .end = SLIMBUS0_BAM_EE1_IRQ,
376 .flags = IORESOURCE_IRQ,
377 .name = "slimbus_bam_irq",
378 },
379};
380
381struct platform_device msm9615_slim_ctrl = {
382 .name = "msm_slim_ctrl",
383 .id = 1,
384 .num_resources = ARRAY_SIZE(slimbus_res),
385 .resource = slimbus_res,
386 .dev = {
387 .coherent_dma_mask = 0xffffffffULL,
388 },
389};
390
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700391static struct resource resources_ssbi_pmic1[] = {
392 {
393 .start = MSM_PMIC1_SSBI_CMD_PHYS,
394 .end = MSM_PMIC1_SSBI_CMD_PHYS + MSM_PMIC_SSBI_SIZE - 1,
395 .flags = IORESOURCE_MEM,
396 },
397};
398
399struct platform_device msm9615_device_ssbi_pmic1 = {
400 .name = "msm_ssbi",
401 .id = 0,
402 .resource = resources_ssbi_pmic1,
403 .num_resources = ARRAY_SIZE(resources_ssbi_pmic1),
404};
405
Yan He092b7272011-09-21 15:25:03 -0700406static struct resource resources_sps[] = {
407 {
408 .name = "pipe_mem",
409 .start = 0x12800000,
410 .end = 0x12800000 + 0x4000 - 1,
411 .flags = IORESOURCE_MEM,
412 },
413 {
414 .name = "bamdma_dma",
415 .start = 0x12240000,
416 .end = 0x12240000 + 0x1000 - 1,
417 .flags = IORESOURCE_MEM,
418 },
419 {
420 .name = "bamdma_bam",
421 .start = 0x12244000,
422 .end = 0x12244000 + 0x4000 - 1,
423 .flags = IORESOURCE_MEM,
424 },
425 {
426 .name = "bamdma_irq",
427 .start = SPS_BAM_DMA_IRQ,
428 .end = SPS_BAM_DMA_IRQ,
429 .flags = IORESOURCE_IRQ,
430 },
431};
432
433struct msm_sps_platform_data msm_sps_pdata = {
434 .bamdma_restricted_pipes = 0x06,
435};
436
437struct platform_device msm_device_sps = {
438 .name = "msm_sps",
439 .id = -1,
440 .num_resources = ARRAY_SIZE(resources_sps),
441 .resource = resources_sps,
442 .dev.platform_data = &msm_sps_pdata,
443};
444
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700445static struct tsens_platform_data msm_tsens_pdata = {
Siddartha Mohanadosscaeaa922012-02-07 16:41:38 -0800446 .slope = {872, 872, 872, 872, 872},
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700447 .tsens_factor = 1000,
448 .hw_type = MSM_9615,
449 .tsens_num_sensor = 5,
450};
451
Sahitya Tummala38295432011-09-29 10:08:45 +0530452struct platform_device msm9615_device_tsens = {
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700453 .name = "tsens8960-tm",
454 .id = -1,
Sahitya Tummala38295432011-09-29 10:08:45 +0530455 .dev = {
456 .platform_data = &msm_tsens_pdata,
457 },
458};
459
460#define MSM_NAND_PHYS 0x1B400000
461static struct resource resources_nand[] = {
462 [0] = {
463 .name = "msm_nand_dmac",
464 .start = DMOV_NAND_CHAN,
465 .end = DMOV_NAND_CHAN,
466 .flags = IORESOURCE_DMA,
467 },
468 [1] = {
469 .name = "msm_nand_phys",
470 .start = MSM_NAND_PHYS,
471 .end = MSM_NAND_PHYS + 0x7FF,
472 .flags = IORESOURCE_MEM,
473 },
474};
475
476struct flash_platform_data msm_nand_data = {
477 .parts = NULL,
478 .nr_parts = 0,
479};
480
481struct platform_device msm_device_nand = {
482 .name = "msm_nand",
483 .id = -1,
484 .num_resources = ARRAY_SIZE(resources_nand),
485 .resource = resources_nand,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700486 .dev = {
Sahitya Tummala38295432011-09-29 10:08:45 +0530487 .platform_data = &msm_nand_data,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700488 },
489};
490
Jeff Hugo56b933a2011-09-28 14:42:05 -0600491struct platform_device msm_device_smd = {
492 .name = "msm_smd",
493 .id = -1,
494};
495
Eric Holmberg0c96e702011-11-08 18:04:31 -0700496struct platform_device msm_device_bam_dmux = {
497 .name = "BAM_RMNT",
498 .id = -1,
499};
500
Ramesh Masavarapu5ad37392011-10-10 10:44:10 -0700501#ifdef CONFIG_HW_RANDOM_MSM
502/* PRNG device */
503#define MSM_PRNG_PHYS 0x1A500000
504static struct resource rng_resources = {
505 .flags = IORESOURCE_MEM,
506 .start = MSM_PRNG_PHYS,
507 .end = MSM_PRNG_PHYS + SZ_512 - 1,
508};
509
510struct platform_device msm_device_rng = {
511 .name = "msm_rng",
512 .id = 0,
513 .num_resources = 1,
514 .resource = &rng_resources,
515};
516#endif
Krishna Kondadd794462011-10-01 00:19:29 -0700517
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700518#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
519 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
520 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
521 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
522
523#define QCE_SIZE 0x10000
524#define QCE_0_BASE 0x18500000
525
526#define QCE_HW_KEY_SUPPORT 0
527#define QCE_SHA_HMAC_SUPPORT 1
528#define QCE_SHARE_CE_RESOURCE 1
529#define QCE_CE_SHARED 0
530
531static struct resource qcrypto_resources[] = {
532 [0] = {
533 .start = QCE_0_BASE,
534 .end = QCE_0_BASE + QCE_SIZE - 1,
535 .flags = IORESOURCE_MEM,
536 },
537 [1] = {
538 .name = "crypto_channels",
539 .start = DMOV_CE_IN_CHAN,
540 .end = DMOV_CE_OUT_CHAN,
541 .flags = IORESOURCE_DMA,
542 },
543 [2] = {
544 .name = "crypto_crci_in",
545 .start = DMOV_CE_IN_CRCI,
546 .end = DMOV_CE_IN_CRCI,
547 .flags = IORESOURCE_DMA,
548 },
549 [3] = {
550 .name = "crypto_crci_out",
551 .start = DMOV_CE_OUT_CRCI,
552 .end = DMOV_CE_OUT_CRCI,
553 .flags = IORESOURCE_DMA,
554 },
555};
556
557static struct resource qcedev_resources[] = {
558 [0] = {
559 .start = QCE_0_BASE,
560 .end = QCE_0_BASE + QCE_SIZE - 1,
561 .flags = IORESOURCE_MEM,
562 },
563 [1] = {
564 .name = "crypto_channels",
565 .start = DMOV_CE_IN_CHAN,
566 .end = DMOV_CE_OUT_CHAN,
567 .flags = IORESOURCE_DMA,
568 },
569 [2] = {
570 .name = "crypto_crci_in",
571 .start = DMOV_CE_IN_CRCI,
572 .end = DMOV_CE_IN_CRCI,
573 .flags = IORESOURCE_DMA,
574 },
575 [3] = {
576 .name = "crypto_crci_out",
577 .start = DMOV_CE_OUT_CRCI,
578 .end = DMOV_CE_OUT_CRCI,
579 .flags = IORESOURCE_DMA,
580 },
581};
582
583#endif
584
585#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
586 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
587
588static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
589 .ce_shared = QCE_CE_SHARED,
590 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
591 .hw_key_support = QCE_HW_KEY_SUPPORT,
592 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800593 .bus_scale_table = NULL,
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700594};
595
596struct platform_device msm9615_qcrypto_device = {
597 .name = "qcrypto",
598 .id = 0,
599 .num_resources = ARRAY_SIZE(qcrypto_resources),
600 .resource = qcrypto_resources,
601 .dev = {
602 .coherent_dma_mask = DMA_BIT_MASK(32),
603 .platform_data = &qcrypto_ce_hw_suppport,
604 },
605};
606#endif
607
608#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
609 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
610
611static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
612 .ce_shared = QCE_CE_SHARED,
613 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
614 .hw_key_support = QCE_HW_KEY_SUPPORT,
615 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800616 .bus_scale_table = NULL,
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700617};
618
619struct platform_device msm9615_qcedev_device = {
620 .name = "qce",
621 .id = 0,
622 .num_resources = ARRAY_SIZE(qcedev_resources),
623 .resource = qcedev_resources,
624 .dev = {
625 .coherent_dma_mask = DMA_BIT_MASK(32),
626 .platform_data = &qcedev_ce_hw_suppport,
627 },
628};
629#endif
630
Krishna Kondadd794462011-10-01 00:19:29 -0700631#define MSM_SDC1_BASE 0x12180000
632#define MSM_SDC1_DML_BASE (MSM_SDC1_BASE + 0x800)
633#define MSM_SDC1_BAM_BASE (MSM_SDC1_BASE + 0x2000)
Krishna Konda71aef182011-10-01 02:27:51 -0700634#define MSM_SDC2_BASE 0x12140000
635#define MSM_SDC2_DML_BASE (MSM_SDC2_BASE + 0x800)
636#define MSM_SDC2_BAM_BASE (MSM_SDC2_BASE + 0x2000)
Krishna Kondadd794462011-10-01 00:19:29 -0700637
638static struct resource resources_sdc1[] = {
639 {
640 .name = "core_mem",
641 .flags = IORESOURCE_MEM,
642 .start = MSM_SDC1_BASE,
643 .end = MSM_SDC1_DML_BASE - 1,
644 },
645 {
646 .name = "core_irq",
647 .flags = IORESOURCE_IRQ,
648 .start = SDC1_IRQ_0,
649 .end = SDC1_IRQ_0
650 },
651#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
652 {
653 .name = "sdcc_dml_addr",
654 .start = MSM_SDC1_DML_BASE,
655 .end = MSM_SDC1_BAM_BASE - 1,
656 .flags = IORESOURCE_MEM,
657 },
658 {
659 .name = "sdcc_bam_addr",
660 .start = MSM_SDC1_BAM_BASE,
661 .end = MSM_SDC1_BAM_BASE + (2 * SZ_4K) - 1,
662 .flags = IORESOURCE_MEM,
663 },
664 {
665 .name = "sdcc_bam_irq",
666 .start = SDC1_BAM_IRQ,
667 .end = SDC1_BAM_IRQ,
668 .flags = IORESOURCE_IRQ,
669 },
670#endif
671};
672
Krishna Konda71aef182011-10-01 02:27:51 -0700673static struct resource resources_sdc2[] = {
674 {
675 .name = "core_mem",
676 .flags = IORESOURCE_MEM,
677 .start = MSM_SDC2_BASE,
678 .end = MSM_SDC2_DML_BASE - 1,
679 },
680 {
681 .name = "core_irq",
682 .flags = IORESOURCE_IRQ,
683 .start = SDC2_IRQ_0,
684 .end = SDC2_IRQ_0
685 },
686#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
687 {
688 .name = "sdcc_dml_addr",
689 .start = MSM_SDC2_DML_BASE,
690 .end = MSM_SDC2_BAM_BASE - 1,
691 .flags = IORESOURCE_MEM,
692 },
693 {
694 .name = "sdcc_bam_addr",
695 .start = MSM_SDC2_BAM_BASE,
696 .end = MSM_SDC2_BAM_BASE + (2 * SZ_4K) - 1,
697 .flags = IORESOURCE_MEM,
698 },
699 {
700 .name = "sdcc_bam_irq",
701 .start = SDC2_BAM_IRQ,
702 .end = SDC2_BAM_IRQ,
703 .flags = IORESOURCE_IRQ,
704 },
705#endif
706};
707
Krishna Kondadd794462011-10-01 00:19:29 -0700708struct platform_device msm_device_sdc1 = {
709 .name = "msm_sdcc",
710 .id = 1,
711 .num_resources = ARRAY_SIZE(resources_sdc1),
712 .resource = resources_sdc1,
713 .dev = {
714 .coherent_dma_mask = 0xffffffff,
715 },
716};
717
Krishna Konda71aef182011-10-01 02:27:51 -0700718struct platform_device msm_device_sdc2 = {
719 .name = "msm_sdcc",
720 .id = 2,
721 .num_resources = ARRAY_SIZE(resources_sdc2),
722 .resource = resources_sdc2,
723 .dev = {
724 .coherent_dma_mask = 0xffffffff,
725 },
726};
727
Krishna Kondadd794462011-10-01 00:19:29 -0700728static struct platform_device *msm_sdcc_devices[] __initdata = {
729 &msm_device_sdc1,
Krishna Konda71aef182011-10-01 02:27:51 -0700730 &msm_device_sdc2,
Krishna Kondadd794462011-10-01 00:19:29 -0700731};
732
733int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
734{
735 struct platform_device *pdev;
736
737 if (controller < 1 || controller > 2)
738 return -EINVAL;
739
740 pdev = msm_sdcc_devices[controller - 1];
741 pdev->dev.platform_data = plat;
742 return platform_device_register(pdev);
743}
744
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700745#ifdef CONFIG_CACHE_L2X0
746static int __init l2x0_cache_init(void)
747{
748 int aux_ctrl = 0;
749
750 /* Way Size 010(0x2) 32KB */
751 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
752 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
753 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
754
755 /* L2 Latency setting required by hardware. Default is 0x20
756 which is no good.
757 */
758 writel_relaxed(0x220, MSM_L2CC_BASE + L2X0_DATA_LATENCY_CTRL);
759 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
760
761 return 0;
762}
763#else
764static int __init l2x0_cache_init(void){ return 0; }
765#endif
766
Praveen Chidambaram78499012011-11-01 17:15:17 -0600767struct msm_rpm_platform_data msm9615_rpm_data __initdata = {
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600768 .reg_base_addrs = {
769 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
770 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
771 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
772 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
773 },
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600774 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600775 .ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
776 .ipc_rpm_val = 4,
777 .target_id = {
778 MSM_RPM_MAP(9615, NOTIFICATION_CONFIGURED_0, NOTIFICATION, 4),
779 MSM_RPM_MAP(9615, NOTIFICATION_REGISTERED_0, NOTIFICATION, 4),
780 MSM_RPM_MAP(9615, INVALIDATE_0, INVALIDATE, 8),
781 MSM_RPM_MAP(9615, TRIGGER_TIMED_TO, TRIGGER_TIMED, 1),
782 MSM_RPM_MAP(9615, TRIGGER_TIMED_SCLK_COUNT, TRIGGER_TIMED, 1),
783 MSM_RPM_MAP(9615, RPM_CTL, RPM_CTL, 1),
784 MSM_RPM_MAP(9615, CXO_CLK, CXO_CLK, 1),
785 MSM_RPM_MAP(9615, SYSTEM_FABRIC_CLK, SYSTEM_FABRIC_CLK, 1),
786 MSM_RPM_MAP(9615, DAYTONA_FABRIC_CLK, DAYTONA_FABRIC_CLK, 1),
787 MSM_RPM_MAP(9615, SFPB_CLK, SFPB_CLK, 1),
788 MSM_RPM_MAP(9615, CFPB_CLK, CFPB_CLK, 1),
789 MSM_RPM_MAP(9615, EBI1_CLK, EBI1_CLK, 1),
790 MSM_RPM_MAP(9615, SYS_FABRIC_CFG_HALT_0,
791 SYS_FABRIC_CFG_HALT, 2),
792 MSM_RPM_MAP(9615, SYS_FABRIC_CFG_CLKMOD_0,
793 SYS_FABRIC_CFG_CLKMOD, 3),
794 MSM_RPM_MAP(9615, SYS_FABRIC_CFG_IOCTL,
795 SYS_FABRIC_CFG_IOCTL, 1),
796 MSM_RPM_MAP(9615, SYSTEM_FABRIC_ARB_0,
797 SYSTEM_FABRIC_ARB, 27),
798 MSM_RPM_MAP(9615, PM8018_S1_0, PM8018_S1, 2),
799 MSM_RPM_MAP(9615, PM8018_S2_0, PM8018_S2, 2),
800 MSM_RPM_MAP(9615, PM8018_S3_0, PM8018_S3, 2),
801 MSM_RPM_MAP(9615, PM8018_S4_0, PM8018_S4, 2),
802 MSM_RPM_MAP(9615, PM8018_S5_0, PM8018_S5, 2),
803 MSM_RPM_MAP(9615, PM8018_L1_0, PM8018_L1, 2),
804 MSM_RPM_MAP(9615, PM8018_L2_0, PM8018_L2, 2),
805 MSM_RPM_MAP(9615, PM8018_L3_0, PM8018_L3, 2),
806 MSM_RPM_MAP(9615, PM8018_L4_0, PM8018_L4, 2),
807 MSM_RPM_MAP(9615, PM8018_L5_0, PM8018_L5, 2),
808 MSM_RPM_MAP(9615, PM8018_L6_0, PM8018_L6, 2),
809 MSM_RPM_MAP(9615, PM8018_L7_0, PM8018_L7, 2),
810 MSM_RPM_MAP(9615, PM8018_L8_0, PM8018_L8, 2),
811 MSM_RPM_MAP(9615, PM8018_L9_0, PM8018_L9, 2),
812 MSM_RPM_MAP(9615, PM8018_L10_0, PM8018_L10, 2),
813 MSM_RPM_MAP(9615, PM8018_L11_0, PM8018_L11, 2),
814 MSM_RPM_MAP(9615, PM8018_L12_0, PM8018_L12, 2),
815 MSM_RPM_MAP(9615, PM8018_L13_0, PM8018_L13, 2),
816 MSM_RPM_MAP(9615, PM8018_L14_0, PM8018_L14, 2),
817 MSM_RPM_MAP(9615, PM8018_LVS1, PM8018_LVS1, 1),
818 MSM_RPM_MAP(9615, NCP_0, NCP, 2),
819 MSM_RPM_MAP(9615, CXO_BUFFERS, CXO_BUFFERS, 1),
820 MSM_RPM_MAP(9615, USB_OTG_SWITCH, USB_OTG_SWITCH, 1),
821 MSM_RPM_MAP(9615, HDMI_SWITCH, HDMI_SWITCH, 1),
822 },
823 .target_status = {
824 MSM_RPM_STATUS_ID_MAP(9615, VERSION_MAJOR),
825 MSM_RPM_STATUS_ID_MAP(9615, VERSION_MINOR),
826 MSM_RPM_STATUS_ID_MAP(9615, VERSION_BUILD),
827 MSM_RPM_STATUS_ID_MAP(9615, SUPPORTED_RESOURCES_0),
828 MSM_RPM_STATUS_ID_MAP(9615, SUPPORTED_RESOURCES_1),
829 MSM_RPM_STATUS_ID_MAP(9615, SUPPORTED_RESOURCES_2),
830 MSM_RPM_STATUS_ID_MAP(9615, RESERVED_SUPPORTED_RESOURCES_0),
831 MSM_RPM_STATUS_ID_MAP(9615, SEQUENCE),
832 MSM_RPM_STATUS_ID_MAP(9615, RPM_CTL),
833 MSM_RPM_STATUS_ID_MAP(9615, CXO_CLK),
834 MSM_RPM_STATUS_ID_MAP(9615, SYSTEM_FABRIC_CLK),
835 MSM_RPM_STATUS_ID_MAP(9615, DAYTONA_FABRIC_CLK),
836 MSM_RPM_STATUS_ID_MAP(9615, SFPB_CLK),
837 MSM_RPM_STATUS_ID_MAP(9615, CFPB_CLK),
838 MSM_RPM_STATUS_ID_MAP(9615, EBI1_CLK),
839 MSM_RPM_STATUS_ID_MAP(9615, SYS_FABRIC_CFG_HALT),
840 MSM_RPM_STATUS_ID_MAP(9615, SYS_FABRIC_CFG_CLKMOD),
841 MSM_RPM_STATUS_ID_MAP(9615, SYS_FABRIC_CFG_IOCTL),
842 MSM_RPM_STATUS_ID_MAP(9615, SYSTEM_FABRIC_ARB),
843 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S1_0),
844 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S1_1),
845 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S2_0),
846 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S2_1),
847 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S3_0),
848 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S3_1),
849 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S4_0),
850 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S4_1),
851 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S5_0),
852 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S5_1),
853 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L1_0),
854 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L1_1),
855 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L2_0),
856 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L2_1),
857 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L3_0),
858 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L3_1),
859 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L4_0),
860 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L4_1),
861 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L5_0),
862 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L5_1),
863 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L6_0),
864 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L6_1),
865 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L7_0),
866 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L7_1),
867 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L8_0),
868 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L8_1),
869 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L9_0),
870 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L9_1),
871 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L10_0),
872 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L10_1),
873 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L11_0),
874 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L11_1),
875 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L12_0),
876 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L12_1),
877 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L13_0),
878 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L13_1),
879 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L14_0),
880 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L14_1),
881 MSM_RPM_STATUS_ID_MAP(9615, PM8018_LVS1),
882 MSM_RPM_STATUS_ID_MAP(9615, NCP_0),
883 MSM_RPM_STATUS_ID_MAP(9615, NCP_1),
884 MSM_RPM_STATUS_ID_MAP(9615, CXO_BUFFERS),
885 MSM_RPM_STATUS_ID_MAP(9615, USB_OTG_SWITCH),
886 MSM_RPM_STATUS_ID_MAP(9615, HDMI_SWITCH),
887 },
888 .target_ctrl_id = {
889 MSM_RPM_CTRL_MAP(9615, VERSION_MAJOR),
890 MSM_RPM_CTRL_MAP(9615, VERSION_MINOR),
891 MSM_RPM_CTRL_MAP(9615, VERSION_BUILD),
892 MSM_RPM_CTRL_MAP(9615, REQ_CTX_0),
893 MSM_RPM_CTRL_MAP(9615, REQ_SEL_0),
894 MSM_RPM_CTRL_MAP(9615, ACK_CTX_0),
895 MSM_RPM_CTRL_MAP(9615, ACK_SEL_0),
896 },
897 .sel_invalidate = MSM_RPM_9615_SEL_INVALIDATE,
898 .sel_notification = MSM_RPM_9615_SEL_NOTIFICATION,
899 .sel_last = MSM_RPM_9615_SEL_LAST,
900 .ver = {3, 0, 0},
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600901};
902
Praveen Chidambaram78499012011-11-01 17:15:17 -0600903struct platform_device msm9615_rpm_device = {
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600904 .name = "msm_rpm",
905 .id = -1,
906};
907
Praveen Chidambaram78499012011-11-01 17:15:17 -0600908static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = {
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -0600909 [4] = MSM_GPIO_TO_INT(30),
910 [5] = MSM_GPIO_TO_INT(59),
911 [6] = MSM_GPIO_TO_INT(81),
912 [7] = MSM_GPIO_TO_INT(87),
913 [8] = MSM_GPIO_TO_INT(86),
914 [9] = MSM_GPIO_TO_INT(2),
915 [10] = MSM_GPIO_TO_INT(6),
916 [11] = MSM_GPIO_TO_INT(10),
917 [12] = MSM_GPIO_TO_INT(14),
918 [13] = MSM_GPIO_TO_INT(18),
919 [14] = MSM_GPIO_TO_INT(7),
920 [15] = MSM_GPIO_TO_INT(11),
921 [16] = MSM_GPIO_TO_INT(15),
922 [19] = MSM_GPIO_TO_INT(26),
923 [20] = MSM_GPIO_TO_INT(28),
Ofir Cohendca06cb2012-03-08 16:37:45 +0200924 [22] = USB_HSIC_IRQ,
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -0600925 [23] = MSM_GPIO_TO_INT(19),
926 [24] = MSM_GPIO_TO_INT(23),
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -0600927 [26] = MSM_GPIO_TO_INT(3),
928 [27] = MSM_GPIO_TO_INT(68),
929 [29] = MSM_GPIO_TO_INT(78),
930 [31] = MSM_GPIO_TO_INT(0),
931 [32] = MSM_GPIO_TO_INT(4),
932 [33] = MSM_GPIO_TO_INT(22),
933 [34] = MSM_GPIO_TO_INT(17),
934 [37] = MSM_GPIO_TO_INT(20),
935 [39] = MSM_GPIO_TO_INT(84),
Mahesh Sivasubramanian4ce82182012-01-04 14:34:42 -0700936 [40] = USB1_HS_IRQ,
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -0600937 [42] = MSM_GPIO_TO_INT(24),
938 [43] = MSM_GPIO_TO_INT(79),
939 [44] = MSM_GPIO_TO_INT(80),
940 [45] = MSM_GPIO_TO_INT(82),
941 [46] = MSM_GPIO_TO_INT(85),
942 [47] = MSM_GPIO_TO_INT(45),
943 [48] = MSM_GPIO_TO_INT(50),
944 [49] = MSM_GPIO_TO_INT(51),
945 [50] = MSM_GPIO_TO_INT(69),
946 [51] = MSM_GPIO_TO_INT(77),
947 [52] = MSM_GPIO_TO_INT(1),
948 [53] = MSM_GPIO_TO_INT(5),
949 [54] = MSM_GPIO_TO_INT(40),
950 [55] = MSM_GPIO_TO_INT(27),
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600951};
952
Praveen Chidambaram78499012011-11-01 17:15:17 -0600953static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = {
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600954 TLMM_MSM_SUMMARY_IRQ,
955 RPM_APCC_CPU0_GP_HIGH_IRQ,
956 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
957 RPM_APCC_CPU0_GP_LOW_IRQ,
958 RPM_APCC_CPU0_WAKE_UP_IRQ,
Mahesh Sivasubramaniandbf2bb62011-12-12 16:03:40 -0700959 MSS_TO_APPS_IRQ_0,
960 MSS_TO_APPS_IRQ_1,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600961 LPASS_SCSS_GP_LOW_IRQ,
962 LPASS_SCSS_GP_MEDIUM_IRQ,
963 LPASS_SCSS_GP_HIGH_IRQ,
964 SPS_MTI_31,
Mahesh Sivasubramaniandbf2bb62011-12-12 16:03:40 -0700965 A2_BAM_IRQ,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600966};
967
Praveen Chidambaram78499012011-11-01 17:15:17 -0600968struct msm_mpm_device_data msm9615_mpm_dev_data __initdata = {
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600969 .irqs_m2a = msm_mpm_irqs_m2a,
970 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
971 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
972 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
973 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
974 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
975 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
976 .mpm_apps_ipc_val = BIT(1),
977 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600978};
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600979
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600980static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600981 0x00, 0x03, 0x00, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600982};
983
984static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600985 0x34, 0x24, 0x14, 0x04,
986 0x54, 0x03, 0x54, 0x04,
987 0x14, 0x24, 0x3e, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600988};
989
990static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600991 0x34, 0x24, 0x14, 0x04,
992 0x54, 0x07, 0x54, 0x04,
993 0x14, 0x24, 0x3e, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600994};
995
996static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
997 [0] = {
998 .mode = MSM_SPM_MODE_CLOCK_GATING,
999 .notify_rpm = false,
1000 .cmd = spm_wfi_cmd_sequence,
1001 },
1002 [1] = {
1003 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1004 .notify_rpm = false,
1005 .cmd = spm_power_collapse_without_rpm,
1006 },
1007 [2] = {
1008 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1009 .notify_rpm = true,
1010 .cmd = spm_power_collapse_with_rpm,
1011 },
1012};
1013
1014static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1015 [0] = {
1016 .reg_base_addr = MSM_SAW0_BASE,
1017 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -06001018 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1001,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -06001019 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1020 .modes = msm_spm_seq_list,
1021 },
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001022};
1023
1024static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1025 {
1026 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1027 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1028 true,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -06001029 100, 8000, 100000, 1,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001030 },
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001031 {
1032 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1033 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1034 true,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -06001035 2000, 5000, 60100000, 3000,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001036 },
1037 {
1038 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1039 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1040 false,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -06001041 6300, 5000, 60350000, 3500,
1042 },
1043 {
1044 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1045 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1046 false,
1047 13300, 2000, 71850000, 6800,
1048 },
1049 {
1050 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1051 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1052 false,
1053 28300, 0, 76350000, 9800,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001054 },
1055};
1056
Praveen Chidambaram78499012011-11-01 17:15:17 -06001057static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1058 .levels = &msm_rpmrs_levels[0],
1059 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1060 .vdd_mem_levels = {
1061 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1062 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1063 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1064 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1065 },
1066 .vdd_dig_levels = {
1067 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1068 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1069 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1070 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1071 },
1072 .vdd_mask = 0x7FFFFF,
1073 .rpmrs_target_id = {
1074 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_CXO_CLK,
1075 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1076 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8018_S1_0,
1077 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8018_S1_1,
1078 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8018_L9_0,
1079 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8018_L9_1,
1080 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1081 },
1082};
1083
1084static struct msm_rpmstats_platform_data msm_rpm_stat_pdata = {
1085 .phys_addr_base = 0x0010D204,
1086 .phys_size = SZ_8K,
1087};
1088
1089struct platform_device msm9615_rpm_stat_device = {
1090 .name = "msm_rpm_stat",
1091 .id = -1,
1092 .dev = {
1093 .platform_data = &msm_rpm_stat_pdata,
1094 },
1095};
1096
1097static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
1098 .phys_addr_base = 0x0010AC00,
1099 .reg_offsets = {
1100 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
1101 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
1102 },
1103 .phys_size = SZ_8K,
1104 .log_len = 4096, /* log's buffer length in bytes */
1105 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
1106};
1107
1108struct platform_device msm9615_rpm_log_device = {
1109 .name = "msm_rpm_log",
1110 .id = -1,
1111 .dev = {
1112 .platform_data = &msm_rpm_log_pdata,
1113 },
1114};
1115
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001116void __init msm9615_device_init(void)
1117{
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -06001118 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Praveen Chidambaram78499012011-11-01 17:15:17 -06001119 BUG_ON(msm_rpm_init(&msm9615_rpm_data));
1120 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001121}
1122
Jeff Hugo56b933a2011-09-28 14:42:05 -06001123#define MSM_SHARED_RAM_PHYS 0x40000000
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001124void __init msm9615_map_io(void)
1125{
Jeff Hugo56b933a2011-09-28 14:42:05 -06001126 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001127 msm_map_msm9615_io();
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -07001128 l2x0_cache_init();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001129 if (socinfo_init() < 0)
1130 pr_err("socinfo_init() failed!\n");
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001131}
1132
1133void __init msm9615_init_irq(void)
1134{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001135 struct msm_mpm_device_data *data = NULL;
1136
1137#ifdef CONFIG_MSM_MPM
1138 data = &msm9615_mpm_dev_data;
1139#endif
1140
1141 msm_mpm_irq_extn_init(data);
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001142 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1143 (void *)MSM_QGIC_CPU_BASE);
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001144}
Gagan Mac7a827642011-09-22 19:42:21 -06001145
1146struct platform_device msm_bus_9615_sys_fabric = {
1147 .name = "msm_bus_fabric",
1148 .id = MSM_BUS_FAB_SYSTEM,
1149};
1150
1151struct platform_device msm_bus_def_fab = {
1152 .name = "msm_bus_fabric",
1153 .id = MSM_BUS_FAB_DEFAULT,
1154};