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