blob: 0c46c9d358a0e091ddfa9eecb8349de8226fbdf8 [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"
Abhijeet Dharmapurikarefaca4f2011-12-27 16:24:07 -080036#include <mach/pm.h>
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -060037#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
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700281#define LPASS_SLIMBUS_PHYS 0x28080000
282#define LPASS_SLIMBUS_BAM_PHYS 0x28084000
283#define LPASS_SLIMBUS_SLEW (MSM9615_TLMM_PHYS + 0x207C)
284/* Board info for the slimbus slave device */
285static struct resource slimbus_res[] = {
286 {
287 .start = LPASS_SLIMBUS_PHYS,
288 .end = LPASS_SLIMBUS_PHYS + 8191,
289 .flags = IORESOURCE_MEM,
290 .name = "slimbus_physical",
291 },
292 {
293 .start = LPASS_SLIMBUS_BAM_PHYS,
294 .end = LPASS_SLIMBUS_BAM_PHYS + 8191,
295 .flags = IORESOURCE_MEM,
296 .name = "slimbus_bam_physical",
297 },
298 {
299 .start = LPASS_SLIMBUS_SLEW,
300 .end = LPASS_SLIMBUS_SLEW + 4 - 1,
301 .flags = IORESOURCE_MEM,
302 .name = "slimbus_slew_reg",
303 },
304 {
305 .start = SLIMBUS0_CORE_EE1_IRQ,
306 .end = SLIMBUS0_CORE_EE1_IRQ,
307 .flags = IORESOURCE_IRQ,
308 .name = "slimbus_irq",
309 },
310 {
311 .start = SLIMBUS0_BAM_EE1_IRQ,
312 .end = SLIMBUS0_BAM_EE1_IRQ,
313 .flags = IORESOURCE_IRQ,
314 .name = "slimbus_bam_irq",
315 },
316};
317
318struct platform_device msm9615_slim_ctrl = {
319 .name = "msm_slim_ctrl",
320 .id = 1,
321 .num_resources = ARRAY_SIZE(slimbus_res),
322 .resource = slimbus_res,
323 .dev = {
324 .coherent_dma_mask = 0xffffffffULL,
325 },
326};
327
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700328static struct resource resources_ssbi_pmic1[] = {
329 {
330 .start = MSM_PMIC1_SSBI_CMD_PHYS,
331 .end = MSM_PMIC1_SSBI_CMD_PHYS + MSM_PMIC_SSBI_SIZE - 1,
332 .flags = IORESOURCE_MEM,
333 },
334};
335
336struct platform_device msm9615_device_ssbi_pmic1 = {
337 .name = "msm_ssbi",
338 .id = 0,
339 .resource = resources_ssbi_pmic1,
340 .num_resources = ARRAY_SIZE(resources_ssbi_pmic1),
341};
342
Yan He092b7272011-09-21 15:25:03 -0700343static struct resource resources_sps[] = {
344 {
345 .name = "pipe_mem",
346 .start = 0x12800000,
347 .end = 0x12800000 + 0x4000 - 1,
348 .flags = IORESOURCE_MEM,
349 },
350 {
351 .name = "bamdma_dma",
352 .start = 0x12240000,
353 .end = 0x12240000 + 0x1000 - 1,
354 .flags = IORESOURCE_MEM,
355 },
356 {
357 .name = "bamdma_bam",
358 .start = 0x12244000,
359 .end = 0x12244000 + 0x4000 - 1,
360 .flags = IORESOURCE_MEM,
361 },
362 {
363 .name = "bamdma_irq",
364 .start = SPS_BAM_DMA_IRQ,
365 .end = SPS_BAM_DMA_IRQ,
366 .flags = IORESOURCE_IRQ,
367 },
368};
369
370struct msm_sps_platform_data msm_sps_pdata = {
371 .bamdma_restricted_pipes = 0x06,
372};
373
374struct platform_device msm_device_sps = {
375 .name = "msm_sps",
376 .id = -1,
377 .num_resources = ARRAY_SIZE(resources_sps),
378 .resource = resources_sps,
379 .dev.platform_data = &msm_sps_pdata,
380};
381
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700382static struct tsens_platform_data msm_tsens_pdata = {
383 .slope = 910,
384 .tsens_factor = 1000,
385 .hw_type = MSM_9615,
386 .tsens_num_sensor = 5,
387};
388
Sahitya Tummala38295432011-09-29 10:08:45 +0530389struct platform_device msm9615_device_tsens = {
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700390 .name = "tsens8960-tm",
391 .id = -1,
Sahitya Tummala38295432011-09-29 10:08:45 +0530392 .dev = {
393 .platform_data = &msm_tsens_pdata,
394 },
395};
396
397#define MSM_NAND_PHYS 0x1B400000
398static struct resource resources_nand[] = {
399 [0] = {
400 .name = "msm_nand_dmac",
401 .start = DMOV_NAND_CHAN,
402 .end = DMOV_NAND_CHAN,
403 .flags = IORESOURCE_DMA,
404 },
405 [1] = {
406 .name = "msm_nand_phys",
407 .start = MSM_NAND_PHYS,
408 .end = MSM_NAND_PHYS + 0x7FF,
409 .flags = IORESOURCE_MEM,
410 },
411};
412
413struct flash_platform_data msm_nand_data = {
414 .parts = NULL,
415 .nr_parts = 0,
416};
417
418struct platform_device msm_device_nand = {
419 .name = "msm_nand",
420 .id = -1,
421 .num_resources = ARRAY_SIZE(resources_nand),
422 .resource = resources_nand,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700423 .dev = {
Sahitya Tummala38295432011-09-29 10:08:45 +0530424 .platform_data = &msm_nand_data,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700425 },
426};
427
Jeff Hugo56b933a2011-09-28 14:42:05 -0600428struct platform_device msm_device_smd = {
429 .name = "msm_smd",
430 .id = -1,
431};
432
Eric Holmberg0c96e702011-11-08 18:04:31 -0700433struct platform_device msm_device_bam_dmux = {
434 .name = "BAM_RMNT",
435 .id = -1,
436};
437
Ramesh Masavarapu5ad37392011-10-10 10:44:10 -0700438#ifdef CONFIG_HW_RANDOM_MSM
439/* PRNG device */
440#define MSM_PRNG_PHYS 0x1A500000
441static struct resource rng_resources = {
442 .flags = IORESOURCE_MEM,
443 .start = MSM_PRNG_PHYS,
444 .end = MSM_PRNG_PHYS + SZ_512 - 1,
445};
446
447struct platform_device msm_device_rng = {
448 .name = "msm_rng",
449 .id = 0,
450 .num_resources = 1,
451 .resource = &rng_resources,
452};
453#endif
Krishna Kondadd794462011-10-01 00:19:29 -0700454
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700455#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
456 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
457 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
458 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
459
460#define QCE_SIZE 0x10000
461#define QCE_0_BASE 0x18500000
462
463#define QCE_HW_KEY_SUPPORT 0
464#define QCE_SHA_HMAC_SUPPORT 1
465#define QCE_SHARE_CE_RESOURCE 1
466#define QCE_CE_SHARED 0
467
468static struct resource qcrypto_resources[] = {
469 [0] = {
470 .start = QCE_0_BASE,
471 .end = QCE_0_BASE + QCE_SIZE - 1,
472 .flags = IORESOURCE_MEM,
473 },
474 [1] = {
475 .name = "crypto_channels",
476 .start = DMOV_CE_IN_CHAN,
477 .end = DMOV_CE_OUT_CHAN,
478 .flags = IORESOURCE_DMA,
479 },
480 [2] = {
481 .name = "crypto_crci_in",
482 .start = DMOV_CE_IN_CRCI,
483 .end = DMOV_CE_IN_CRCI,
484 .flags = IORESOURCE_DMA,
485 },
486 [3] = {
487 .name = "crypto_crci_out",
488 .start = DMOV_CE_OUT_CRCI,
489 .end = DMOV_CE_OUT_CRCI,
490 .flags = IORESOURCE_DMA,
491 },
492};
493
494static struct resource qcedev_resources[] = {
495 [0] = {
496 .start = QCE_0_BASE,
497 .end = QCE_0_BASE + QCE_SIZE - 1,
498 .flags = IORESOURCE_MEM,
499 },
500 [1] = {
501 .name = "crypto_channels",
502 .start = DMOV_CE_IN_CHAN,
503 .end = DMOV_CE_OUT_CHAN,
504 .flags = IORESOURCE_DMA,
505 },
506 [2] = {
507 .name = "crypto_crci_in",
508 .start = DMOV_CE_IN_CRCI,
509 .end = DMOV_CE_IN_CRCI,
510 .flags = IORESOURCE_DMA,
511 },
512 [3] = {
513 .name = "crypto_crci_out",
514 .start = DMOV_CE_OUT_CRCI,
515 .end = DMOV_CE_OUT_CRCI,
516 .flags = IORESOURCE_DMA,
517 },
518};
519
520#endif
521
522#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
523 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
524
525static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
526 .ce_shared = QCE_CE_SHARED,
527 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
528 .hw_key_support = QCE_HW_KEY_SUPPORT,
529 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800530 .bus_scale_table = NULL,
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700531};
532
533struct platform_device msm9615_qcrypto_device = {
534 .name = "qcrypto",
535 .id = 0,
536 .num_resources = ARRAY_SIZE(qcrypto_resources),
537 .resource = qcrypto_resources,
538 .dev = {
539 .coherent_dma_mask = DMA_BIT_MASK(32),
540 .platform_data = &qcrypto_ce_hw_suppport,
541 },
542};
543#endif
544
545#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
546 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
547
548static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
549 .ce_shared = QCE_CE_SHARED,
550 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
551 .hw_key_support = QCE_HW_KEY_SUPPORT,
552 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800553 .bus_scale_table = NULL,
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700554};
555
556struct platform_device msm9615_qcedev_device = {
557 .name = "qce",
558 .id = 0,
559 .num_resources = ARRAY_SIZE(qcedev_resources),
560 .resource = qcedev_resources,
561 .dev = {
562 .coherent_dma_mask = DMA_BIT_MASK(32),
563 .platform_data = &qcedev_ce_hw_suppport,
564 },
565};
566#endif
567
Krishna Kondadd794462011-10-01 00:19:29 -0700568#define MSM_SDC1_BASE 0x12180000
569#define MSM_SDC1_DML_BASE (MSM_SDC1_BASE + 0x800)
570#define MSM_SDC1_BAM_BASE (MSM_SDC1_BASE + 0x2000)
Krishna Konda71aef182011-10-01 02:27:51 -0700571#define MSM_SDC2_BASE 0x12140000
572#define MSM_SDC2_DML_BASE (MSM_SDC2_BASE + 0x800)
573#define MSM_SDC2_BAM_BASE (MSM_SDC2_BASE + 0x2000)
Krishna Kondadd794462011-10-01 00:19:29 -0700574
575static struct resource resources_sdc1[] = {
576 {
577 .name = "core_mem",
578 .flags = IORESOURCE_MEM,
579 .start = MSM_SDC1_BASE,
580 .end = MSM_SDC1_DML_BASE - 1,
581 },
582 {
583 .name = "core_irq",
584 .flags = IORESOURCE_IRQ,
585 .start = SDC1_IRQ_0,
586 .end = SDC1_IRQ_0
587 },
588#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
589 {
590 .name = "sdcc_dml_addr",
591 .start = MSM_SDC1_DML_BASE,
592 .end = MSM_SDC1_BAM_BASE - 1,
593 .flags = IORESOURCE_MEM,
594 },
595 {
596 .name = "sdcc_bam_addr",
597 .start = MSM_SDC1_BAM_BASE,
598 .end = MSM_SDC1_BAM_BASE + (2 * SZ_4K) - 1,
599 .flags = IORESOURCE_MEM,
600 },
601 {
602 .name = "sdcc_bam_irq",
603 .start = SDC1_BAM_IRQ,
604 .end = SDC1_BAM_IRQ,
605 .flags = IORESOURCE_IRQ,
606 },
607#endif
608};
609
Krishna Konda71aef182011-10-01 02:27:51 -0700610static struct resource resources_sdc2[] = {
611 {
612 .name = "core_mem",
613 .flags = IORESOURCE_MEM,
614 .start = MSM_SDC2_BASE,
615 .end = MSM_SDC2_DML_BASE - 1,
616 },
617 {
618 .name = "core_irq",
619 .flags = IORESOURCE_IRQ,
620 .start = SDC2_IRQ_0,
621 .end = SDC2_IRQ_0
622 },
623#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
624 {
625 .name = "sdcc_dml_addr",
626 .start = MSM_SDC2_DML_BASE,
627 .end = MSM_SDC2_BAM_BASE - 1,
628 .flags = IORESOURCE_MEM,
629 },
630 {
631 .name = "sdcc_bam_addr",
632 .start = MSM_SDC2_BAM_BASE,
633 .end = MSM_SDC2_BAM_BASE + (2 * SZ_4K) - 1,
634 .flags = IORESOURCE_MEM,
635 },
636 {
637 .name = "sdcc_bam_irq",
638 .start = SDC2_BAM_IRQ,
639 .end = SDC2_BAM_IRQ,
640 .flags = IORESOURCE_IRQ,
641 },
642#endif
643};
644
Krishna Kondadd794462011-10-01 00:19:29 -0700645struct platform_device msm_device_sdc1 = {
646 .name = "msm_sdcc",
647 .id = 1,
648 .num_resources = ARRAY_SIZE(resources_sdc1),
649 .resource = resources_sdc1,
650 .dev = {
651 .coherent_dma_mask = 0xffffffff,
652 },
653};
654
Krishna Konda71aef182011-10-01 02:27:51 -0700655struct platform_device msm_device_sdc2 = {
656 .name = "msm_sdcc",
657 .id = 2,
658 .num_resources = ARRAY_SIZE(resources_sdc2),
659 .resource = resources_sdc2,
660 .dev = {
661 .coherent_dma_mask = 0xffffffff,
662 },
663};
664
Krishna Kondadd794462011-10-01 00:19:29 -0700665static struct platform_device *msm_sdcc_devices[] __initdata = {
666 &msm_device_sdc1,
Krishna Konda71aef182011-10-01 02:27:51 -0700667 &msm_device_sdc2,
Krishna Kondadd794462011-10-01 00:19:29 -0700668};
669
670int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
671{
672 struct platform_device *pdev;
673
674 if (controller < 1 || controller > 2)
675 return -EINVAL;
676
677 pdev = msm_sdcc_devices[controller - 1];
678 pdev->dev.platform_data = plat;
679 return platform_device_register(pdev);
680}
681
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700682#ifdef CONFIG_CACHE_L2X0
683static int __init l2x0_cache_init(void)
684{
685 int aux_ctrl = 0;
686
687 /* Way Size 010(0x2) 32KB */
688 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
689 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
690 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
691
692 /* L2 Latency setting required by hardware. Default is 0x20
693 which is no good.
694 */
695 writel_relaxed(0x220, MSM_L2CC_BASE + L2X0_DATA_LATENCY_CTRL);
696 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
697
698 return 0;
699}
700#else
701static int __init l2x0_cache_init(void){ return 0; }
702#endif
703
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600704struct msm_rpm_map_data rpm_map_data[] __initdata = {
705 MSM_RPM_MAP(TRIGGER_TIMED_TO, TRIGGER_TIMED, 1),
706 MSM_RPM_MAP(TRIGGER_TIMED_SCLK_COUNT, TRIGGER_TIMED, 1),
707
708 MSM_RPM_MAP(RPM_CTL, RPM_CTL, 1),
709
710 MSM_RPM_MAP(CXO_CLK, CXO_CLK, 1),
711 MSM_RPM_MAP(SYSTEM_FABRIC_CLK, SYSTEM_FABRIC_CLK, 1),
712 MSM_RPM_MAP(DAYTONA_FABRIC_CLK, DAYTONA_FABRIC_CLK, 1),
713 MSM_RPM_MAP(SFPB_CLK, SFPB_CLK, 1),
714 MSM_RPM_MAP(CFPB_CLK, CFPB_CLK, 1),
715 MSM_RPM_MAP(EBI1_CLK, EBI1_CLK, 1),
716
717 MSM_RPM_MAP(SYS_FABRIC_CFG_HALT_0, SYS_FABRIC_CFG_HALT, 2),
718 MSM_RPM_MAP(SYS_FABRIC_CFG_CLKMOD_0, SYS_FABRIC_CFG_CLKMOD, 3),
719 MSM_RPM_MAP(SYS_FABRIC_CFG_IOCTL, SYS_FABRIC_CFG_IOCTL, 1),
720 MSM_RPM_MAP(SYSTEM_FABRIC_ARB_0, SYSTEM_FABRIC_ARB, 27),
721
722 MSM_RPM_MAP(PM8018_S1_0, PM8018_S1, 2),
723 MSM_RPM_MAP(PM8018_S2_0, PM8018_S2, 2),
724 MSM_RPM_MAP(PM8018_S3_0, PM8018_S3, 2),
725 MSM_RPM_MAP(PM8018_S4_0, PM8018_S4, 2),
726 MSM_RPM_MAP(PM8018_S5_0, PM8018_S5, 2),
727 MSM_RPM_MAP(PM8018_L1_0, PM8018_L1, 2),
728 MSM_RPM_MAP(PM8018_L2_0, PM8018_L2, 2),
729 MSM_RPM_MAP(PM8018_L3_0, PM8018_L3, 2),
730 MSM_RPM_MAP(PM8018_L4_0, PM8018_L4, 2),
731 MSM_RPM_MAP(PM8018_L5_0, PM8018_L5, 2),
732 MSM_RPM_MAP(PM8018_L6_0, PM8018_L6, 2),
733 MSM_RPM_MAP(PM8018_L7_0, PM8018_L7, 2),
734 MSM_RPM_MAP(PM8018_L8_0, PM8018_L8, 2),
735 MSM_RPM_MAP(PM8018_L9_0, PM8018_L9, 2),
736 MSM_RPM_MAP(PM8018_L10_0, PM8018_L10, 2),
737 MSM_RPM_MAP(PM8018_L11_0, PM8018_L11, 2),
738 MSM_RPM_MAP(PM8018_L12_0, PM8018_L12, 2),
739 MSM_RPM_MAP(PM8018_L13_0, PM8018_L13, 2),
740 MSM_RPM_MAP(PM8018_L14_0, PM8018_L14, 2),
741 MSM_RPM_MAP(PM8018_LVS1, PM8018_LVS1, 1),
742 MSM_RPM_MAP(NCP_0, NCP, 2),
743 MSM_RPM_MAP(CXO_BUFFERS, CXO_BUFFERS, 1),
744 MSM_RPM_MAP(USB_OTG_SWITCH, USB_OTG_SWITCH, 1),
745 MSM_RPM_MAP(HDMI_SWITCH, HDMI_SWITCH, 1),
746};
747unsigned int rpm_map_data_size = ARRAY_SIZE(rpm_map_data);
748
749static struct msm_rpm_platform_data msm_rpm_data = {
750 .reg_base_addrs = {
751 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
752 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
753 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
754 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
755 },
756
757 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
758 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
759 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
760 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
761 .msm_apps_ipc_rpm_val = 4,
762};
763
764struct platform_device msm_rpm_device = {
765 .name = "msm_rpm",
766 .id = -1,
767};
768
769static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] = {
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -0600770 [4] = MSM_GPIO_TO_INT(30),
771 [5] = MSM_GPIO_TO_INT(59),
772 [6] = MSM_GPIO_TO_INT(81),
773 [7] = MSM_GPIO_TO_INT(87),
774 [8] = MSM_GPIO_TO_INT(86),
775 [9] = MSM_GPIO_TO_INT(2),
776 [10] = MSM_GPIO_TO_INT(6),
777 [11] = MSM_GPIO_TO_INT(10),
778 [12] = MSM_GPIO_TO_INT(14),
779 [13] = MSM_GPIO_TO_INT(18),
780 [14] = MSM_GPIO_TO_INT(7),
781 [15] = MSM_GPIO_TO_INT(11),
782 [16] = MSM_GPIO_TO_INT(15),
783 [19] = MSM_GPIO_TO_INT(26),
784 [20] = MSM_GPIO_TO_INT(28),
785 [23] = MSM_GPIO_TO_INT(19),
786 [24] = MSM_GPIO_TO_INT(23),
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -0600787 [26] = MSM_GPIO_TO_INT(3),
788 [27] = MSM_GPIO_TO_INT(68),
789 [29] = MSM_GPIO_TO_INT(78),
790 [31] = MSM_GPIO_TO_INT(0),
791 [32] = MSM_GPIO_TO_INT(4),
792 [33] = MSM_GPIO_TO_INT(22),
793 [34] = MSM_GPIO_TO_INT(17),
794 [37] = MSM_GPIO_TO_INT(20),
795 [39] = MSM_GPIO_TO_INT(84),
Mahesh Sivasubramanian4ce82182012-01-04 14:34:42 -0700796 [40] = USB1_HS_IRQ,
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -0600797 [42] = MSM_GPIO_TO_INT(24),
798 [43] = MSM_GPIO_TO_INT(79),
799 [44] = MSM_GPIO_TO_INT(80),
800 [45] = MSM_GPIO_TO_INT(82),
801 [46] = MSM_GPIO_TO_INT(85),
802 [47] = MSM_GPIO_TO_INT(45),
803 [48] = MSM_GPIO_TO_INT(50),
804 [49] = MSM_GPIO_TO_INT(51),
805 [50] = MSM_GPIO_TO_INT(69),
806 [51] = MSM_GPIO_TO_INT(77),
807 [52] = MSM_GPIO_TO_INT(1),
808 [53] = MSM_GPIO_TO_INT(5),
809 [54] = MSM_GPIO_TO_INT(40),
810 [55] = MSM_GPIO_TO_INT(27),
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600811};
812
813static uint16_t msm_mpm_bypassed_apps_irqs[] = {
814 TLMM_MSM_SUMMARY_IRQ,
815 RPM_APCC_CPU0_GP_HIGH_IRQ,
816 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
817 RPM_APCC_CPU0_GP_LOW_IRQ,
818 RPM_APCC_CPU0_WAKE_UP_IRQ,
Mahesh Sivasubramaniandbf2bb62011-12-12 16:03:40 -0700819 MSS_TO_APPS_IRQ_0,
820 MSS_TO_APPS_IRQ_1,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600821 LPASS_SCSS_GP_LOW_IRQ,
822 LPASS_SCSS_GP_MEDIUM_IRQ,
823 LPASS_SCSS_GP_HIGH_IRQ,
824 SPS_MTI_31,
Mahesh Sivasubramaniandbf2bb62011-12-12 16:03:40 -0700825 A2_BAM_IRQ,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600826};
827
828struct msm_mpm_device_data msm_mpm_dev_data = {
829 .irqs_m2a = msm_mpm_irqs_m2a,
830 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
831 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
832 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
833 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
834 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
835 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
836 .mpm_apps_ipc_val = BIT(1),
837 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600838};
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600839
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600840static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600841 0x00, 0x03, 0x00, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600842};
843
844static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600845 0x34, 0x24, 0x14, 0x04,
846 0x54, 0x03, 0x54, 0x04,
847 0x14, 0x24, 0x3e, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600848};
849
850static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600851 0x34, 0x24, 0x14, 0x04,
852 0x54, 0x07, 0x54, 0x04,
853 0x14, 0x24, 0x3e, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600854};
855
856static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
857 [0] = {
858 .mode = MSM_SPM_MODE_CLOCK_GATING,
859 .notify_rpm = false,
860 .cmd = spm_wfi_cmd_sequence,
861 },
862 [1] = {
863 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
864 .notify_rpm = false,
865 .cmd = spm_power_collapse_without_rpm,
866 },
867 [2] = {
868 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
869 .notify_rpm = true,
870 .cmd = spm_power_collapse_with_rpm,
871 },
872};
873
874static struct msm_spm_platform_data msm_spm_data[] __initdata = {
875 [0] = {
876 .reg_base_addr = MSM_SAW0_BASE,
877 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600878 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1001,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600879 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
880 .modes = msm_spm_seq_list,
881 },
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600882};
883
884static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
885 {
886 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
887 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
888 true,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -0600889 100, 8000, 100000, 1,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600890 },
891
892 {
893 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
894 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
895 true,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -0600896 2000, 5000, 60100000, 3000,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600897 },
898 {
899 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
900 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
901 false,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -0600902 6300, 5000, 60350000, 3500,
903 },
904 {
905 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
906 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
907 false,
908 13300, 2000, 71850000, 6800,
909 },
910 {
911 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
912 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
913 false,
914 28300, 0, 76350000, 9800,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600915 },
916};
917
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700918void __init msm9615_device_init(void)
919{
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600920 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600921 BUG_ON(msm_rpm_init(&msm_rpm_data));
922 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
923 ARRAY_SIZE(msm_rpmrs_levels)));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700924}
925
Jeff Hugo56b933a2011-09-28 14:42:05 -0600926#define MSM_SHARED_RAM_PHYS 0x40000000
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700927void __init msm9615_map_io(void)
928{
Jeff Hugo56b933a2011-09-28 14:42:05 -0600929 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700930 msm_map_msm9615_io();
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700931 l2x0_cache_init();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700932 if (socinfo_init() < 0)
933 pr_err("socinfo_init() failed!\n");
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700934}
935
936void __init msm9615_init_irq(void)
937{
Rohit Vaswanib2e42e12011-10-07 21:25:53 -0700938 msm_mpm_irq_extn_init();
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700939 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
940 (void *)MSM_QGIC_CPU_BASE);
941
942 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
943 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
944
945 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
946 mb();
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700947}
Gagan Mac7a827642011-09-22 19:42:21 -0600948
949struct platform_device msm_bus_9615_sys_fabric = {
950 .name = "msm_bus_fabric",
951 .id = MSM_BUS_FAB_SYSTEM,
952};
953
954struct platform_device msm_bus_def_fab = {
955 .name = "msm_bus_fabric",
956 .id = MSM_BUS_FAB_DEFAULT,
957};