blob: 60fa257d4cfb5edffe2f20c79fc95f5bb57ce0d4 [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"
Jeff Ohlstein7e668552011-10-06 16:17:25 -070037#include "msm_watchdog.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 Ohlstein7e668552011-10-06 16:17:25 -070060static struct msm_watchdog_pdata msm_watchdog_pdata = {
61 .pet_time = 10000,
62 .bark_time = 11000,
63 .has_secure = true,
64};
65
66struct platform_device msm9615_device_watchdog = {
67 .name = "msm_watchdog",
68 .id = -1,
69 .dev = {
70 .platform_data = &msm_watchdog_pdata,
71 },
72};
73
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070074static struct resource msm_dmov_resource[] = {
75 {
76 .start = ADM_0_SCSS_1_IRQ,
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070077 .flags = IORESOURCE_IRQ,
78 },
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -070079 {
80 .start = 0x18320000,
81 .end = 0x18320000 + SZ_1M - 1,
82 .flags = IORESOURCE_MEM,
83 },
84};
85
86static struct msm_dmov_pdata msm_dmov_pdata = {
87 .sd = 1,
88 .sd_size = 0x800,
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070089};
90
91struct platform_device msm9615_device_dmov = {
92 .name = "msm_dmov",
93 .id = -1,
94 .resource = msm_dmov_resource,
95 .num_resources = ARRAY_SIZE(msm_dmov_resource),
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -070096 .dev = {
97 .platform_data = &msm_dmov_pdata,
98 },
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070099};
100
Amit Blay5e4ec192011-10-20 09:16:54 +0200101static struct resource resources_otg[] = {
102 {
103 .start = MSM9615_HSUSB_PHYS,
104 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_SIZE - 1,
105 .flags = IORESOURCE_MEM,
106 },
107 {
108 .start = USB1_HS_IRQ,
109 .end = USB1_HS_IRQ,
110 .flags = IORESOURCE_IRQ,
111 },
112};
113
114struct platform_device msm_device_otg = {
115 .name = "msm_otg",
116 .id = -1,
117 .num_resources = ARRAY_SIZE(resources_otg),
118 .resource = resources_otg,
119 .dev = {
120 .coherent_dma_mask = DMA_BIT_MASK(32),
121 },
122};
123
124static struct resource resources_hsusb[] = {
125 {
126 .start = MSM9615_HSUSB_PHYS,
127 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_SIZE - 1,
128 .flags = IORESOURCE_MEM,
129 },
130 {
131 .start = USB1_HS_IRQ,
132 .end = USB1_HS_IRQ,
133 .flags = IORESOURCE_IRQ,
134 },
135};
136
137struct platform_device msm_device_gadget_peripheral = {
138 .name = "msm_hsusb",
139 .id = -1,
140 .num_resources = ARRAY_SIZE(resources_hsusb),
141 .resource = resources_hsusb,
142 .dev = {
143 .coherent_dma_mask = DMA_BIT_MASK(32),
144 },
145};
146
Rohit Vaswani09666872011-08-23 17:41:54 -0700147static struct resource resources_uart_gsbi4[] = {
148 {
149 .start = GSBI4_UARTDM_IRQ,
150 .end = GSBI4_UARTDM_IRQ,
151 .flags = IORESOURCE_IRQ,
152 },
153 {
154 .start = MSM_UART4DM_PHYS,
155 .end = MSM_UART4DM_PHYS + PAGE_SIZE - 1,
156 .name = "uartdm_resource",
157 .flags = IORESOURCE_MEM,
158 },
159 {
160 .start = MSM_GSBI4_PHYS,
161 .end = MSM_GSBI4_PHYS + PAGE_SIZE - 1,
162 .name = "gsbi_resource",
163 .flags = IORESOURCE_MEM,
164 },
165};
166
167struct platform_device msm9615_device_uart_gsbi4 = {
168 .name = "msm_serial_hsl",
169 .id = 0,
170 .num_resources = ARRAY_SIZE(resources_uart_gsbi4),
171 .resource = resources_uart_gsbi4,
172};
173
Harini Jayaramaneba52672011-09-08 15:13:00 -0600174static struct resource resources_qup_i2c_gsbi5[] = {
175 {
176 .name = "gsbi_qup_i2c_addr",
177 .start = MSM_GSBI5_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600178 .end = MSM_GSBI5_PHYS + 4 - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600179 .flags = IORESOURCE_MEM,
180 },
181 {
182 .name = "qup_phys_addr",
183 .start = MSM_GSBI5_QUP_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600184 .end = MSM_GSBI5_QUP_PHYS + MSM_QUP_SIZE - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600185 .flags = IORESOURCE_MEM,
186 },
187 {
188 .name = "qup_err_intr",
189 .start = GSBI5_QUP_IRQ,
190 .end = GSBI5_QUP_IRQ,
191 .flags = IORESOURCE_IRQ,
192 },
193};
194
195struct platform_device msm9615_device_qup_i2c_gsbi5 = {
196 .name = "qup_i2c",
197 .id = 0,
198 .num_resources = ARRAY_SIZE(resources_qup_i2c_gsbi5),
199 .resource = resources_qup_i2c_gsbi5,
200};
201
Harini Jayaraman738c9312011-09-08 15:22:38 -0600202static struct resource resources_qup_spi_gsbi3[] = {
203 {
204 .name = "spi_base",
205 .start = MSM_GSBI3_QUP_PHYS,
206 .end = MSM_GSBI3_QUP_PHYS + SZ_4K - 1,
207 .flags = IORESOURCE_MEM,
208 },
209 {
210 .name = "gsbi_base",
211 .start = MSM_GSBI3_PHYS,
212 .end = MSM_GSBI3_PHYS + 4 - 1,
213 .flags = IORESOURCE_MEM,
214 },
215 {
216 .name = "spi_irq_in",
217 .start = GSBI3_QUP_IRQ,
218 .end = GSBI3_QUP_IRQ,
219 .flags = IORESOURCE_IRQ,
220 },
221};
222
223struct platform_device msm9615_device_qup_spi_gsbi3 = {
224 .name = "spi_qsd",
225 .id = 0,
226 .num_resources = ARRAY_SIZE(resources_qup_spi_gsbi3),
227 .resource = resources_qup_spi_gsbi3,
228};
229
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700230static struct resource resources_ssbi_pmic1[] = {
231 {
232 .start = MSM_PMIC1_SSBI_CMD_PHYS,
233 .end = MSM_PMIC1_SSBI_CMD_PHYS + MSM_PMIC_SSBI_SIZE - 1,
234 .flags = IORESOURCE_MEM,
235 },
236};
237
238struct platform_device msm9615_device_ssbi_pmic1 = {
239 .name = "msm_ssbi",
240 .id = 0,
241 .resource = resources_ssbi_pmic1,
242 .num_resources = ARRAY_SIZE(resources_ssbi_pmic1),
243};
244
Yan He092b7272011-09-21 15:25:03 -0700245static struct resource resources_sps[] = {
246 {
247 .name = "pipe_mem",
248 .start = 0x12800000,
249 .end = 0x12800000 + 0x4000 - 1,
250 .flags = IORESOURCE_MEM,
251 },
252 {
253 .name = "bamdma_dma",
254 .start = 0x12240000,
255 .end = 0x12240000 + 0x1000 - 1,
256 .flags = IORESOURCE_MEM,
257 },
258 {
259 .name = "bamdma_bam",
260 .start = 0x12244000,
261 .end = 0x12244000 + 0x4000 - 1,
262 .flags = IORESOURCE_MEM,
263 },
264 {
265 .name = "bamdma_irq",
266 .start = SPS_BAM_DMA_IRQ,
267 .end = SPS_BAM_DMA_IRQ,
268 .flags = IORESOURCE_IRQ,
269 },
270};
271
272struct msm_sps_platform_data msm_sps_pdata = {
273 .bamdma_restricted_pipes = 0x06,
274};
275
276struct platform_device msm_device_sps = {
277 .name = "msm_sps",
278 .id = -1,
279 .num_resources = ARRAY_SIZE(resources_sps),
280 .resource = resources_sps,
281 .dev.platform_data = &msm_sps_pdata,
282};
283
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700284static struct tsens_platform_data msm_tsens_pdata = {
285 .slope = 910,
286 .tsens_factor = 1000,
287 .hw_type = MSM_9615,
288 .tsens_num_sensor = 5,
289};
290
Sahitya Tummala38295432011-09-29 10:08:45 +0530291struct platform_device msm9615_device_tsens = {
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700292 .name = "tsens8960-tm",
293 .id = -1,
Sahitya Tummala38295432011-09-29 10:08:45 +0530294 .dev = {
295 .platform_data = &msm_tsens_pdata,
296 },
297};
298
299#define MSM_NAND_PHYS 0x1B400000
300static struct resource resources_nand[] = {
301 [0] = {
302 .name = "msm_nand_dmac",
303 .start = DMOV_NAND_CHAN,
304 .end = DMOV_NAND_CHAN,
305 .flags = IORESOURCE_DMA,
306 },
307 [1] = {
308 .name = "msm_nand_phys",
309 .start = MSM_NAND_PHYS,
310 .end = MSM_NAND_PHYS + 0x7FF,
311 .flags = IORESOURCE_MEM,
312 },
313};
314
315struct flash_platform_data msm_nand_data = {
316 .parts = NULL,
317 .nr_parts = 0,
318};
319
320struct platform_device msm_device_nand = {
321 .name = "msm_nand",
322 .id = -1,
323 .num_resources = ARRAY_SIZE(resources_nand),
324 .resource = resources_nand,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700325 .dev = {
Sahitya Tummala38295432011-09-29 10:08:45 +0530326 .platform_data = &msm_nand_data,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700327 },
328};
329
Jeff Hugo56b933a2011-09-28 14:42:05 -0600330struct platform_device msm_device_smd = {
331 .name = "msm_smd",
332 .id = -1,
333};
334
Eric Holmberg0c96e702011-11-08 18:04:31 -0700335struct platform_device msm_device_bam_dmux = {
336 .name = "BAM_RMNT",
337 .id = -1,
338};
339
Ramesh Masavarapu5ad37392011-10-10 10:44:10 -0700340#ifdef CONFIG_HW_RANDOM_MSM
341/* PRNG device */
342#define MSM_PRNG_PHYS 0x1A500000
343static struct resource rng_resources = {
344 .flags = IORESOURCE_MEM,
345 .start = MSM_PRNG_PHYS,
346 .end = MSM_PRNG_PHYS + SZ_512 - 1,
347};
348
349struct platform_device msm_device_rng = {
350 .name = "msm_rng",
351 .id = 0,
352 .num_resources = 1,
353 .resource = &rng_resources,
354};
355#endif
Krishna Kondadd794462011-10-01 00:19:29 -0700356
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700357#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
358 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
359 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
360 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
361
362#define QCE_SIZE 0x10000
363#define QCE_0_BASE 0x18500000
364
365#define QCE_HW_KEY_SUPPORT 0
366#define QCE_SHA_HMAC_SUPPORT 1
367#define QCE_SHARE_CE_RESOURCE 1
368#define QCE_CE_SHARED 0
369
370static struct resource qcrypto_resources[] = {
371 [0] = {
372 .start = QCE_0_BASE,
373 .end = QCE_0_BASE + QCE_SIZE - 1,
374 .flags = IORESOURCE_MEM,
375 },
376 [1] = {
377 .name = "crypto_channels",
378 .start = DMOV_CE_IN_CHAN,
379 .end = DMOV_CE_OUT_CHAN,
380 .flags = IORESOURCE_DMA,
381 },
382 [2] = {
383 .name = "crypto_crci_in",
384 .start = DMOV_CE_IN_CRCI,
385 .end = DMOV_CE_IN_CRCI,
386 .flags = IORESOURCE_DMA,
387 },
388 [3] = {
389 .name = "crypto_crci_out",
390 .start = DMOV_CE_OUT_CRCI,
391 .end = DMOV_CE_OUT_CRCI,
392 .flags = IORESOURCE_DMA,
393 },
394};
395
396static struct resource qcedev_resources[] = {
397 [0] = {
398 .start = QCE_0_BASE,
399 .end = QCE_0_BASE + QCE_SIZE - 1,
400 .flags = IORESOURCE_MEM,
401 },
402 [1] = {
403 .name = "crypto_channels",
404 .start = DMOV_CE_IN_CHAN,
405 .end = DMOV_CE_OUT_CHAN,
406 .flags = IORESOURCE_DMA,
407 },
408 [2] = {
409 .name = "crypto_crci_in",
410 .start = DMOV_CE_IN_CRCI,
411 .end = DMOV_CE_IN_CRCI,
412 .flags = IORESOURCE_DMA,
413 },
414 [3] = {
415 .name = "crypto_crci_out",
416 .start = DMOV_CE_OUT_CRCI,
417 .end = DMOV_CE_OUT_CRCI,
418 .flags = IORESOURCE_DMA,
419 },
420};
421
422#endif
423
424#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
425 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
426
427static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
428 .ce_shared = QCE_CE_SHARED,
429 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
430 .hw_key_support = QCE_HW_KEY_SUPPORT,
431 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
432};
433
434struct platform_device msm9615_qcrypto_device = {
435 .name = "qcrypto",
436 .id = 0,
437 .num_resources = ARRAY_SIZE(qcrypto_resources),
438 .resource = qcrypto_resources,
439 .dev = {
440 .coherent_dma_mask = DMA_BIT_MASK(32),
441 .platform_data = &qcrypto_ce_hw_suppport,
442 },
443};
444#endif
445
446#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
447 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
448
449static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
450 .ce_shared = QCE_CE_SHARED,
451 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
452 .hw_key_support = QCE_HW_KEY_SUPPORT,
453 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
454};
455
456struct platform_device msm9615_qcedev_device = {
457 .name = "qce",
458 .id = 0,
459 .num_resources = ARRAY_SIZE(qcedev_resources),
460 .resource = qcedev_resources,
461 .dev = {
462 .coherent_dma_mask = DMA_BIT_MASK(32),
463 .platform_data = &qcedev_ce_hw_suppport,
464 },
465};
466#endif
467
Krishna Kondadd794462011-10-01 00:19:29 -0700468#define MSM_SDC1_BASE 0x12180000
469#define MSM_SDC1_DML_BASE (MSM_SDC1_BASE + 0x800)
470#define MSM_SDC1_BAM_BASE (MSM_SDC1_BASE + 0x2000)
Krishna Konda71aef182011-10-01 02:27:51 -0700471#define MSM_SDC2_BASE 0x12140000
472#define MSM_SDC2_DML_BASE (MSM_SDC2_BASE + 0x800)
473#define MSM_SDC2_BAM_BASE (MSM_SDC2_BASE + 0x2000)
Krishna Kondadd794462011-10-01 00:19:29 -0700474
475static struct resource resources_sdc1[] = {
476 {
477 .name = "core_mem",
478 .flags = IORESOURCE_MEM,
479 .start = MSM_SDC1_BASE,
480 .end = MSM_SDC1_DML_BASE - 1,
481 },
482 {
483 .name = "core_irq",
484 .flags = IORESOURCE_IRQ,
485 .start = SDC1_IRQ_0,
486 .end = SDC1_IRQ_0
487 },
488#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
489 {
490 .name = "sdcc_dml_addr",
491 .start = MSM_SDC1_DML_BASE,
492 .end = MSM_SDC1_BAM_BASE - 1,
493 .flags = IORESOURCE_MEM,
494 },
495 {
496 .name = "sdcc_bam_addr",
497 .start = MSM_SDC1_BAM_BASE,
498 .end = MSM_SDC1_BAM_BASE + (2 * SZ_4K) - 1,
499 .flags = IORESOURCE_MEM,
500 },
501 {
502 .name = "sdcc_bam_irq",
503 .start = SDC1_BAM_IRQ,
504 .end = SDC1_BAM_IRQ,
505 .flags = IORESOURCE_IRQ,
506 },
507#endif
508};
509
Krishna Konda71aef182011-10-01 02:27:51 -0700510static struct resource resources_sdc2[] = {
511 {
512 .name = "core_mem",
513 .flags = IORESOURCE_MEM,
514 .start = MSM_SDC2_BASE,
515 .end = MSM_SDC2_DML_BASE - 1,
516 },
517 {
518 .name = "core_irq",
519 .flags = IORESOURCE_IRQ,
520 .start = SDC2_IRQ_0,
521 .end = SDC2_IRQ_0
522 },
523#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
524 {
525 .name = "sdcc_dml_addr",
526 .start = MSM_SDC2_DML_BASE,
527 .end = MSM_SDC2_BAM_BASE - 1,
528 .flags = IORESOURCE_MEM,
529 },
530 {
531 .name = "sdcc_bam_addr",
532 .start = MSM_SDC2_BAM_BASE,
533 .end = MSM_SDC2_BAM_BASE + (2 * SZ_4K) - 1,
534 .flags = IORESOURCE_MEM,
535 },
536 {
537 .name = "sdcc_bam_irq",
538 .start = SDC2_BAM_IRQ,
539 .end = SDC2_BAM_IRQ,
540 .flags = IORESOURCE_IRQ,
541 },
542#endif
543};
544
Krishna Kondadd794462011-10-01 00:19:29 -0700545struct platform_device msm_device_sdc1 = {
546 .name = "msm_sdcc",
547 .id = 1,
548 .num_resources = ARRAY_SIZE(resources_sdc1),
549 .resource = resources_sdc1,
550 .dev = {
551 .coherent_dma_mask = 0xffffffff,
552 },
553};
554
Krishna Konda71aef182011-10-01 02:27:51 -0700555struct platform_device msm_device_sdc2 = {
556 .name = "msm_sdcc",
557 .id = 2,
558 .num_resources = ARRAY_SIZE(resources_sdc2),
559 .resource = resources_sdc2,
560 .dev = {
561 .coherent_dma_mask = 0xffffffff,
562 },
563};
564
Krishna Kondadd794462011-10-01 00:19:29 -0700565static struct platform_device *msm_sdcc_devices[] __initdata = {
566 &msm_device_sdc1,
Krishna Konda71aef182011-10-01 02:27:51 -0700567 &msm_device_sdc2,
Krishna Kondadd794462011-10-01 00:19:29 -0700568};
569
570int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
571{
572 struct platform_device *pdev;
573
574 if (controller < 1 || controller > 2)
575 return -EINVAL;
576
577 pdev = msm_sdcc_devices[controller - 1];
578 pdev->dev.platform_data = plat;
579 return platform_device_register(pdev);
580}
581
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700582#ifdef CONFIG_CACHE_L2X0
583static int __init l2x0_cache_init(void)
584{
585 int aux_ctrl = 0;
586
587 /* Way Size 010(0x2) 32KB */
588 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
589 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
590 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
591
592 /* L2 Latency setting required by hardware. Default is 0x20
593 which is no good.
594 */
595 writel_relaxed(0x220, MSM_L2CC_BASE + L2X0_DATA_LATENCY_CTRL);
596 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
597
598 return 0;
599}
600#else
601static int __init l2x0_cache_init(void){ return 0; }
602#endif
603
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600604struct msm_rpm_map_data rpm_map_data[] __initdata = {
605 MSM_RPM_MAP(TRIGGER_TIMED_TO, TRIGGER_TIMED, 1),
606 MSM_RPM_MAP(TRIGGER_TIMED_SCLK_COUNT, TRIGGER_TIMED, 1),
607
608 MSM_RPM_MAP(RPM_CTL, RPM_CTL, 1),
609
610 MSM_RPM_MAP(CXO_CLK, CXO_CLK, 1),
611 MSM_RPM_MAP(SYSTEM_FABRIC_CLK, SYSTEM_FABRIC_CLK, 1),
612 MSM_RPM_MAP(DAYTONA_FABRIC_CLK, DAYTONA_FABRIC_CLK, 1),
613 MSM_RPM_MAP(SFPB_CLK, SFPB_CLK, 1),
614 MSM_RPM_MAP(CFPB_CLK, CFPB_CLK, 1),
615 MSM_RPM_MAP(EBI1_CLK, EBI1_CLK, 1),
616
617 MSM_RPM_MAP(SYS_FABRIC_CFG_HALT_0, SYS_FABRIC_CFG_HALT, 2),
618 MSM_RPM_MAP(SYS_FABRIC_CFG_CLKMOD_0, SYS_FABRIC_CFG_CLKMOD, 3),
619 MSM_RPM_MAP(SYS_FABRIC_CFG_IOCTL, SYS_FABRIC_CFG_IOCTL, 1),
620 MSM_RPM_MAP(SYSTEM_FABRIC_ARB_0, SYSTEM_FABRIC_ARB, 27),
621
622 MSM_RPM_MAP(PM8018_S1_0, PM8018_S1, 2),
623 MSM_RPM_MAP(PM8018_S2_0, PM8018_S2, 2),
624 MSM_RPM_MAP(PM8018_S3_0, PM8018_S3, 2),
625 MSM_RPM_MAP(PM8018_S4_0, PM8018_S4, 2),
626 MSM_RPM_MAP(PM8018_S5_0, PM8018_S5, 2),
627 MSM_RPM_MAP(PM8018_L1_0, PM8018_L1, 2),
628 MSM_RPM_MAP(PM8018_L2_0, PM8018_L2, 2),
629 MSM_RPM_MAP(PM8018_L3_0, PM8018_L3, 2),
630 MSM_RPM_MAP(PM8018_L4_0, PM8018_L4, 2),
631 MSM_RPM_MAP(PM8018_L5_0, PM8018_L5, 2),
632 MSM_RPM_MAP(PM8018_L6_0, PM8018_L6, 2),
633 MSM_RPM_MAP(PM8018_L7_0, PM8018_L7, 2),
634 MSM_RPM_MAP(PM8018_L8_0, PM8018_L8, 2),
635 MSM_RPM_MAP(PM8018_L9_0, PM8018_L9, 2),
636 MSM_RPM_MAP(PM8018_L10_0, PM8018_L10, 2),
637 MSM_RPM_MAP(PM8018_L11_0, PM8018_L11, 2),
638 MSM_RPM_MAP(PM8018_L12_0, PM8018_L12, 2),
639 MSM_RPM_MAP(PM8018_L13_0, PM8018_L13, 2),
640 MSM_RPM_MAP(PM8018_L14_0, PM8018_L14, 2),
641 MSM_RPM_MAP(PM8018_LVS1, PM8018_LVS1, 1),
642 MSM_RPM_MAP(NCP_0, NCP, 2),
643 MSM_RPM_MAP(CXO_BUFFERS, CXO_BUFFERS, 1),
644 MSM_RPM_MAP(USB_OTG_SWITCH, USB_OTG_SWITCH, 1),
645 MSM_RPM_MAP(HDMI_SWITCH, HDMI_SWITCH, 1),
646};
647unsigned int rpm_map_data_size = ARRAY_SIZE(rpm_map_data);
648
649static struct msm_rpm_platform_data msm_rpm_data = {
650 .reg_base_addrs = {
651 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
652 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
653 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
654 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
655 },
656
657 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
658 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
659 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
660 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
661 .msm_apps_ipc_rpm_val = 4,
662};
663
664struct platform_device msm_rpm_device = {
665 .name = "msm_rpm",
666 .id = -1,
667};
668
669static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] = {
670 [1] = MSM_GPIO_TO_INT(46),
671 [2] = MSM_GPIO_TO_INT(150),
672 [4] = MSM_GPIO_TO_INT(103),
673 [5] = MSM_GPIO_TO_INT(104),
674 [6] = MSM_GPIO_TO_INT(105),
675 [7] = MSM_GPIO_TO_INT(106),
676 [8] = MSM_GPIO_TO_INT(107),
677 [9] = MSM_GPIO_TO_INT(7),
678 [10] = MSM_GPIO_TO_INT(11),
679 [11] = MSM_GPIO_TO_INT(15),
680 [12] = MSM_GPIO_TO_INT(19),
681 [13] = MSM_GPIO_TO_INT(23),
682 [14] = MSM_GPIO_TO_INT(27),
683 [15] = MSM_GPIO_TO_INT(31),
684 [16] = MSM_GPIO_TO_INT(35),
685 [19] = MSM_GPIO_TO_INT(90),
686 [20] = MSM_GPIO_TO_INT(92),
687 [23] = MSM_GPIO_TO_INT(85),
688 [24] = MSM_GPIO_TO_INT(83),
689 [25] = USB1_HS_IRQ,
690 /*[27] = HDMI_IRQ,*/
691 [29] = MSM_GPIO_TO_INT(10),
692 [30] = MSM_GPIO_TO_INT(102),
693 [31] = MSM_GPIO_TO_INT(81),
694 [32] = MSM_GPIO_TO_INT(78),
695 [33] = MSM_GPIO_TO_INT(94),
696 [34] = MSM_GPIO_TO_INT(72),
697 [35] = MSM_GPIO_TO_INT(39),
698 [36] = MSM_GPIO_TO_INT(43),
699 [37] = MSM_GPIO_TO_INT(61),
700 [38] = MSM_GPIO_TO_INT(50),
701 [39] = MSM_GPIO_TO_INT(42),
702 [41] = MSM_GPIO_TO_INT(62),
703 [42] = MSM_GPIO_TO_INT(76),
704 [43] = MSM_GPIO_TO_INT(75),
705 [44] = MSM_GPIO_TO_INT(70),
706 [45] = MSM_GPIO_TO_INT(69),
707 [46] = MSM_GPIO_TO_INT(67),
708 [47] = MSM_GPIO_TO_INT(65),
709 [48] = MSM_GPIO_TO_INT(58),
710 [49] = MSM_GPIO_TO_INT(54),
711 [50] = MSM_GPIO_TO_INT(52),
712 [51] = MSM_GPIO_TO_INT(49),
713 [52] = MSM_GPIO_TO_INT(40),
714 [53] = MSM_GPIO_TO_INT(37),
715 [54] = MSM_GPIO_TO_INT(24),
716 [55] = MSM_GPIO_TO_INT(14),
717};
718
719static uint16_t msm_mpm_bypassed_apps_irqs[] = {
720 TLMM_MSM_SUMMARY_IRQ,
721 RPM_APCC_CPU0_GP_HIGH_IRQ,
722 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
723 RPM_APCC_CPU0_GP_LOW_IRQ,
724 RPM_APCC_CPU0_WAKE_UP_IRQ,
725 LPASS_SCSS_GP_LOW_IRQ,
726 LPASS_SCSS_GP_MEDIUM_IRQ,
727 LPASS_SCSS_GP_HIGH_IRQ,
728 SPS_MTI_31,
729};
730
731struct msm_mpm_device_data msm_mpm_dev_data = {
732 .irqs_m2a = msm_mpm_irqs_m2a,
733 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
734 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
735 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
736 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
737 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
738 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
739 .mpm_apps_ipc_val = BIT(1),
740 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600741};
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600742
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600743static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600744 0x00, 0x03, 0x00, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600745};
746
747static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600748 0x34, 0x24, 0x14, 0x04,
749 0x54, 0x03, 0x54, 0x04,
750 0x14, 0x24, 0x3e, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600751};
752
753static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600754 0x34, 0x24, 0x14, 0x04,
755 0x54, 0x07, 0x54, 0x04,
756 0x14, 0x24, 0x3e, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600757};
758
759static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
760 [0] = {
761 .mode = MSM_SPM_MODE_CLOCK_GATING,
762 .notify_rpm = false,
763 .cmd = spm_wfi_cmd_sequence,
764 },
765 [1] = {
766 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
767 .notify_rpm = false,
768 .cmd = spm_power_collapse_without_rpm,
769 },
770 [2] = {
771 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
772 .notify_rpm = true,
773 .cmd = spm_power_collapse_with_rpm,
774 },
775};
776
777static struct msm_spm_platform_data msm_spm_data[] __initdata = {
778 [0] = {
779 .reg_base_addr = MSM_SAW0_BASE,
780 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600781 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1001,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600782 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
783 .modes = msm_spm_seq_list,
784 },
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600785};
786
787static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
788 {
789 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
790 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
791 true,
792 1, 8000, 100000, 1,
793 },
794
795 {
796 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
797 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
798 true,
799 1500, 5000, 60100000, 3000,
800 },
801 {
802 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
803 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
804 false,
805 2800, 5000, 60350000, 3500,
806 },
807};
808
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700809void __init msm9615_device_init(void)
810{
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600811 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600812 BUG_ON(msm_rpm_init(&msm_rpm_data));
813 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
814 ARRAY_SIZE(msm_rpmrs_levels)));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700815}
816
Jeff Hugo56b933a2011-09-28 14:42:05 -0600817#define MSM_SHARED_RAM_PHYS 0x40000000
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700818void __init msm9615_map_io(void)
819{
Jeff Hugo56b933a2011-09-28 14:42:05 -0600820 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700821 msm_map_msm9615_io();
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700822 l2x0_cache_init();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700823 if (socinfo_init() < 0)
824 pr_err("socinfo_init() failed!\n");
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700825}
826
827void __init msm9615_init_irq(void)
828{
829 unsigned int i;
Rohit Vaswanib2e42e12011-10-07 21:25:53 -0700830
831 msm_mpm_irq_extn_init();
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700832 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
833 (void *)MSM_QGIC_CPU_BASE);
834
835 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
836 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
837
838 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
839 mb();
840
841 /*
842 * FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
843 * as they are configured as level, which does not play nice with
844 * handle_percpu_irq.
845 */
846 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
847 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
848 irq_set_handler(i, handle_percpu_irq);
849 }
850}