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