blob: 13772ce8e5b7ca00eae9ee5f35e4d341a77a9449 [file] [log] [blame]
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
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>
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -070029#include <asm/hardware/cache-l2x0.h>
Yan He092b7272011-09-21 15:25:03 -070030#include <mach/msm_sps.h>
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070031#include <mach/dma.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070032#include "devices.h"
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -060033#include "mpm.h"
34#include "spm.h"
35#include "pm.h"
36#include "rpm_resources.h"
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070037
Harini Jayaramaneba52672011-09-08 15:13:00 -060038/* Address of GSBI blocks */
39#define MSM_GSBI1_PHYS 0x16000000
40#define MSM_GSBI2_PHYS 0x16100000
41#define MSM_GSBI3_PHYS 0x16200000
Rohit Vaswani09666872011-08-23 17:41:54 -070042#define MSM_GSBI4_PHYS 0x16300000
Harini Jayaramaneba52672011-09-08 15:13:00 -060043#define MSM_GSBI5_PHYS 0x16400000
44
Rohit Vaswani09666872011-08-23 17:41:54 -070045#define MSM_UART4DM_PHYS (MSM_GSBI4_PHYS + 0x40000)
46
Harini Jayaramaneba52672011-09-08 15:13:00 -060047/* GSBI QUP devices */
48#define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000)
49#define MSM_GSBI2_QUP_PHYS (MSM_GSBI2_PHYS + 0x80000)
50#define MSM_GSBI3_QUP_PHYS (MSM_GSBI3_PHYS + 0x80000)
51#define MSM_GSBI4_QUP_PHYS (MSM_GSBI4_PHYS + 0x80000)
52#define MSM_GSBI5_QUP_PHYS (MSM_GSBI5_PHYS + 0x80000)
53#define MSM_QUP_SIZE SZ_4K
54
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070055/* Address of SSBI CMD */
56#define MSM_PMIC1_SSBI_CMD_PHYS 0x00500000
57#define MSM_PMIC_SSBI_SIZE SZ_4K
58
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070059static struct resource msm_dmov_resource[] = {
60 {
61 .start = ADM_0_SCSS_1_IRQ,
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070062 .flags = IORESOURCE_IRQ,
63 },
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -070064 {
65 .start = 0x18320000,
66 .end = 0x18320000 + SZ_1M - 1,
67 .flags = IORESOURCE_MEM,
68 },
69};
70
71static struct msm_dmov_pdata msm_dmov_pdata = {
72 .sd = 1,
73 .sd_size = 0x800,
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070074};
75
76struct platform_device msm9615_device_dmov = {
77 .name = "msm_dmov",
78 .id = -1,
79 .resource = msm_dmov_resource,
80 .num_resources = ARRAY_SIZE(msm_dmov_resource),
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -070081 .dev = {
82 .platform_data = &msm_dmov_pdata,
83 },
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070084};
85
Amit Blay5e4ec192011-10-20 09:16:54 +020086static struct resource resources_otg[] = {
87 {
88 .start = MSM9615_HSUSB_PHYS,
89 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_SIZE - 1,
90 .flags = IORESOURCE_MEM,
91 },
92 {
93 .start = USB1_HS_IRQ,
94 .end = USB1_HS_IRQ,
95 .flags = IORESOURCE_IRQ,
96 },
97};
98
99struct platform_device msm_device_otg = {
100 .name = "msm_otg",
101 .id = -1,
102 .num_resources = ARRAY_SIZE(resources_otg),
103 .resource = resources_otg,
104 .dev = {
105 .coherent_dma_mask = DMA_BIT_MASK(32),
106 },
107};
108
109static struct resource resources_hsusb[] = {
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_gadget_peripheral = {
123 .name = "msm_hsusb",
124 .id = -1,
125 .num_resources = ARRAY_SIZE(resources_hsusb),
126 .resource = resources_hsusb,
127 .dev = {
128 .coherent_dma_mask = DMA_BIT_MASK(32),
129 },
130};
131
Rohit Vaswani09666872011-08-23 17:41:54 -0700132static struct resource resources_uart_gsbi4[] = {
133 {
134 .start = GSBI4_UARTDM_IRQ,
135 .end = GSBI4_UARTDM_IRQ,
136 .flags = IORESOURCE_IRQ,
137 },
138 {
139 .start = MSM_UART4DM_PHYS,
140 .end = MSM_UART4DM_PHYS + PAGE_SIZE - 1,
141 .name = "uartdm_resource",
142 .flags = IORESOURCE_MEM,
143 },
144 {
145 .start = MSM_GSBI4_PHYS,
146 .end = MSM_GSBI4_PHYS + PAGE_SIZE - 1,
147 .name = "gsbi_resource",
148 .flags = IORESOURCE_MEM,
149 },
150};
151
152struct platform_device msm9615_device_uart_gsbi4 = {
153 .name = "msm_serial_hsl",
154 .id = 0,
155 .num_resources = ARRAY_SIZE(resources_uart_gsbi4),
156 .resource = resources_uart_gsbi4,
157};
158
Harini Jayaramaneba52672011-09-08 15:13:00 -0600159static struct resource resources_qup_i2c_gsbi5[] = {
160 {
161 .name = "gsbi_qup_i2c_addr",
162 .start = MSM_GSBI5_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600163 .end = MSM_GSBI5_PHYS + 4 - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600164 .flags = IORESOURCE_MEM,
165 },
166 {
167 .name = "qup_phys_addr",
168 .start = MSM_GSBI5_QUP_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600169 .end = MSM_GSBI5_QUP_PHYS + MSM_QUP_SIZE - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600170 .flags = IORESOURCE_MEM,
171 },
172 {
173 .name = "qup_err_intr",
174 .start = GSBI5_QUP_IRQ,
175 .end = GSBI5_QUP_IRQ,
176 .flags = IORESOURCE_IRQ,
177 },
178};
179
180struct platform_device msm9615_device_qup_i2c_gsbi5 = {
181 .name = "qup_i2c",
182 .id = 0,
183 .num_resources = ARRAY_SIZE(resources_qup_i2c_gsbi5),
184 .resource = resources_qup_i2c_gsbi5,
185};
186
Harini Jayaraman738c9312011-09-08 15:22:38 -0600187static struct resource resources_qup_spi_gsbi3[] = {
188 {
189 .name = "spi_base",
190 .start = MSM_GSBI3_QUP_PHYS,
191 .end = MSM_GSBI3_QUP_PHYS + SZ_4K - 1,
192 .flags = IORESOURCE_MEM,
193 },
194 {
195 .name = "gsbi_base",
196 .start = MSM_GSBI3_PHYS,
197 .end = MSM_GSBI3_PHYS + 4 - 1,
198 .flags = IORESOURCE_MEM,
199 },
200 {
201 .name = "spi_irq_in",
202 .start = GSBI3_QUP_IRQ,
203 .end = GSBI3_QUP_IRQ,
204 .flags = IORESOURCE_IRQ,
205 },
206};
207
208struct platform_device msm9615_device_qup_spi_gsbi3 = {
209 .name = "spi_qsd",
210 .id = 0,
211 .num_resources = ARRAY_SIZE(resources_qup_spi_gsbi3),
212 .resource = resources_qup_spi_gsbi3,
213};
214
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700215static struct resource resources_ssbi_pmic1[] = {
216 {
217 .start = MSM_PMIC1_SSBI_CMD_PHYS,
218 .end = MSM_PMIC1_SSBI_CMD_PHYS + MSM_PMIC_SSBI_SIZE - 1,
219 .flags = IORESOURCE_MEM,
220 },
221};
222
223struct platform_device msm9615_device_ssbi_pmic1 = {
224 .name = "msm_ssbi",
225 .id = 0,
226 .resource = resources_ssbi_pmic1,
227 .num_resources = ARRAY_SIZE(resources_ssbi_pmic1),
228};
229
Yan He092b7272011-09-21 15:25:03 -0700230static struct resource resources_sps[] = {
231 {
232 .name = "pipe_mem",
233 .start = 0x12800000,
234 .end = 0x12800000 + 0x4000 - 1,
235 .flags = IORESOURCE_MEM,
236 },
237 {
238 .name = "bamdma_dma",
239 .start = 0x12240000,
240 .end = 0x12240000 + 0x1000 - 1,
241 .flags = IORESOURCE_MEM,
242 },
243 {
244 .name = "bamdma_bam",
245 .start = 0x12244000,
246 .end = 0x12244000 + 0x4000 - 1,
247 .flags = IORESOURCE_MEM,
248 },
249 {
250 .name = "bamdma_irq",
251 .start = SPS_BAM_DMA_IRQ,
252 .end = SPS_BAM_DMA_IRQ,
253 .flags = IORESOURCE_IRQ,
254 },
255};
256
257struct msm_sps_platform_data msm_sps_pdata = {
258 .bamdma_restricted_pipes = 0x06,
259};
260
261struct platform_device msm_device_sps = {
262 .name = "msm_sps",
263 .id = -1,
264 .num_resources = ARRAY_SIZE(resources_sps),
265 .resource = resources_sps,
266 .dev.platform_data = &msm_sps_pdata,
267};
268
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700269static struct tsens_platform_data msm_tsens_pdata = {
270 .slope = 910,
271 .tsens_factor = 1000,
272 .hw_type = MSM_9615,
273 .tsens_num_sensor = 5,
274};
275
Sahitya Tummala38295432011-09-29 10:08:45 +0530276struct platform_device msm9615_device_tsens = {
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700277 .name = "tsens8960-tm",
278 .id = -1,
Sahitya Tummala38295432011-09-29 10:08:45 +0530279 .dev = {
280 .platform_data = &msm_tsens_pdata,
281 },
282};
283
284#define MSM_NAND_PHYS 0x1B400000
285static struct resource resources_nand[] = {
286 [0] = {
287 .name = "msm_nand_dmac",
288 .start = DMOV_NAND_CHAN,
289 .end = DMOV_NAND_CHAN,
290 .flags = IORESOURCE_DMA,
291 },
292 [1] = {
293 .name = "msm_nand_phys",
294 .start = MSM_NAND_PHYS,
295 .end = MSM_NAND_PHYS + 0x7FF,
296 .flags = IORESOURCE_MEM,
297 },
298};
299
300struct flash_platform_data msm_nand_data = {
301 .parts = NULL,
302 .nr_parts = 0,
303};
304
305struct platform_device msm_device_nand = {
306 .name = "msm_nand",
307 .id = -1,
308 .num_resources = ARRAY_SIZE(resources_nand),
309 .resource = resources_nand,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700310 .dev = {
Sahitya Tummala38295432011-09-29 10:08:45 +0530311 .platform_data = &msm_nand_data,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700312 },
313};
314
Jeff Hugo56b933a2011-09-28 14:42:05 -0600315struct platform_device msm_device_smd = {
316 .name = "msm_smd",
317 .id = -1,
318};
319
Ramesh Masavarapu5ad37392011-10-10 10:44:10 -0700320#ifdef CONFIG_HW_RANDOM_MSM
321/* PRNG device */
322#define MSM_PRNG_PHYS 0x1A500000
323static struct resource rng_resources = {
324 .flags = IORESOURCE_MEM,
325 .start = MSM_PRNG_PHYS,
326 .end = MSM_PRNG_PHYS + SZ_512 - 1,
327};
328
329struct platform_device msm_device_rng = {
330 .name = "msm_rng",
331 .id = 0,
332 .num_resources = 1,
333 .resource = &rng_resources,
334};
335#endif
Krishna Kondadd794462011-10-01 00:19:29 -0700336
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700337#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
338 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
339 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
340 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
341
342#define QCE_SIZE 0x10000
343#define QCE_0_BASE 0x18500000
344
345#define QCE_HW_KEY_SUPPORT 0
346#define QCE_SHA_HMAC_SUPPORT 1
347#define QCE_SHARE_CE_RESOURCE 1
348#define QCE_CE_SHARED 0
349
350static struct resource qcrypto_resources[] = {
351 [0] = {
352 .start = QCE_0_BASE,
353 .end = QCE_0_BASE + QCE_SIZE - 1,
354 .flags = IORESOURCE_MEM,
355 },
356 [1] = {
357 .name = "crypto_channels",
358 .start = DMOV_CE_IN_CHAN,
359 .end = DMOV_CE_OUT_CHAN,
360 .flags = IORESOURCE_DMA,
361 },
362 [2] = {
363 .name = "crypto_crci_in",
364 .start = DMOV_CE_IN_CRCI,
365 .end = DMOV_CE_IN_CRCI,
366 .flags = IORESOURCE_DMA,
367 },
368 [3] = {
369 .name = "crypto_crci_out",
370 .start = DMOV_CE_OUT_CRCI,
371 .end = DMOV_CE_OUT_CRCI,
372 .flags = IORESOURCE_DMA,
373 },
374};
375
376static struct resource qcedev_resources[] = {
377 [0] = {
378 .start = QCE_0_BASE,
379 .end = QCE_0_BASE + QCE_SIZE - 1,
380 .flags = IORESOURCE_MEM,
381 },
382 [1] = {
383 .name = "crypto_channels",
384 .start = DMOV_CE_IN_CHAN,
385 .end = DMOV_CE_OUT_CHAN,
386 .flags = IORESOURCE_DMA,
387 },
388 [2] = {
389 .name = "crypto_crci_in",
390 .start = DMOV_CE_IN_CRCI,
391 .end = DMOV_CE_IN_CRCI,
392 .flags = IORESOURCE_DMA,
393 },
394 [3] = {
395 .name = "crypto_crci_out",
396 .start = DMOV_CE_OUT_CRCI,
397 .end = DMOV_CE_OUT_CRCI,
398 .flags = IORESOURCE_DMA,
399 },
400};
401
402#endif
403
404#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
405 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
406
407static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
408 .ce_shared = QCE_CE_SHARED,
409 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
410 .hw_key_support = QCE_HW_KEY_SUPPORT,
411 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
412};
413
414struct platform_device msm9615_qcrypto_device = {
415 .name = "qcrypto",
416 .id = 0,
417 .num_resources = ARRAY_SIZE(qcrypto_resources),
418 .resource = qcrypto_resources,
419 .dev = {
420 .coherent_dma_mask = DMA_BIT_MASK(32),
421 .platform_data = &qcrypto_ce_hw_suppport,
422 },
423};
424#endif
425
426#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
427 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
428
429static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
430 .ce_shared = QCE_CE_SHARED,
431 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
432 .hw_key_support = QCE_HW_KEY_SUPPORT,
433 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
434};
435
436struct platform_device msm9615_qcedev_device = {
437 .name = "qce",
438 .id = 0,
439 .num_resources = ARRAY_SIZE(qcedev_resources),
440 .resource = qcedev_resources,
441 .dev = {
442 .coherent_dma_mask = DMA_BIT_MASK(32),
443 .platform_data = &qcedev_ce_hw_suppport,
444 },
445};
446#endif
447
Krishna Kondadd794462011-10-01 00:19:29 -0700448#define MSM_SDC1_BASE 0x12180000
449#define MSM_SDC1_DML_BASE (MSM_SDC1_BASE + 0x800)
450#define MSM_SDC1_BAM_BASE (MSM_SDC1_BASE + 0x2000)
Krishna Konda71aef182011-10-01 02:27:51 -0700451#define MSM_SDC2_BASE 0x12140000
452#define MSM_SDC2_DML_BASE (MSM_SDC2_BASE + 0x800)
453#define MSM_SDC2_BAM_BASE (MSM_SDC2_BASE + 0x2000)
Krishna Kondadd794462011-10-01 00:19:29 -0700454
455static struct resource resources_sdc1[] = {
456 {
457 .name = "core_mem",
458 .flags = IORESOURCE_MEM,
459 .start = MSM_SDC1_BASE,
460 .end = MSM_SDC1_DML_BASE - 1,
461 },
462 {
463 .name = "core_irq",
464 .flags = IORESOURCE_IRQ,
465 .start = SDC1_IRQ_0,
466 .end = SDC1_IRQ_0
467 },
468#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
469 {
470 .name = "sdcc_dml_addr",
471 .start = MSM_SDC1_DML_BASE,
472 .end = MSM_SDC1_BAM_BASE - 1,
473 .flags = IORESOURCE_MEM,
474 },
475 {
476 .name = "sdcc_bam_addr",
477 .start = MSM_SDC1_BAM_BASE,
478 .end = MSM_SDC1_BAM_BASE + (2 * SZ_4K) - 1,
479 .flags = IORESOURCE_MEM,
480 },
481 {
482 .name = "sdcc_bam_irq",
483 .start = SDC1_BAM_IRQ,
484 .end = SDC1_BAM_IRQ,
485 .flags = IORESOURCE_IRQ,
486 },
487#endif
488};
489
Krishna Konda71aef182011-10-01 02:27:51 -0700490static struct resource resources_sdc2[] = {
491 {
492 .name = "core_mem",
493 .flags = IORESOURCE_MEM,
494 .start = MSM_SDC2_BASE,
495 .end = MSM_SDC2_DML_BASE - 1,
496 },
497 {
498 .name = "core_irq",
499 .flags = IORESOURCE_IRQ,
500 .start = SDC2_IRQ_0,
501 .end = SDC2_IRQ_0
502 },
503#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
504 {
505 .name = "sdcc_dml_addr",
506 .start = MSM_SDC2_DML_BASE,
507 .end = MSM_SDC2_BAM_BASE - 1,
508 .flags = IORESOURCE_MEM,
509 },
510 {
511 .name = "sdcc_bam_addr",
512 .start = MSM_SDC2_BAM_BASE,
513 .end = MSM_SDC2_BAM_BASE + (2 * SZ_4K) - 1,
514 .flags = IORESOURCE_MEM,
515 },
516 {
517 .name = "sdcc_bam_irq",
518 .start = SDC2_BAM_IRQ,
519 .end = SDC2_BAM_IRQ,
520 .flags = IORESOURCE_IRQ,
521 },
522#endif
523};
524
Krishna Kondadd794462011-10-01 00:19:29 -0700525struct platform_device msm_device_sdc1 = {
526 .name = "msm_sdcc",
527 .id = 1,
528 .num_resources = ARRAY_SIZE(resources_sdc1),
529 .resource = resources_sdc1,
530 .dev = {
531 .coherent_dma_mask = 0xffffffff,
532 },
533};
534
Krishna Konda71aef182011-10-01 02:27:51 -0700535struct platform_device msm_device_sdc2 = {
536 .name = "msm_sdcc",
537 .id = 2,
538 .num_resources = ARRAY_SIZE(resources_sdc2),
539 .resource = resources_sdc2,
540 .dev = {
541 .coherent_dma_mask = 0xffffffff,
542 },
543};
544
Krishna Kondadd794462011-10-01 00:19:29 -0700545static struct platform_device *msm_sdcc_devices[] __initdata = {
546 &msm_device_sdc1,
Krishna Konda71aef182011-10-01 02:27:51 -0700547 &msm_device_sdc2,
Krishna Kondadd794462011-10-01 00:19:29 -0700548};
549
550int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
551{
552 struct platform_device *pdev;
553
554 if (controller < 1 || controller > 2)
555 return -EINVAL;
556
557 pdev = msm_sdcc_devices[controller - 1];
558 pdev->dev.platform_data = plat;
559 return platform_device_register(pdev);
560}
561
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700562#ifdef CONFIG_CACHE_L2X0
563static int __init l2x0_cache_init(void)
564{
565 int aux_ctrl = 0;
566
567 /* Way Size 010(0x2) 32KB */
568 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
569 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
570 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
571
572 /* L2 Latency setting required by hardware. Default is 0x20
573 which is no good.
574 */
575 writel_relaxed(0x220, MSM_L2CC_BASE + L2X0_DATA_LATENCY_CTRL);
576 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
577
578 return 0;
579}
580#else
581static int __init l2x0_cache_init(void){ return 0; }
582#endif
583
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600584struct msm_rpm_map_data rpm_map_data[] __initdata = {
585 MSM_RPM_MAP(TRIGGER_TIMED_TO, TRIGGER_TIMED, 1),
586 MSM_RPM_MAP(TRIGGER_TIMED_SCLK_COUNT, TRIGGER_TIMED, 1),
587
588 MSM_RPM_MAP(RPM_CTL, RPM_CTL, 1),
589
590 MSM_RPM_MAP(CXO_CLK, CXO_CLK, 1),
591 MSM_RPM_MAP(SYSTEM_FABRIC_CLK, SYSTEM_FABRIC_CLK, 1),
592 MSM_RPM_MAP(DAYTONA_FABRIC_CLK, DAYTONA_FABRIC_CLK, 1),
593 MSM_RPM_MAP(SFPB_CLK, SFPB_CLK, 1),
594 MSM_RPM_MAP(CFPB_CLK, CFPB_CLK, 1),
595 MSM_RPM_MAP(EBI1_CLK, EBI1_CLK, 1),
596
597 MSM_RPM_MAP(SYS_FABRIC_CFG_HALT_0, SYS_FABRIC_CFG_HALT, 2),
598 MSM_RPM_MAP(SYS_FABRIC_CFG_CLKMOD_0, SYS_FABRIC_CFG_CLKMOD, 3),
599 MSM_RPM_MAP(SYS_FABRIC_CFG_IOCTL, SYS_FABRIC_CFG_IOCTL, 1),
600 MSM_RPM_MAP(SYSTEM_FABRIC_ARB_0, SYSTEM_FABRIC_ARB, 27),
601
602 MSM_RPM_MAP(PM8018_S1_0, PM8018_S1, 2),
603 MSM_RPM_MAP(PM8018_S2_0, PM8018_S2, 2),
604 MSM_RPM_MAP(PM8018_S3_0, PM8018_S3, 2),
605 MSM_RPM_MAP(PM8018_S4_0, PM8018_S4, 2),
606 MSM_RPM_MAP(PM8018_S5_0, PM8018_S5, 2),
607 MSM_RPM_MAP(PM8018_L1_0, PM8018_L1, 2),
608 MSM_RPM_MAP(PM8018_L2_0, PM8018_L2, 2),
609 MSM_RPM_MAP(PM8018_L3_0, PM8018_L3, 2),
610 MSM_RPM_MAP(PM8018_L4_0, PM8018_L4, 2),
611 MSM_RPM_MAP(PM8018_L5_0, PM8018_L5, 2),
612 MSM_RPM_MAP(PM8018_L6_0, PM8018_L6, 2),
613 MSM_RPM_MAP(PM8018_L7_0, PM8018_L7, 2),
614 MSM_RPM_MAP(PM8018_L8_0, PM8018_L8, 2),
615 MSM_RPM_MAP(PM8018_L9_0, PM8018_L9, 2),
616 MSM_RPM_MAP(PM8018_L10_0, PM8018_L10, 2),
617 MSM_RPM_MAP(PM8018_L11_0, PM8018_L11, 2),
618 MSM_RPM_MAP(PM8018_L12_0, PM8018_L12, 2),
619 MSM_RPM_MAP(PM8018_L13_0, PM8018_L13, 2),
620 MSM_RPM_MAP(PM8018_L14_0, PM8018_L14, 2),
621 MSM_RPM_MAP(PM8018_LVS1, PM8018_LVS1, 1),
622 MSM_RPM_MAP(NCP_0, NCP, 2),
623 MSM_RPM_MAP(CXO_BUFFERS, CXO_BUFFERS, 1),
624 MSM_RPM_MAP(USB_OTG_SWITCH, USB_OTG_SWITCH, 1),
625 MSM_RPM_MAP(HDMI_SWITCH, HDMI_SWITCH, 1),
626};
627unsigned int rpm_map_data_size = ARRAY_SIZE(rpm_map_data);
628
629static struct msm_rpm_platform_data msm_rpm_data = {
630 .reg_base_addrs = {
631 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
632 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
633 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
634 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
635 },
636
637 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
638 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
639 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
640 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
641 .msm_apps_ipc_rpm_val = 4,
642};
643
644struct platform_device msm_rpm_device = {
645 .name = "msm_rpm",
646 .id = -1,
647};
648
649static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] = {
650 [1] = MSM_GPIO_TO_INT(46),
651 [2] = MSM_GPIO_TO_INT(150),
652 [4] = MSM_GPIO_TO_INT(103),
653 [5] = MSM_GPIO_TO_INT(104),
654 [6] = MSM_GPIO_TO_INT(105),
655 [7] = MSM_GPIO_TO_INT(106),
656 [8] = MSM_GPIO_TO_INT(107),
657 [9] = MSM_GPIO_TO_INT(7),
658 [10] = MSM_GPIO_TO_INT(11),
659 [11] = MSM_GPIO_TO_INT(15),
660 [12] = MSM_GPIO_TO_INT(19),
661 [13] = MSM_GPIO_TO_INT(23),
662 [14] = MSM_GPIO_TO_INT(27),
663 [15] = MSM_GPIO_TO_INT(31),
664 [16] = MSM_GPIO_TO_INT(35),
665 [19] = MSM_GPIO_TO_INT(90),
666 [20] = MSM_GPIO_TO_INT(92),
667 [23] = MSM_GPIO_TO_INT(85),
668 [24] = MSM_GPIO_TO_INT(83),
669 [25] = USB1_HS_IRQ,
670 /*[27] = HDMI_IRQ,*/
671 [29] = MSM_GPIO_TO_INT(10),
672 [30] = MSM_GPIO_TO_INT(102),
673 [31] = MSM_GPIO_TO_INT(81),
674 [32] = MSM_GPIO_TO_INT(78),
675 [33] = MSM_GPIO_TO_INT(94),
676 [34] = MSM_GPIO_TO_INT(72),
677 [35] = MSM_GPIO_TO_INT(39),
678 [36] = MSM_GPIO_TO_INT(43),
679 [37] = MSM_GPIO_TO_INT(61),
680 [38] = MSM_GPIO_TO_INT(50),
681 [39] = MSM_GPIO_TO_INT(42),
682 [41] = MSM_GPIO_TO_INT(62),
683 [42] = MSM_GPIO_TO_INT(76),
684 [43] = MSM_GPIO_TO_INT(75),
685 [44] = MSM_GPIO_TO_INT(70),
686 [45] = MSM_GPIO_TO_INT(69),
687 [46] = MSM_GPIO_TO_INT(67),
688 [47] = MSM_GPIO_TO_INT(65),
689 [48] = MSM_GPIO_TO_INT(58),
690 [49] = MSM_GPIO_TO_INT(54),
691 [50] = MSM_GPIO_TO_INT(52),
692 [51] = MSM_GPIO_TO_INT(49),
693 [52] = MSM_GPIO_TO_INT(40),
694 [53] = MSM_GPIO_TO_INT(37),
695 [54] = MSM_GPIO_TO_INT(24),
696 [55] = MSM_GPIO_TO_INT(14),
697};
698
699static uint16_t msm_mpm_bypassed_apps_irqs[] = {
700 TLMM_MSM_SUMMARY_IRQ,
701 RPM_APCC_CPU0_GP_HIGH_IRQ,
702 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
703 RPM_APCC_CPU0_GP_LOW_IRQ,
704 RPM_APCC_CPU0_WAKE_UP_IRQ,
705 LPASS_SCSS_GP_LOW_IRQ,
706 LPASS_SCSS_GP_MEDIUM_IRQ,
707 LPASS_SCSS_GP_HIGH_IRQ,
708 SPS_MTI_31,
709};
710
711struct msm_mpm_device_data msm_mpm_dev_data = {
712 .irqs_m2a = msm_mpm_irqs_m2a,
713 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
714 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
715 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
716 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
717 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
718 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
719 .mpm_apps_ipc_val = BIT(1),
720 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600721};
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600722
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600723static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600724 0x00, 0x03, 0x00, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600725};
726
727static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600728 0x34, 0x24, 0x14, 0x04,
729 0x54, 0x03, 0x54, 0x04,
730 0x14, 0x24, 0x3e, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600731};
732
733static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600734 0x34, 0x24, 0x14, 0x04,
735 0x54, 0x07, 0x54, 0x04,
736 0x14, 0x24, 0x3e, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600737};
738
739static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
740 [0] = {
741 .mode = MSM_SPM_MODE_CLOCK_GATING,
742 .notify_rpm = false,
743 .cmd = spm_wfi_cmd_sequence,
744 },
745 [1] = {
746 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
747 .notify_rpm = false,
748 .cmd = spm_power_collapse_without_rpm,
749 },
750 [2] = {
751 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
752 .notify_rpm = true,
753 .cmd = spm_power_collapse_with_rpm,
754 },
755};
756
757static struct msm_spm_platform_data msm_spm_data[] __initdata = {
758 [0] = {
759 .reg_base_addr = MSM_SAW0_BASE,
760 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600761 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1001,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600762 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
763 .modes = msm_spm_seq_list,
764 },
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600765};
766
767static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
768 {
769 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
770 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
771 true,
772 1, 8000, 100000, 1,
773 },
774
775 {
776 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
777 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
778 true,
779 1500, 5000, 60100000, 3000,
780 },
781 {
782 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
783 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
784 false,
785 2800, 5000, 60350000, 3500,
786 },
787};
788
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700789void __init msm9615_device_init(void)
790{
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600791 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600792 BUG_ON(msm_rpm_init(&msm_rpm_data));
793 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
794 ARRAY_SIZE(msm_rpmrs_levels)));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700795}
796
Jeff Hugo56b933a2011-09-28 14:42:05 -0600797#define MSM_SHARED_RAM_PHYS 0x40000000
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700798void __init msm9615_map_io(void)
799{
Jeff Hugo56b933a2011-09-28 14:42:05 -0600800 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700801 msm_map_msm9615_io();
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700802 l2x0_cache_init();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700803 if (socinfo_init() < 0)
804 pr_err("socinfo_init() failed!\n");
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700805}
806
807void __init msm9615_init_irq(void)
808{
809 unsigned int i;
Rohit Vaswanib2e42e12011-10-07 21:25:53 -0700810
811 msm_mpm_irq_extn_init();
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700812 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
813 (void *)MSM_QGIC_CPU_BASE);
814
815 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
816 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
817
818 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
819 mb();
820
821 /*
822 * FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
823 * as they are configured as level, which does not play nice with
824 * handle_percpu_irq.
825 */
826 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
827 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
828 irq_set_handler(i, handle_percpu_irq);
829 }
830}