blob: 5b500a31824dc2ba0ab1c93a93c83afd96f9941f [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
Ofir Cohen40a4e862011-12-08 15:17:52 +0200102#define MSM_USB_BAM_BASE 0x12502000
103#define MSM_USB_BAM_SIZE 0x3DFFF
104
Amit Blay5e4ec192011-10-20 09:16:54 +0200105static struct resource resources_otg[] = {
106 {
107 .start = MSM9615_HSUSB_PHYS,
108 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_SIZE - 1,
109 .flags = IORESOURCE_MEM,
110 },
111 {
112 .start = USB1_HS_IRQ,
113 .end = USB1_HS_IRQ,
114 .flags = IORESOURCE_IRQ,
115 },
116};
117
118struct platform_device msm_device_otg = {
119 .name = "msm_otg",
120 .id = -1,
121 .num_resources = ARRAY_SIZE(resources_otg),
122 .resource = resources_otg,
123 .dev = {
124 .coherent_dma_mask = DMA_BIT_MASK(32),
125 },
126};
127
128static struct resource resources_hsusb[] = {
129 {
130 .start = MSM9615_HSUSB_PHYS,
131 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_SIZE - 1,
132 .flags = IORESOURCE_MEM,
133 },
134 {
135 .start = USB1_HS_IRQ,
136 .end = USB1_HS_IRQ,
137 .flags = IORESOURCE_IRQ,
138 },
139};
140
Ofir Cohen40a4e862011-12-08 15:17:52 +0200141static struct resource resources_usb_bam[] = {
142 {
143 .name = "usb_bam_addr",
144 .start = MSM_USB_BAM_BASE,
145 .end = MSM_USB_BAM_BASE + MSM_USB_BAM_SIZE,
146 .flags = IORESOURCE_MEM,
147 },
148 {
149 .name = "usb_bam_irq",
150 .start = USB1_HS_BAM_IRQ,
151 .end = USB1_HS_BAM_IRQ,
152 .flags = IORESOURCE_IRQ,
153 },
154};
155
156struct platform_device msm_device_usb_bam = {
157 .name = "usb_bam",
158 .id = -1,
159 .num_resources = ARRAY_SIZE(resources_usb_bam),
160 .resource = resources_usb_bam,
161};
162
Amit Blay5e4ec192011-10-20 09:16:54 +0200163struct platform_device msm_device_gadget_peripheral = {
164 .name = "msm_hsusb",
165 .id = -1,
166 .num_resources = ARRAY_SIZE(resources_hsusb),
167 .resource = resources_hsusb,
168 .dev = {
169 .coherent_dma_mask = DMA_BIT_MASK(32),
170 },
171};
172
Amit Blay6a8d4f32011-11-21 10:36:25 +0200173static struct resource resources_hsusb_host[] = {
174 {
175 .start = MSM9615_HSUSB_PHYS,
176 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_PHYS - 1,
177 .flags = IORESOURCE_MEM,
178 },
179 {
180 .start = USB1_HS_IRQ,
181 .end = USB1_HS_IRQ,
182 .flags = IORESOURCE_IRQ,
183 },
184};
185
186static u64 dma_mask = DMA_BIT_MASK(32);
187struct platform_device msm_device_hsusb_host = {
188 .name = "msm_hsusb_host",
189 .id = -1,
190 .num_resources = ARRAY_SIZE(resources_hsusb_host),
191 .resource = resources_hsusb_host,
192 .dev = {
193 .dma_mask = &dma_mask,
194 .coherent_dma_mask = 0xffffffff,
195 },
196};
197
Rohit Vaswani09666872011-08-23 17:41:54 -0700198static struct resource resources_uart_gsbi4[] = {
199 {
200 .start = GSBI4_UARTDM_IRQ,
201 .end = GSBI4_UARTDM_IRQ,
202 .flags = IORESOURCE_IRQ,
203 },
204 {
205 .start = MSM_UART4DM_PHYS,
206 .end = MSM_UART4DM_PHYS + PAGE_SIZE - 1,
207 .name = "uartdm_resource",
208 .flags = IORESOURCE_MEM,
209 },
210 {
211 .start = MSM_GSBI4_PHYS,
212 .end = MSM_GSBI4_PHYS + PAGE_SIZE - 1,
213 .name = "gsbi_resource",
214 .flags = IORESOURCE_MEM,
215 },
216};
217
218struct platform_device msm9615_device_uart_gsbi4 = {
219 .name = "msm_serial_hsl",
220 .id = 0,
221 .num_resources = ARRAY_SIZE(resources_uart_gsbi4),
222 .resource = resources_uart_gsbi4,
223};
224
Harini Jayaramaneba52672011-09-08 15:13:00 -0600225static struct resource resources_qup_i2c_gsbi5[] = {
226 {
227 .name = "gsbi_qup_i2c_addr",
228 .start = MSM_GSBI5_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600229 .end = MSM_GSBI5_PHYS + 4 - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600230 .flags = IORESOURCE_MEM,
231 },
232 {
233 .name = "qup_phys_addr",
234 .start = MSM_GSBI5_QUP_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600235 .end = MSM_GSBI5_QUP_PHYS + MSM_QUP_SIZE - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600236 .flags = IORESOURCE_MEM,
237 },
238 {
239 .name = "qup_err_intr",
240 .start = GSBI5_QUP_IRQ,
241 .end = GSBI5_QUP_IRQ,
242 .flags = IORESOURCE_IRQ,
243 },
244};
245
246struct platform_device msm9615_device_qup_i2c_gsbi5 = {
247 .name = "qup_i2c",
248 .id = 0,
249 .num_resources = ARRAY_SIZE(resources_qup_i2c_gsbi5),
250 .resource = resources_qup_i2c_gsbi5,
251};
252
Harini Jayaraman738c9312011-09-08 15:22:38 -0600253static struct resource resources_qup_spi_gsbi3[] = {
254 {
255 .name = "spi_base",
256 .start = MSM_GSBI3_QUP_PHYS,
257 .end = MSM_GSBI3_QUP_PHYS + SZ_4K - 1,
258 .flags = IORESOURCE_MEM,
259 },
260 {
261 .name = "gsbi_base",
262 .start = MSM_GSBI3_PHYS,
263 .end = MSM_GSBI3_PHYS + 4 - 1,
264 .flags = IORESOURCE_MEM,
265 },
266 {
267 .name = "spi_irq_in",
268 .start = GSBI3_QUP_IRQ,
269 .end = GSBI3_QUP_IRQ,
270 .flags = IORESOURCE_IRQ,
271 },
272};
273
274struct platform_device msm9615_device_qup_spi_gsbi3 = {
275 .name = "spi_qsd",
276 .id = 0,
277 .num_resources = ARRAY_SIZE(resources_qup_spi_gsbi3),
278 .resource = resources_qup_spi_gsbi3,
279};
280
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700281static struct resource resources_ssbi_pmic1[] = {
282 {
283 .start = MSM_PMIC1_SSBI_CMD_PHYS,
284 .end = MSM_PMIC1_SSBI_CMD_PHYS + MSM_PMIC_SSBI_SIZE - 1,
285 .flags = IORESOURCE_MEM,
286 },
287};
288
289struct platform_device msm9615_device_ssbi_pmic1 = {
290 .name = "msm_ssbi",
291 .id = 0,
292 .resource = resources_ssbi_pmic1,
293 .num_resources = ARRAY_SIZE(resources_ssbi_pmic1),
294};
295
Yan He092b7272011-09-21 15:25:03 -0700296static struct resource resources_sps[] = {
297 {
298 .name = "pipe_mem",
299 .start = 0x12800000,
300 .end = 0x12800000 + 0x4000 - 1,
301 .flags = IORESOURCE_MEM,
302 },
303 {
304 .name = "bamdma_dma",
305 .start = 0x12240000,
306 .end = 0x12240000 + 0x1000 - 1,
307 .flags = IORESOURCE_MEM,
308 },
309 {
310 .name = "bamdma_bam",
311 .start = 0x12244000,
312 .end = 0x12244000 + 0x4000 - 1,
313 .flags = IORESOURCE_MEM,
314 },
315 {
316 .name = "bamdma_irq",
317 .start = SPS_BAM_DMA_IRQ,
318 .end = SPS_BAM_DMA_IRQ,
319 .flags = IORESOURCE_IRQ,
320 },
321};
322
323struct msm_sps_platform_data msm_sps_pdata = {
324 .bamdma_restricted_pipes = 0x06,
325};
326
327struct platform_device msm_device_sps = {
328 .name = "msm_sps",
329 .id = -1,
330 .num_resources = ARRAY_SIZE(resources_sps),
331 .resource = resources_sps,
332 .dev.platform_data = &msm_sps_pdata,
333};
334
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700335static struct tsens_platform_data msm_tsens_pdata = {
336 .slope = 910,
337 .tsens_factor = 1000,
338 .hw_type = MSM_9615,
339 .tsens_num_sensor = 5,
340};
341
Sahitya Tummala38295432011-09-29 10:08:45 +0530342struct platform_device msm9615_device_tsens = {
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700343 .name = "tsens8960-tm",
344 .id = -1,
Sahitya Tummala38295432011-09-29 10:08:45 +0530345 .dev = {
346 .platform_data = &msm_tsens_pdata,
347 },
348};
349
350#define MSM_NAND_PHYS 0x1B400000
351static struct resource resources_nand[] = {
352 [0] = {
353 .name = "msm_nand_dmac",
354 .start = DMOV_NAND_CHAN,
355 .end = DMOV_NAND_CHAN,
356 .flags = IORESOURCE_DMA,
357 },
358 [1] = {
359 .name = "msm_nand_phys",
360 .start = MSM_NAND_PHYS,
361 .end = MSM_NAND_PHYS + 0x7FF,
362 .flags = IORESOURCE_MEM,
363 },
364};
365
366struct flash_platform_data msm_nand_data = {
367 .parts = NULL,
368 .nr_parts = 0,
369};
370
371struct platform_device msm_device_nand = {
372 .name = "msm_nand",
373 .id = -1,
374 .num_resources = ARRAY_SIZE(resources_nand),
375 .resource = resources_nand,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700376 .dev = {
Sahitya Tummala38295432011-09-29 10:08:45 +0530377 .platform_data = &msm_nand_data,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700378 },
379};
380
Jeff Hugo56b933a2011-09-28 14:42:05 -0600381struct platform_device msm_device_smd = {
382 .name = "msm_smd",
383 .id = -1,
384};
385
Eric Holmberg0c96e702011-11-08 18:04:31 -0700386struct platform_device msm_device_bam_dmux = {
387 .name = "BAM_RMNT",
388 .id = -1,
389};
390
Ramesh Masavarapu5ad37392011-10-10 10:44:10 -0700391#ifdef CONFIG_HW_RANDOM_MSM
392/* PRNG device */
393#define MSM_PRNG_PHYS 0x1A500000
394static struct resource rng_resources = {
395 .flags = IORESOURCE_MEM,
396 .start = MSM_PRNG_PHYS,
397 .end = MSM_PRNG_PHYS + SZ_512 - 1,
398};
399
400struct platform_device msm_device_rng = {
401 .name = "msm_rng",
402 .id = 0,
403 .num_resources = 1,
404 .resource = &rng_resources,
405};
406#endif
Krishna Kondadd794462011-10-01 00:19:29 -0700407
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700408#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
409 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
410 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
411 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
412
413#define QCE_SIZE 0x10000
414#define QCE_0_BASE 0x18500000
415
416#define QCE_HW_KEY_SUPPORT 0
417#define QCE_SHA_HMAC_SUPPORT 1
418#define QCE_SHARE_CE_RESOURCE 1
419#define QCE_CE_SHARED 0
420
421static struct resource qcrypto_resources[] = {
422 [0] = {
423 .start = QCE_0_BASE,
424 .end = QCE_0_BASE + QCE_SIZE - 1,
425 .flags = IORESOURCE_MEM,
426 },
427 [1] = {
428 .name = "crypto_channels",
429 .start = DMOV_CE_IN_CHAN,
430 .end = DMOV_CE_OUT_CHAN,
431 .flags = IORESOURCE_DMA,
432 },
433 [2] = {
434 .name = "crypto_crci_in",
435 .start = DMOV_CE_IN_CRCI,
436 .end = DMOV_CE_IN_CRCI,
437 .flags = IORESOURCE_DMA,
438 },
439 [3] = {
440 .name = "crypto_crci_out",
441 .start = DMOV_CE_OUT_CRCI,
442 .end = DMOV_CE_OUT_CRCI,
443 .flags = IORESOURCE_DMA,
444 },
445};
446
447static struct resource qcedev_resources[] = {
448 [0] = {
449 .start = QCE_0_BASE,
450 .end = QCE_0_BASE + QCE_SIZE - 1,
451 .flags = IORESOURCE_MEM,
452 },
453 [1] = {
454 .name = "crypto_channels",
455 .start = DMOV_CE_IN_CHAN,
456 .end = DMOV_CE_OUT_CHAN,
457 .flags = IORESOURCE_DMA,
458 },
459 [2] = {
460 .name = "crypto_crci_in",
461 .start = DMOV_CE_IN_CRCI,
462 .end = DMOV_CE_IN_CRCI,
463 .flags = IORESOURCE_DMA,
464 },
465 [3] = {
466 .name = "crypto_crci_out",
467 .start = DMOV_CE_OUT_CRCI,
468 .end = DMOV_CE_OUT_CRCI,
469 .flags = IORESOURCE_DMA,
470 },
471};
472
473#endif
474
475#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
476 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
477
478static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
479 .ce_shared = QCE_CE_SHARED,
480 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
481 .hw_key_support = QCE_HW_KEY_SUPPORT,
482 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800483 .bus_scale_table = NULL,
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700484};
485
486struct platform_device msm9615_qcrypto_device = {
487 .name = "qcrypto",
488 .id = 0,
489 .num_resources = ARRAY_SIZE(qcrypto_resources),
490 .resource = qcrypto_resources,
491 .dev = {
492 .coherent_dma_mask = DMA_BIT_MASK(32),
493 .platform_data = &qcrypto_ce_hw_suppport,
494 },
495};
496#endif
497
498#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
499 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
500
501static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
502 .ce_shared = QCE_CE_SHARED,
503 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
504 .hw_key_support = QCE_HW_KEY_SUPPORT,
505 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800506 .bus_scale_table = NULL,
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700507};
508
509struct platform_device msm9615_qcedev_device = {
510 .name = "qce",
511 .id = 0,
512 .num_resources = ARRAY_SIZE(qcedev_resources),
513 .resource = qcedev_resources,
514 .dev = {
515 .coherent_dma_mask = DMA_BIT_MASK(32),
516 .platform_data = &qcedev_ce_hw_suppport,
517 },
518};
519#endif
520
Krishna Kondadd794462011-10-01 00:19:29 -0700521#define MSM_SDC1_BASE 0x12180000
522#define MSM_SDC1_DML_BASE (MSM_SDC1_BASE + 0x800)
523#define MSM_SDC1_BAM_BASE (MSM_SDC1_BASE + 0x2000)
Krishna Konda71aef182011-10-01 02:27:51 -0700524#define MSM_SDC2_BASE 0x12140000
525#define MSM_SDC2_DML_BASE (MSM_SDC2_BASE + 0x800)
526#define MSM_SDC2_BAM_BASE (MSM_SDC2_BASE + 0x2000)
Krishna Kondadd794462011-10-01 00:19:29 -0700527
528static struct resource resources_sdc1[] = {
529 {
530 .name = "core_mem",
531 .flags = IORESOURCE_MEM,
532 .start = MSM_SDC1_BASE,
533 .end = MSM_SDC1_DML_BASE - 1,
534 },
535 {
536 .name = "core_irq",
537 .flags = IORESOURCE_IRQ,
538 .start = SDC1_IRQ_0,
539 .end = SDC1_IRQ_0
540 },
541#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
542 {
543 .name = "sdcc_dml_addr",
544 .start = MSM_SDC1_DML_BASE,
545 .end = MSM_SDC1_BAM_BASE - 1,
546 .flags = IORESOURCE_MEM,
547 },
548 {
549 .name = "sdcc_bam_addr",
550 .start = MSM_SDC1_BAM_BASE,
551 .end = MSM_SDC1_BAM_BASE + (2 * SZ_4K) - 1,
552 .flags = IORESOURCE_MEM,
553 },
554 {
555 .name = "sdcc_bam_irq",
556 .start = SDC1_BAM_IRQ,
557 .end = SDC1_BAM_IRQ,
558 .flags = IORESOURCE_IRQ,
559 },
560#endif
561};
562
Krishna Konda71aef182011-10-01 02:27:51 -0700563static struct resource resources_sdc2[] = {
564 {
565 .name = "core_mem",
566 .flags = IORESOURCE_MEM,
567 .start = MSM_SDC2_BASE,
568 .end = MSM_SDC2_DML_BASE - 1,
569 },
570 {
571 .name = "core_irq",
572 .flags = IORESOURCE_IRQ,
573 .start = SDC2_IRQ_0,
574 .end = SDC2_IRQ_0
575 },
576#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
577 {
578 .name = "sdcc_dml_addr",
579 .start = MSM_SDC2_DML_BASE,
580 .end = MSM_SDC2_BAM_BASE - 1,
581 .flags = IORESOURCE_MEM,
582 },
583 {
584 .name = "sdcc_bam_addr",
585 .start = MSM_SDC2_BAM_BASE,
586 .end = MSM_SDC2_BAM_BASE + (2 * SZ_4K) - 1,
587 .flags = IORESOURCE_MEM,
588 },
589 {
590 .name = "sdcc_bam_irq",
591 .start = SDC2_BAM_IRQ,
592 .end = SDC2_BAM_IRQ,
593 .flags = IORESOURCE_IRQ,
594 },
595#endif
596};
597
Krishna Kondadd794462011-10-01 00:19:29 -0700598struct platform_device msm_device_sdc1 = {
599 .name = "msm_sdcc",
600 .id = 1,
601 .num_resources = ARRAY_SIZE(resources_sdc1),
602 .resource = resources_sdc1,
603 .dev = {
604 .coherent_dma_mask = 0xffffffff,
605 },
606};
607
Krishna Konda71aef182011-10-01 02:27:51 -0700608struct platform_device msm_device_sdc2 = {
609 .name = "msm_sdcc",
610 .id = 2,
611 .num_resources = ARRAY_SIZE(resources_sdc2),
612 .resource = resources_sdc2,
613 .dev = {
614 .coherent_dma_mask = 0xffffffff,
615 },
616};
617
Krishna Kondadd794462011-10-01 00:19:29 -0700618static struct platform_device *msm_sdcc_devices[] __initdata = {
619 &msm_device_sdc1,
Krishna Konda71aef182011-10-01 02:27:51 -0700620 &msm_device_sdc2,
Krishna Kondadd794462011-10-01 00:19:29 -0700621};
622
623int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
624{
625 struct platform_device *pdev;
626
627 if (controller < 1 || controller > 2)
628 return -EINVAL;
629
630 pdev = msm_sdcc_devices[controller - 1];
631 pdev->dev.platform_data = plat;
632 return platform_device_register(pdev);
633}
634
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700635#ifdef CONFIG_CACHE_L2X0
636static int __init l2x0_cache_init(void)
637{
638 int aux_ctrl = 0;
639
640 /* Way Size 010(0x2) 32KB */
641 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
642 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
643 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
644
645 /* L2 Latency setting required by hardware. Default is 0x20
646 which is no good.
647 */
648 writel_relaxed(0x220, MSM_L2CC_BASE + L2X0_DATA_LATENCY_CTRL);
649 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
650
651 return 0;
652}
653#else
654static int __init l2x0_cache_init(void){ return 0; }
655#endif
656
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600657struct msm_rpm_map_data rpm_map_data[] __initdata = {
658 MSM_RPM_MAP(TRIGGER_TIMED_TO, TRIGGER_TIMED, 1),
659 MSM_RPM_MAP(TRIGGER_TIMED_SCLK_COUNT, TRIGGER_TIMED, 1),
660
661 MSM_RPM_MAP(RPM_CTL, RPM_CTL, 1),
662
663 MSM_RPM_MAP(CXO_CLK, CXO_CLK, 1),
664 MSM_RPM_MAP(SYSTEM_FABRIC_CLK, SYSTEM_FABRIC_CLK, 1),
665 MSM_RPM_MAP(DAYTONA_FABRIC_CLK, DAYTONA_FABRIC_CLK, 1),
666 MSM_RPM_MAP(SFPB_CLK, SFPB_CLK, 1),
667 MSM_RPM_MAP(CFPB_CLK, CFPB_CLK, 1),
668 MSM_RPM_MAP(EBI1_CLK, EBI1_CLK, 1),
669
670 MSM_RPM_MAP(SYS_FABRIC_CFG_HALT_0, SYS_FABRIC_CFG_HALT, 2),
671 MSM_RPM_MAP(SYS_FABRIC_CFG_CLKMOD_0, SYS_FABRIC_CFG_CLKMOD, 3),
672 MSM_RPM_MAP(SYS_FABRIC_CFG_IOCTL, SYS_FABRIC_CFG_IOCTL, 1),
673 MSM_RPM_MAP(SYSTEM_FABRIC_ARB_0, SYSTEM_FABRIC_ARB, 27),
674
675 MSM_RPM_MAP(PM8018_S1_0, PM8018_S1, 2),
676 MSM_RPM_MAP(PM8018_S2_0, PM8018_S2, 2),
677 MSM_RPM_MAP(PM8018_S3_0, PM8018_S3, 2),
678 MSM_RPM_MAP(PM8018_S4_0, PM8018_S4, 2),
679 MSM_RPM_MAP(PM8018_S5_0, PM8018_S5, 2),
680 MSM_RPM_MAP(PM8018_L1_0, PM8018_L1, 2),
681 MSM_RPM_MAP(PM8018_L2_0, PM8018_L2, 2),
682 MSM_RPM_MAP(PM8018_L3_0, PM8018_L3, 2),
683 MSM_RPM_MAP(PM8018_L4_0, PM8018_L4, 2),
684 MSM_RPM_MAP(PM8018_L5_0, PM8018_L5, 2),
685 MSM_RPM_MAP(PM8018_L6_0, PM8018_L6, 2),
686 MSM_RPM_MAP(PM8018_L7_0, PM8018_L7, 2),
687 MSM_RPM_MAP(PM8018_L8_0, PM8018_L8, 2),
688 MSM_RPM_MAP(PM8018_L9_0, PM8018_L9, 2),
689 MSM_RPM_MAP(PM8018_L10_0, PM8018_L10, 2),
690 MSM_RPM_MAP(PM8018_L11_0, PM8018_L11, 2),
691 MSM_RPM_MAP(PM8018_L12_0, PM8018_L12, 2),
692 MSM_RPM_MAP(PM8018_L13_0, PM8018_L13, 2),
693 MSM_RPM_MAP(PM8018_L14_0, PM8018_L14, 2),
694 MSM_RPM_MAP(PM8018_LVS1, PM8018_LVS1, 1),
695 MSM_RPM_MAP(NCP_0, NCP, 2),
696 MSM_RPM_MAP(CXO_BUFFERS, CXO_BUFFERS, 1),
697 MSM_RPM_MAP(USB_OTG_SWITCH, USB_OTG_SWITCH, 1),
698 MSM_RPM_MAP(HDMI_SWITCH, HDMI_SWITCH, 1),
699};
700unsigned int rpm_map_data_size = ARRAY_SIZE(rpm_map_data);
701
702static struct msm_rpm_platform_data msm_rpm_data = {
703 .reg_base_addrs = {
704 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
705 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
706 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
707 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
708 },
709
710 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
711 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
712 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
713 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
714 .msm_apps_ipc_rpm_val = 4,
715};
716
717struct platform_device msm_rpm_device = {
718 .name = "msm_rpm",
719 .id = -1,
720};
721
722static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] = {
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -0600723 [4] = MSM_GPIO_TO_INT(30),
724 [5] = MSM_GPIO_TO_INT(59),
725 [6] = MSM_GPIO_TO_INT(81),
726 [7] = MSM_GPIO_TO_INT(87),
727 [8] = MSM_GPIO_TO_INT(86),
728 [9] = MSM_GPIO_TO_INT(2),
729 [10] = MSM_GPIO_TO_INT(6),
730 [11] = MSM_GPIO_TO_INT(10),
731 [12] = MSM_GPIO_TO_INT(14),
732 [13] = MSM_GPIO_TO_INT(18),
733 [14] = MSM_GPIO_TO_INT(7),
734 [15] = MSM_GPIO_TO_INT(11),
735 [16] = MSM_GPIO_TO_INT(15),
736 [19] = MSM_GPIO_TO_INT(26),
737 [20] = MSM_GPIO_TO_INT(28),
738 [23] = MSM_GPIO_TO_INT(19),
739 [24] = MSM_GPIO_TO_INT(23),
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600740 [25] = USB1_HS_IRQ,
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -0600741 [26] = MSM_GPIO_TO_INT(3),
742 [27] = MSM_GPIO_TO_INT(68),
743 [29] = MSM_GPIO_TO_INT(78),
744 [31] = MSM_GPIO_TO_INT(0),
745 [32] = MSM_GPIO_TO_INT(4),
746 [33] = MSM_GPIO_TO_INT(22),
747 [34] = MSM_GPIO_TO_INT(17),
748 [37] = MSM_GPIO_TO_INT(20),
749 [39] = MSM_GPIO_TO_INT(84),
750 [42] = MSM_GPIO_TO_INT(24),
751 [43] = MSM_GPIO_TO_INT(79),
752 [44] = MSM_GPIO_TO_INT(80),
753 [45] = MSM_GPIO_TO_INT(82),
754 [46] = MSM_GPIO_TO_INT(85),
755 [47] = MSM_GPIO_TO_INT(45),
756 [48] = MSM_GPIO_TO_INT(50),
757 [49] = MSM_GPIO_TO_INT(51),
758 [50] = MSM_GPIO_TO_INT(69),
759 [51] = MSM_GPIO_TO_INT(77),
760 [52] = MSM_GPIO_TO_INT(1),
761 [53] = MSM_GPIO_TO_INT(5),
762 [54] = MSM_GPIO_TO_INT(40),
763 [55] = MSM_GPIO_TO_INT(27),
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600764};
765
766static uint16_t msm_mpm_bypassed_apps_irqs[] = {
767 TLMM_MSM_SUMMARY_IRQ,
768 RPM_APCC_CPU0_GP_HIGH_IRQ,
769 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
770 RPM_APCC_CPU0_GP_LOW_IRQ,
771 RPM_APCC_CPU0_WAKE_UP_IRQ,
Mahesh Sivasubramaniandbf2bb62011-12-12 16:03:40 -0700772 MSS_TO_APPS_IRQ_0,
773 MSS_TO_APPS_IRQ_1,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600774 LPASS_SCSS_GP_LOW_IRQ,
775 LPASS_SCSS_GP_MEDIUM_IRQ,
776 LPASS_SCSS_GP_HIGH_IRQ,
777 SPS_MTI_31,
Mahesh Sivasubramaniandbf2bb62011-12-12 16:03:40 -0700778 A2_BAM_IRQ,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600779};
780
781struct msm_mpm_device_data msm_mpm_dev_data = {
782 .irqs_m2a = msm_mpm_irqs_m2a,
783 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
784 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
785 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
786 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
787 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
788 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
789 .mpm_apps_ipc_val = BIT(1),
790 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600791};
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600792
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600793static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600794 0x00, 0x03, 0x00, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600795};
796
797static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600798 0x34, 0x24, 0x14, 0x04,
799 0x54, 0x03, 0x54, 0x04,
800 0x14, 0x24, 0x3e, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600801};
802
803static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600804 0x34, 0x24, 0x14, 0x04,
805 0x54, 0x07, 0x54, 0x04,
806 0x14, 0x24, 0x3e, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600807};
808
809static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
810 [0] = {
811 .mode = MSM_SPM_MODE_CLOCK_GATING,
812 .notify_rpm = false,
813 .cmd = spm_wfi_cmd_sequence,
814 },
815 [1] = {
816 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
817 .notify_rpm = false,
818 .cmd = spm_power_collapse_without_rpm,
819 },
820 [2] = {
821 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
822 .notify_rpm = true,
823 .cmd = spm_power_collapse_with_rpm,
824 },
825};
826
827static struct msm_spm_platform_data msm_spm_data[] __initdata = {
828 [0] = {
829 .reg_base_addr = MSM_SAW0_BASE,
830 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600831 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1001,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600832 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
833 .modes = msm_spm_seq_list,
834 },
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600835};
836
837static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
838 {
839 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
840 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
841 true,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -0600842 100, 8000, 100000, 1,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600843 },
844
845 {
846 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
847 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
848 true,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -0600849 2000, 5000, 60100000, 3000,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600850 },
851 {
852 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
853 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
854 false,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -0600855 6300, 5000, 60350000, 3500,
856 },
857 {
858 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
859 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
860 false,
861 13300, 2000, 71850000, 6800,
862 },
863 {
864 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
865 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
866 false,
867 28300, 0, 76350000, 9800,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600868 },
869};
870
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700871void __init msm9615_device_init(void)
872{
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600873 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600874 BUG_ON(msm_rpm_init(&msm_rpm_data));
875 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
876 ARRAY_SIZE(msm_rpmrs_levels)));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700877}
878
Jeff Hugo56b933a2011-09-28 14:42:05 -0600879#define MSM_SHARED_RAM_PHYS 0x40000000
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700880void __init msm9615_map_io(void)
881{
Jeff Hugo56b933a2011-09-28 14:42:05 -0600882 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700883 msm_map_msm9615_io();
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700884 l2x0_cache_init();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700885 if (socinfo_init() < 0)
886 pr_err("socinfo_init() failed!\n");
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700887}
888
889void __init msm9615_init_irq(void)
890{
Rohit Vaswanib2e42e12011-10-07 21:25:53 -0700891 msm_mpm_irq_extn_init();
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700892 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
893 (void *)MSM_QGIC_CPU_BASE);
894
895 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
896 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
897
898 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
899 mb();
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700900}
Gagan Mac7a827642011-09-22 19:42:21 -0600901
902struct platform_device msm_bus_9615_sys_fabric = {
903 .name = "msm_bus_fabric",
904 .id = MSM_BUS_FAB_SYSTEM,
905};
906
907struct platform_device msm_bus_def_fab = {
908 .name = "msm_bus_fabric",
909 .id = MSM_BUS_FAB_DEFAULT,
910};