blob: 012eb851ddd0ceeca5373a7958346108c3b41052 [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
Amit Blay6a8d4f32011-11-21 10:36:25 +0200148static struct resource resources_hsusb_host[] = {
149 {
150 .start = MSM9615_HSUSB_PHYS,
151 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_PHYS - 1,
152 .flags = IORESOURCE_MEM,
153 },
154 {
155 .start = USB1_HS_IRQ,
156 .end = USB1_HS_IRQ,
157 .flags = IORESOURCE_IRQ,
158 },
159};
160
161static u64 dma_mask = DMA_BIT_MASK(32);
162struct platform_device msm_device_hsusb_host = {
163 .name = "msm_hsusb_host",
164 .id = -1,
165 .num_resources = ARRAY_SIZE(resources_hsusb_host),
166 .resource = resources_hsusb_host,
167 .dev = {
168 .dma_mask = &dma_mask,
169 .coherent_dma_mask = 0xffffffff,
170 },
171};
172
Rohit Vaswani09666872011-08-23 17:41:54 -0700173static struct resource resources_uart_gsbi4[] = {
174 {
175 .start = GSBI4_UARTDM_IRQ,
176 .end = GSBI4_UARTDM_IRQ,
177 .flags = IORESOURCE_IRQ,
178 },
179 {
180 .start = MSM_UART4DM_PHYS,
181 .end = MSM_UART4DM_PHYS + PAGE_SIZE - 1,
182 .name = "uartdm_resource",
183 .flags = IORESOURCE_MEM,
184 },
185 {
186 .start = MSM_GSBI4_PHYS,
187 .end = MSM_GSBI4_PHYS + PAGE_SIZE - 1,
188 .name = "gsbi_resource",
189 .flags = IORESOURCE_MEM,
190 },
191};
192
193struct platform_device msm9615_device_uart_gsbi4 = {
194 .name = "msm_serial_hsl",
195 .id = 0,
196 .num_resources = ARRAY_SIZE(resources_uart_gsbi4),
197 .resource = resources_uart_gsbi4,
198};
199
Harini Jayaramaneba52672011-09-08 15:13:00 -0600200static struct resource resources_qup_i2c_gsbi5[] = {
201 {
202 .name = "gsbi_qup_i2c_addr",
203 .start = MSM_GSBI5_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600204 .end = MSM_GSBI5_PHYS + 4 - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600205 .flags = IORESOURCE_MEM,
206 },
207 {
208 .name = "qup_phys_addr",
209 .start = MSM_GSBI5_QUP_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600210 .end = MSM_GSBI5_QUP_PHYS + MSM_QUP_SIZE - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600211 .flags = IORESOURCE_MEM,
212 },
213 {
214 .name = "qup_err_intr",
215 .start = GSBI5_QUP_IRQ,
216 .end = GSBI5_QUP_IRQ,
217 .flags = IORESOURCE_IRQ,
218 },
219};
220
221struct platform_device msm9615_device_qup_i2c_gsbi5 = {
222 .name = "qup_i2c",
223 .id = 0,
224 .num_resources = ARRAY_SIZE(resources_qup_i2c_gsbi5),
225 .resource = resources_qup_i2c_gsbi5,
226};
227
Harini Jayaraman738c9312011-09-08 15:22:38 -0600228static struct resource resources_qup_spi_gsbi3[] = {
229 {
230 .name = "spi_base",
231 .start = MSM_GSBI3_QUP_PHYS,
232 .end = MSM_GSBI3_QUP_PHYS + SZ_4K - 1,
233 .flags = IORESOURCE_MEM,
234 },
235 {
236 .name = "gsbi_base",
237 .start = MSM_GSBI3_PHYS,
238 .end = MSM_GSBI3_PHYS + 4 - 1,
239 .flags = IORESOURCE_MEM,
240 },
241 {
242 .name = "spi_irq_in",
243 .start = GSBI3_QUP_IRQ,
244 .end = GSBI3_QUP_IRQ,
245 .flags = IORESOURCE_IRQ,
246 },
247};
248
249struct platform_device msm9615_device_qup_spi_gsbi3 = {
250 .name = "spi_qsd",
251 .id = 0,
252 .num_resources = ARRAY_SIZE(resources_qup_spi_gsbi3),
253 .resource = resources_qup_spi_gsbi3,
254};
255
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700256static struct resource resources_ssbi_pmic1[] = {
257 {
258 .start = MSM_PMIC1_SSBI_CMD_PHYS,
259 .end = MSM_PMIC1_SSBI_CMD_PHYS + MSM_PMIC_SSBI_SIZE - 1,
260 .flags = IORESOURCE_MEM,
261 },
262};
263
264struct platform_device msm9615_device_ssbi_pmic1 = {
265 .name = "msm_ssbi",
266 .id = 0,
267 .resource = resources_ssbi_pmic1,
268 .num_resources = ARRAY_SIZE(resources_ssbi_pmic1),
269};
270
Yan He092b7272011-09-21 15:25:03 -0700271static struct resource resources_sps[] = {
272 {
273 .name = "pipe_mem",
274 .start = 0x12800000,
275 .end = 0x12800000 + 0x4000 - 1,
276 .flags = IORESOURCE_MEM,
277 },
278 {
279 .name = "bamdma_dma",
280 .start = 0x12240000,
281 .end = 0x12240000 + 0x1000 - 1,
282 .flags = IORESOURCE_MEM,
283 },
284 {
285 .name = "bamdma_bam",
286 .start = 0x12244000,
287 .end = 0x12244000 + 0x4000 - 1,
288 .flags = IORESOURCE_MEM,
289 },
290 {
291 .name = "bamdma_irq",
292 .start = SPS_BAM_DMA_IRQ,
293 .end = SPS_BAM_DMA_IRQ,
294 .flags = IORESOURCE_IRQ,
295 },
296};
297
298struct msm_sps_platform_data msm_sps_pdata = {
299 .bamdma_restricted_pipes = 0x06,
300};
301
302struct platform_device msm_device_sps = {
303 .name = "msm_sps",
304 .id = -1,
305 .num_resources = ARRAY_SIZE(resources_sps),
306 .resource = resources_sps,
307 .dev.platform_data = &msm_sps_pdata,
308};
309
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700310static struct tsens_platform_data msm_tsens_pdata = {
311 .slope = 910,
312 .tsens_factor = 1000,
313 .hw_type = MSM_9615,
314 .tsens_num_sensor = 5,
315};
316
Sahitya Tummala38295432011-09-29 10:08:45 +0530317struct platform_device msm9615_device_tsens = {
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700318 .name = "tsens8960-tm",
319 .id = -1,
Sahitya Tummala38295432011-09-29 10:08:45 +0530320 .dev = {
321 .platform_data = &msm_tsens_pdata,
322 },
323};
324
325#define MSM_NAND_PHYS 0x1B400000
326static struct resource resources_nand[] = {
327 [0] = {
328 .name = "msm_nand_dmac",
329 .start = DMOV_NAND_CHAN,
330 .end = DMOV_NAND_CHAN,
331 .flags = IORESOURCE_DMA,
332 },
333 [1] = {
334 .name = "msm_nand_phys",
335 .start = MSM_NAND_PHYS,
336 .end = MSM_NAND_PHYS + 0x7FF,
337 .flags = IORESOURCE_MEM,
338 },
339};
340
341struct flash_platform_data msm_nand_data = {
342 .parts = NULL,
343 .nr_parts = 0,
344};
345
346struct platform_device msm_device_nand = {
347 .name = "msm_nand",
348 .id = -1,
349 .num_resources = ARRAY_SIZE(resources_nand),
350 .resource = resources_nand,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700351 .dev = {
Sahitya Tummala38295432011-09-29 10:08:45 +0530352 .platform_data = &msm_nand_data,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700353 },
354};
355
Jeff Hugo56b933a2011-09-28 14:42:05 -0600356struct platform_device msm_device_smd = {
357 .name = "msm_smd",
358 .id = -1,
359};
360
Eric Holmberg0c96e702011-11-08 18:04:31 -0700361struct platform_device msm_device_bam_dmux = {
362 .name = "BAM_RMNT",
363 .id = -1,
364};
365
Ramesh Masavarapu5ad37392011-10-10 10:44:10 -0700366#ifdef CONFIG_HW_RANDOM_MSM
367/* PRNG device */
368#define MSM_PRNG_PHYS 0x1A500000
369static struct resource rng_resources = {
370 .flags = IORESOURCE_MEM,
371 .start = MSM_PRNG_PHYS,
372 .end = MSM_PRNG_PHYS + SZ_512 - 1,
373};
374
375struct platform_device msm_device_rng = {
376 .name = "msm_rng",
377 .id = 0,
378 .num_resources = 1,
379 .resource = &rng_resources,
380};
381#endif
Krishna Kondadd794462011-10-01 00:19:29 -0700382
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700383#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
384 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
385 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
386 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
387
388#define QCE_SIZE 0x10000
389#define QCE_0_BASE 0x18500000
390
391#define QCE_HW_KEY_SUPPORT 0
392#define QCE_SHA_HMAC_SUPPORT 1
393#define QCE_SHARE_CE_RESOURCE 1
394#define QCE_CE_SHARED 0
395
396static struct resource qcrypto_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
422static struct resource qcedev_resources[] = {
423 [0] = {
424 .start = QCE_0_BASE,
425 .end = QCE_0_BASE + QCE_SIZE - 1,
426 .flags = IORESOURCE_MEM,
427 },
428 [1] = {
429 .name = "crypto_channels",
430 .start = DMOV_CE_IN_CHAN,
431 .end = DMOV_CE_OUT_CHAN,
432 .flags = IORESOURCE_DMA,
433 },
434 [2] = {
435 .name = "crypto_crci_in",
436 .start = DMOV_CE_IN_CRCI,
437 .end = DMOV_CE_IN_CRCI,
438 .flags = IORESOURCE_DMA,
439 },
440 [3] = {
441 .name = "crypto_crci_out",
442 .start = DMOV_CE_OUT_CRCI,
443 .end = DMOV_CE_OUT_CRCI,
444 .flags = IORESOURCE_DMA,
445 },
446};
447
448#endif
449
450#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
451 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
452
453static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
454 .ce_shared = QCE_CE_SHARED,
455 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
456 .hw_key_support = QCE_HW_KEY_SUPPORT,
457 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
458};
459
460struct platform_device msm9615_qcrypto_device = {
461 .name = "qcrypto",
462 .id = 0,
463 .num_resources = ARRAY_SIZE(qcrypto_resources),
464 .resource = qcrypto_resources,
465 .dev = {
466 .coherent_dma_mask = DMA_BIT_MASK(32),
467 .platform_data = &qcrypto_ce_hw_suppport,
468 },
469};
470#endif
471
472#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
473 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
474
475static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
476 .ce_shared = QCE_CE_SHARED,
477 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
478 .hw_key_support = QCE_HW_KEY_SUPPORT,
479 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
480};
481
482struct platform_device msm9615_qcedev_device = {
483 .name = "qce",
484 .id = 0,
485 .num_resources = ARRAY_SIZE(qcedev_resources),
486 .resource = qcedev_resources,
487 .dev = {
488 .coherent_dma_mask = DMA_BIT_MASK(32),
489 .platform_data = &qcedev_ce_hw_suppport,
490 },
491};
492#endif
493
Krishna Kondadd794462011-10-01 00:19:29 -0700494#define MSM_SDC1_BASE 0x12180000
495#define MSM_SDC1_DML_BASE (MSM_SDC1_BASE + 0x800)
496#define MSM_SDC1_BAM_BASE (MSM_SDC1_BASE + 0x2000)
Krishna Konda71aef182011-10-01 02:27:51 -0700497#define MSM_SDC2_BASE 0x12140000
498#define MSM_SDC2_DML_BASE (MSM_SDC2_BASE + 0x800)
499#define MSM_SDC2_BAM_BASE (MSM_SDC2_BASE + 0x2000)
Krishna Kondadd794462011-10-01 00:19:29 -0700500
501static struct resource resources_sdc1[] = {
502 {
503 .name = "core_mem",
504 .flags = IORESOURCE_MEM,
505 .start = MSM_SDC1_BASE,
506 .end = MSM_SDC1_DML_BASE - 1,
507 },
508 {
509 .name = "core_irq",
510 .flags = IORESOURCE_IRQ,
511 .start = SDC1_IRQ_0,
512 .end = SDC1_IRQ_0
513 },
514#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
515 {
516 .name = "sdcc_dml_addr",
517 .start = MSM_SDC1_DML_BASE,
518 .end = MSM_SDC1_BAM_BASE - 1,
519 .flags = IORESOURCE_MEM,
520 },
521 {
522 .name = "sdcc_bam_addr",
523 .start = MSM_SDC1_BAM_BASE,
524 .end = MSM_SDC1_BAM_BASE + (2 * SZ_4K) - 1,
525 .flags = IORESOURCE_MEM,
526 },
527 {
528 .name = "sdcc_bam_irq",
529 .start = SDC1_BAM_IRQ,
530 .end = SDC1_BAM_IRQ,
531 .flags = IORESOURCE_IRQ,
532 },
533#endif
534};
535
Krishna Konda71aef182011-10-01 02:27:51 -0700536static struct resource resources_sdc2[] = {
537 {
538 .name = "core_mem",
539 .flags = IORESOURCE_MEM,
540 .start = MSM_SDC2_BASE,
541 .end = MSM_SDC2_DML_BASE - 1,
542 },
543 {
544 .name = "core_irq",
545 .flags = IORESOURCE_IRQ,
546 .start = SDC2_IRQ_0,
547 .end = SDC2_IRQ_0
548 },
549#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
550 {
551 .name = "sdcc_dml_addr",
552 .start = MSM_SDC2_DML_BASE,
553 .end = MSM_SDC2_BAM_BASE - 1,
554 .flags = IORESOURCE_MEM,
555 },
556 {
557 .name = "sdcc_bam_addr",
558 .start = MSM_SDC2_BAM_BASE,
559 .end = MSM_SDC2_BAM_BASE + (2 * SZ_4K) - 1,
560 .flags = IORESOURCE_MEM,
561 },
562 {
563 .name = "sdcc_bam_irq",
564 .start = SDC2_BAM_IRQ,
565 .end = SDC2_BAM_IRQ,
566 .flags = IORESOURCE_IRQ,
567 },
568#endif
569};
570
Krishna Kondadd794462011-10-01 00:19:29 -0700571struct platform_device msm_device_sdc1 = {
572 .name = "msm_sdcc",
573 .id = 1,
574 .num_resources = ARRAY_SIZE(resources_sdc1),
575 .resource = resources_sdc1,
576 .dev = {
577 .coherent_dma_mask = 0xffffffff,
578 },
579};
580
Krishna Konda71aef182011-10-01 02:27:51 -0700581struct platform_device msm_device_sdc2 = {
582 .name = "msm_sdcc",
583 .id = 2,
584 .num_resources = ARRAY_SIZE(resources_sdc2),
585 .resource = resources_sdc2,
586 .dev = {
587 .coherent_dma_mask = 0xffffffff,
588 },
589};
590
Krishna Kondadd794462011-10-01 00:19:29 -0700591static struct platform_device *msm_sdcc_devices[] __initdata = {
592 &msm_device_sdc1,
Krishna Konda71aef182011-10-01 02:27:51 -0700593 &msm_device_sdc2,
Krishna Kondadd794462011-10-01 00:19:29 -0700594};
595
596int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
597{
598 struct platform_device *pdev;
599
600 if (controller < 1 || controller > 2)
601 return -EINVAL;
602
603 pdev = msm_sdcc_devices[controller - 1];
604 pdev->dev.platform_data = plat;
605 return platform_device_register(pdev);
606}
607
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700608#ifdef CONFIG_CACHE_L2X0
609static int __init l2x0_cache_init(void)
610{
611 int aux_ctrl = 0;
612
613 /* Way Size 010(0x2) 32KB */
614 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
615 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
616 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
617
618 /* L2 Latency setting required by hardware. Default is 0x20
619 which is no good.
620 */
621 writel_relaxed(0x220, MSM_L2CC_BASE + L2X0_DATA_LATENCY_CTRL);
622 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
623
624 return 0;
625}
626#else
627static int __init l2x0_cache_init(void){ return 0; }
628#endif
629
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600630struct msm_rpm_map_data rpm_map_data[] __initdata = {
631 MSM_RPM_MAP(TRIGGER_TIMED_TO, TRIGGER_TIMED, 1),
632 MSM_RPM_MAP(TRIGGER_TIMED_SCLK_COUNT, TRIGGER_TIMED, 1),
633
634 MSM_RPM_MAP(RPM_CTL, RPM_CTL, 1),
635
636 MSM_RPM_MAP(CXO_CLK, CXO_CLK, 1),
637 MSM_RPM_MAP(SYSTEM_FABRIC_CLK, SYSTEM_FABRIC_CLK, 1),
638 MSM_RPM_MAP(DAYTONA_FABRIC_CLK, DAYTONA_FABRIC_CLK, 1),
639 MSM_RPM_MAP(SFPB_CLK, SFPB_CLK, 1),
640 MSM_RPM_MAP(CFPB_CLK, CFPB_CLK, 1),
641 MSM_RPM_MAP(EBI1_CLK, EBI1_CLK, 1),
642
643 MSM_RPM_MAP(SYS_FABRIC_CFG_HALT_0, SYS_FABRIC_CFG_HALT, 2),
644 MSM_RPM_MAP(SYS_FABRIC_CFG_CLKMOD_0, SYS_FABRIC_CFG_CLKMOD, 3),
645 MSM_RPM_MAP(SYS_FABRIC_CFG_IOCTL, SYS_FABRIC_CFG_IOCTL, 1),
646 MSM_RPM_MAP(SYSTEM_FABRIC_ARB_0, SYSTEM_FABRIC_ARB, 27),
647
648 MSM_RPM_MAP(PM8018_S1_0, PM8018_S1, 2),
649 MSM_RPM_MAP(PM8018_S2_0, PM8018_S2, 2),
650 MSM_RPM_MAP(PM8018_S3_0, PM8018_S3, 2),
651 MSM_RPM_MAP(PM8018_S4_0, PM8018_S4, 2),
652 MSM_RPM_MAP(PM8018_S5_0, PM8018_S5, 2),
653 MSM_RPM_MAP(PM8018_L1_0, PM8018_L1, 2),
654 MSM_RPM_MAP(PM8018_L2_0, PM8018_L2, 2),
655 MSM_RPM_MAP(PM8018_L3_0, PM8018_L3, 2),
656 MSM_RPM_MAP(PM8018_L4_0, PM8018_L4, 2),
657 MSM_RPM_MAP(PM8018_L5_0, PM8018_L5, 2),
658 MSM_RPM_MAP(PM8018_L6_0, PM8018_L6, 2),
659 MSM_RPM_MAP(PM8018_L7_0, PM8018_L7, 2),
660 MSM_RPM_MAP(PM8018_L8_0, PM8018_L8, 2),
661 MSM_RPM_MAP(PM8018_L9_0, PM8018_L9, 2),
662 MSM_RPM_MAP(PM8018_L10_0, PM8018_L10, 2),
663 MSM_RPM_MAP(PM8018_L11_0, PM8018_L11, 2),
664 MSM_RPM_MAP(PM8018_L12_0, PM8018_L12, 2),
665 MSM_RPM_MAP(PM8018_L13_0, PM8018_L13, 2),
666 MSM_RPM_MAP(PM8018_L14_0, PM8018_L14, 2),
667 MSM_RPM_MAP(PM8018_LVS1, PM8018_LVS1, 1),
668 MSM_RPM_MAP(NCP_0, NCP, 2),
669 MSM_RPM_MAP(CXO_BUFFERS, CXO_BUFFERS, 1),
670 MSM_RPM_MAP(USB_OTG_SWITCH, USB_OTG_SWITCH, 1),
671 MSM_RPM_MAP(HDMI_SWITCH, HDMI_SWITCH, 1),
672};
673unsigned int rpm_map_data_size = ARRAY_SIZE(rpm_map_data);
674
675static struct msm_rpm_platform_data msm_rpm_data = {
676 .reg_base_addrs = {
677 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
678 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
679 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
680 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
681 },
682
683 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
684 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
685 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
686 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
687 .msm_apps_ipc_rpm_val = 4,
688};
689
690struct platform_device msm_rpm_device = {
691 .name = "msm_rpm",
692 .id = -1,
693};
694
695static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] = {
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -0600696 [4] = MSM_GPIO_TO_INT(30),
697 [5] = MSM_GPIO_TO_INT(59),
698 [6] = MSM_GPIO_TO_INT(81),
699 [7] = MSM_GPIO_TO_INT(87),
700 [8] = MSM_GPIO_TO_INT(86),
701 [9] = MSM_GPIO_TO_INT(2),
702 [10] = MSM_GPIO_TO_INT(6),
703 [11] = MSM_GPIO_TO_INT(10),
704 [12] = MSM_GPIO_TO_INT(14),
705 [13] = MSM_GPIO_TO_INT(18),
706 [14] = MSM_GPIO_TO_INT(7),
707 [15] = MSM_GPIO_TO_INT(11),
708 [16] = MSM_GPIO_TO_INT(15),
709 [19] = MSM_GPIO_TO_INT(26),
710 [20] = MSM_GPIO_TO_INT(28),
711 [23] = MSM_GPIO_TO_INT(19),
712 [24] = MSM_GPIO_TO_INT(23),
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600713 [25] = USB1_HS_IRQ,
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -0600714 [26] = MSM_GPIO_TO_INT(3),
715 [27] = MSM_GPIO_TO_INT(68),
716 [29] = MSM_GPIO_TO_INT(78),
717 [31] = MSM_GPIO_TO_INT(0),
718 [32] = MSM_GPIO_TO_INT(4),
719 [33] = MSM_GPIO_TO_INT(22),
720 [34] = MSM_GPIO_TO_INT(17),
721 [37] = MSM_GPIO_TO_INT(20),
722 [39] = MSM_GPIO_TO_INT(84),
723 [42] = MSM_GPIO_TO_INT(24),
724 [43] = MSM_GPIO_TO_INT(79),
725 [44] = MSM_GPIO_TO_INT(80),
726 [45] = MSM_GPIO_TO_INT(82),
727 [46] = MSM_GPIO_TO_INT(85),
728 [47] = MSM_GPIO_TO_INT(45),
729 [48] = MSM_GPIO_TO_INT(50),
730 [49] = MSM_GPIO_TO_INT(51),
731 [50] = MSM_GPIO_TO_INT(69),
732 [51] = MSM_GPIO_TO_INT(77),
733 [52] = MSM_GPIO_TO_INT(1),
734 [53] = MSM_GPIO_TO_INT(5),
735 [54] = MSM_GPIO_TO_INT(40),
736 [55] = MSM_GPIO_TO_INT(27),
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600737};
738
739static uint16_t msm_mpm_bypassed_apps_irqs[] = {
740 TLMM_MSM_SUMMARY_IRQ,
741 RPM_APCC_CPU0_GP_HIGH_IRQ,
742 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
743 RPM_APCC_CPU0_GP_LOW_IRQ,
744 RPM_APCC_CPU0_WAKE_UP_IRQ,
745 LPASS_SCSS_GP_LOW_IRQ,
746 LPASS_SCSS_GP_MEDIUM_IRQ,
747 LPASS_SCSS_GP_HIGH_IRQ,
748 SPS_MTI_31,
749};
750
751struct msm_mpm_device_data msm_mpm_dev_data = {
752 .irqs_m2a = msm_mpm_irqs_m2a,
753 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
754 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
755 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
756 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
757 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
758 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
759 .mpm_apps_ipc_val = BIT(1),
760 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600761};
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600762
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600763static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600764 0x00, 0x03, 0x00, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600765};
766
767static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600768 0x34, 0x24, 0x14, 0x04,
769 0x54, 0x03, 0x54, 0x04,
770 0x14, 0x24, 0x3e, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600771};
772
773static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600774 0x34, 0x24, 0x14, 0x04,
775 0x54, 0x07, 0x54, 0x04,
776 0x14, 0x24, 0x3e, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600777};
778
779static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
780 [0] = {
781 .mode = MSM_SPM_MODE_CLOCK_GATING,
782 .notify_rpm = false,
783 .cmd = spm_wfi_cmd_sequence,
784 },
785 [1] = {
786 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
787 .notify_rpm = false,
788 .cmd = spm_power_collapse_without_rpm,
789 },
790 [2] = {
791 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
792 .notify_rpm = true,
793 .cmd = spm_power_collapse_with_rpm,
794 },
795};
796
797static struct msm_spm_platform_data msm_spm_data[] __initdata = {
798 [0] = {
799 .reg_base_addr = MSM_SAW0_BASE,
800 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600801 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1001,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600802 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
803 .modes = msm_spm_seq_list,
804 },
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600805};
806
807static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
808 {
809 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
810 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
811 true,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -0600812 100, 8000, 100000, 1,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600813 },
814
815 {
816 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
817 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
818 true,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -0600819 2000, 5000, 60100000, 3000,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600820 },
821 {
822 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
823 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
824 false,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -0600825 6300, 5000, 60350000, 3500,
826 },
827 {
828 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
829 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
830 false,
831 13300, 2000, 71850000, 6800,
832 },
833 {
834 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
835 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
836 false,
837 28300, 0, 76350000, 9800,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600838 },
839};
840
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700841void __init msm9615_device_init(void)
842{
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600843 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600844 BUG_ON(msm_rpm_init(&msm_rpm_data));
845 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
846 ARRAY_SIZE(msm_rpmrs_levels)));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700847}
848
Jeff Hugo56b933a2011-09-28 14:42:05 -0600849#define MSM_SHARED_RAM_PHYS 0x40000000
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700850void __init msm9615_map_io(void)
851{
Jeff Hugo56b933a2011-09-28 14:42:05 -0600852 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700853 msm_map_msm9615_io();
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700854 l2x0_cache_init();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700855 if (socinfo_init() < 0)
856 pr_err("socinfo_init() failed!\n");
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700857}
858
859void __init msm9615_init_irq(void)
860{
861 unsigned int i;
Rohit Vaswanib2e42e12011-10-07 21:25:53 -0700862
863 msm_mpm_irq_extn_init();
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700864 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
865 (void *)MSM_QGIC_CPU_BASE);
866
867 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
868 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
869
870 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
871 mb();
872
873 /*
874 * FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
875 * as they are configured as level, which does not play nice with
876 * handle_percpu_irq.
877 */
878 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
879 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
880 irq_set_handler(i, handle_percpu_irq);
881 }
882}
Gagan Mac7a827642011-09-22 19:42:21 -0600883
884struct platform_device msm_bus_9615_sys_fabric = {
885 .name = "msm_bus_fabric",
886 .id = MSM_BUS_FAB_SYSTEM,
887};
888
889struct platform_device msm_bus_def_fab = {
890 .name = "msm_bus_fabric",
891 .id = MSM_BUS_FAB_DEFAULT,
892};