blob: 314d0645621a74ab25407ed70982b8b817688b2b [file] [log] [blame]
Ofir Cohen06789f12012-01-16 09:43:13 +02001/* Copyright (c) 2011-2012, Code Aurora Forum. All rights reserved.
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07002 *
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
Ofir Cohen06789f12012-01-16 09:43:13 +0200173static struct resource resources_hsic_peripheral[] = {
174 {
175 .start = MSM9615_HSIC_PHYS,
176 .end = MSM9615_HSIC_PHYS + MSM9615_HSIC_SIZE - 1,
177 .flags = IORESOURCE_MEM,
178 },
179 {
180 .start = USB_HSIC_IRQ,
181 .end = USB_HSIC_IRQ,
182 .flags = IORESOURCE_IRQ,
183 },
184};
185
186struct platform_device msm_device_hsic_peripheral = {
187 .name = "msm_hsic_peripheral",
188 .id = -1,
189 .num_resources = ARRAY_SIZE(resources_hsic_peripheral),
190 .resource = resources_hsic_peripheral,
191 .dev = {
192 .coherent_dma_mask = DMA_BIT_MASK(32),
193 },
194};
195
Amit Blay6a8d4f32011-11-21 10:36:25 +0200196static struct resource resources_hsusb_host[] = {
197 {
198 .start = MSM9615_HSUSB_PHYS,
199 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_PHYS - 1,
200 .flags = IORESOURCE_MEM,
201 },
202 {
203 .start = USB1_HS_IRQ,
204 .end = USB1_HS_IRQ,
205 .flags = IORESOURCE_IRQ,
206 },
207};
208
209static u64 dma_mask = DMA_BIT_MASK(32);
210struct platform_device msm_device_hsusb_host = {
211 .name = "msm_hsusb_host",
212 .id = -1,
213 .num_resources = ARRAY_SIZE(resources_hsusb_host),
214 .resource = resources_hsusb_host,
215 .dev = {
216 .dma_mask = &dma_mask,
217 .coherent_dma_mask = 0xffffffff,
218 },
219};
220
Rohit Vaswani09666872011-08-23 17:41:54 -0700221static struct resource resources_uart_gsbi4[] = {
222 {
223 .start = GSBI4_UARTDM_IRQ,
224 .end = GSBI4_UARTDM_IRQ,
225 .flags = IORESOURCE_IRQ,
226 },
227 {
228 .start = MSM_UART4DM_PHYS,
229 .end = MSM_UART4DM_PHYS + PAGE_SIZE - 1,
230 .name = "uartdm_resource",
231 .flags = IORESOURCE_MEM,
232 },
233 {
234 .start = MSM_GSBI4_PHYS,
235 .end = MSM_GSBI4_PHYS + PAGE_SIZE - 1,
236 .name = "gsbi_resource",
237 .flags = IORESOURCE_MEM,
238 },
239};
240
241struct platform_device msm9615_device_uart_gsbi4 = {
242 .name = "msm_serial_hsl",
243 .id = 0,
244 .num_resources = ARRAY_SIZE(resources_uart_gsbi4),
245 .resource = resources_uart_gsbi4,
246};
247
Harini Jayaramaneba52672011-09-08 15:13:00 -0600248static struct resource resources_qup_i2c_gsbi5[] = {
249 {
250 .name = "gsbi_qup_i2c_addr",
251 .start = MSM_GSBI5_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600252 .end = MSM_GSBI5_PHYS + 4 - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600253 .flags = IORESOURCE_MEM,
254 },
255 {
256 .name = "qup_phys_addr",
257 .start = MSM_GSBI5_QUP_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600258 .end = MSM_GSBI5_QUP_PHYS + MSM_QUP_SIZE - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600259 .flags = IORESOURCE_MEM,
260 },
261 {
262 .name = "qup_err_intr",
263 .start = GSBI5_QUP_IRQ,
264 .end = GSBI5_QUP_IRQ,
265 .flags = IORESOURCE_IRQ,
266 },
267};
268
269struct platform_device msm9615_device_qup_i2c_gsbi5 = {
270 .name = "qup_i2c",
271 .id = 0,
272 .num_resources = ARRAY_SIZE(resources_qup_i2c_gsbi5),
273 .resource = resources_qup_i2c_gsbi5,
274};
275
Harini Jayaraman738c9312011-09-08 15:22:38 -0600276static struct resource resources_qup_spi_gsbi3[] = {
277 {
278 .name = "spi_base",
279 .start = MSM_GSBI3_QUP_PHYS,
280 .end = MSM_GSBI3_QUP_PHYS + SZ_4K - 1,
281 .flags = IORESOURCE_MEM,
282 },
283 {
284 .name = "gsbi_base",
285 .start = MSM_GSBI3_PHYS,
286 .end = MSM_GSBI3_PHYS + 4 - 1,
287 .flags = IORESOURCE_MEM,
288 },
289 {
290 .name = "spi_irq_in",
291 .start = GSBI3_QUP_IRQ,
292 .end = GSBI3_QUP_IRQ,
293 .flags = IORESOURCE_IRQ,
294 },
295};
296
297struct platform_device msm9615_device_qup_spi_gsbi3 = {
298 .name = "spi_qsd",
299 .id = 0,
300 .num_resources = ARRAY_SIZE(resources_qup_spi_gsbi3),
301 .resource = resources_qup_spi_gsbi3,
302};
303
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700304#define LPASS_SLIMBUS_PHYS 0x28080000
305#define LPASS_SLIMBUS_BAM_PHYS 0x28084000
306#define LPASS_SLIMBUS_SLEW (MSM9615_TLMM_PHYS + 0x207C)
307/* Board info for the slimbus slave device */
308static struct resource slimbus_res[] = {
309 {
310 .start = LPASS_SLIMBUS_PHYS,
311 .end = LPASS_SLIMBUS_PHYS + 8191,
312 .flags = IORESOURCE_MEM,
313 .name = "slimbus_physical",
314 },
315 {
316 .start = LPASS_SLIMBUS_BAM_PHYS,
317 .end = LPASS_SLIMBUS_BAM_PHYS + 8191,
318 .flags = IORESOURCE_MEM,
319 .name = "slimbus_bam_physical",
320 },
321 {
322 .start = LPASS_SLIMBUS_SLEW,
323 .end = LPASS_SLIMBUS_SLEW + 4 - 1,
324 .flags = IORESOURCE_MEM,
325 .name = "slimbus_slew_reg",
326 },
327 {
328 .start = SLIMBUS0_CORE_EE1_IRQ,
329 .end = SLIMBUS0_CORE_EE1_IRQ,
330 .flags = IORESOURCE_IRQ,
331 .name = "slimbus_irq",
332 },
333 {
334 .start = SLIMBUS0_BAM_EE1_IRQ,
335 .end = SLIMBUS0_BAM_EE1_IRQ,
336 .flags = IORESOURCE_IRQ,
337 .name = "slimbus_bam_irq",
338 },
339};
340
341struct platform_device msm9615_slim_ctrl = {
342 .name = "msm_slim_ctrl",
343 .id = 1,
344 .num_resources = ARRAY_SIZE(slimbus_res),
345 .resource = slimbus_res,
346 .dev = {
347 .coherent_dma_mask = 0xffffffffULL,
348 },
349};
350
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700351static struct resource resources_ssbi_pmic1[] = {
352 {
353 .start = MSM_PMIC1_SSBI_CMD_PHYS,
354 .end = MSM_PMIC1_SSBI_CMD_PHYS + MSM_PMIC_SSBI_SIZE - 1,
355 .flags = IORESOURCE_MEM,
356 },
357};
358
359struct platform_device msm9615_device_ssbi_pmic1 = {
360 .name = "msm_ssbi",
361 .id = 0,
362 .resource = resources_ssbi_pmic1,
363 .num_resources = ARRAY_SIZE(resources_ssbi_pmic1),
364};
365
Yan He092b7272011-09-21 15:25:03 -0700366static struct resource resources_sps[] = {
367 {
368 .name = "pipe_mem",
369 .start = 0x12800000,
370 .end = 0x12800000 + 0x4000 - 1,
371 .flags = IORESOURCE_MEM,
372 },
373 {
374 .name = "bamdma_dma",
375 .start = 0x12240000,
376 .end = 0x12240000 + 0x1000 - 1,
377 .flags = IORESOURCE_MEM,
378 },
379 {
380 .name = "bamdma_bam",
381 .start = 0x12244000,
382 .end = 0x12244000 + 0x4000 - 1,
383 .flags = IORESOURCE_MEM,
384 },
385 {
386 .name = "bamdma_irq",
387 .start = SPS_BAM_DMA_IRQ,
388 .end = SPS_BAM_DMA_IRQ,
389 .flags = IORESOURCE_IRQ,
390 },
391};
392
393struct msm_sps_platform_data msm_sps_pdata = {
394 .bamdma_restricted_pipes = 0x06,
395};
396
397struct platform_device msm_device_sps = {
398 .name = "msm_sps",
399 .id = -1,
400 .num_resources = ARRAY_SIZE(resources_sps),
401 .resource = resources_sps,
402 .dev.platform_data = &msm_sps_pdata,
403};
404
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700405static struct tsens_platform_data msm_tsens_pdata = {
406 .slope = 910,
407 .tsens_factor = 1000,
408 .hw_type = MSM_9615,
409 .tsens_num_sensor = 5,
410};
411
Sahitya Tummala38295432011-09-29 10:08:45 +0530412struct platform_device msm9615_device_tsens = {
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700413 .name = "tsens8960-tm",
414 .id = -1,
Sahitya Tummala38295432011-09-29 10:08:45 +0530415 .dev = {
416 .platform_data = &msm_tsens_pdata,
417 },
418};
419
420#define MSM_NAND_PHYS 0x1B400000
421static struct resource resources_nand[] = {
422 [0] = {
423 .name = "msm_nand_dmac",
424 .start = DMOV_NAND_CHAN,
425 .end = DMOV_NAND_CHAN,
426 .flags = IORESOURCE_DMA,
427 },
428 [1] = {
429 .name = "msm_nand_phys",
430 .start = MSM_NAND_PHYS,
431 .end = MSM_NAND_PHYS + 0x7FF,
432 .flags = IORESOURCE_MEM,
433 },
434};
435
436struct flash_platform_data msm_nand_data = {
437 .parts = NULL,
438 .nr_parts = 0,
439};
440
441struct platform_device msm_device_nand = {
442 .name = "msm_nand",
443 .id = -1,
444 .num_resources = ARRAY_SIZE(resources_nand),
445 .resource = resources_nand,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700446 .dev = {
Sahitya Tummala38295432011-09-29 10:08:45 +0530447 .platform_data = &msm_nand_data,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700448 },
449};
450
Jeff Hugo56b933a2011-09-28 14:42:05 -0600451struct platform_device msm_device_smd = {
452 .name = "msm_smd",
453 .id = -1,
454};
455
Eric Holmberg0c96e702011-11-08 18:04:31 -0700456struct platform_device msm_device_bam_dmux = {
457 .name = "BAM_RMNT",
458 .id = -1,
459};
460
Ramesh Masavarapu5ad37392011-10-10 10:44:10 -0700461#ifdef CONFIG_HW_RANDOM_MSM
462/* PRNG device */
463#define MSM_PRNG_PHYS 0x1A500000
464static struct resource rng_resources = {
465 .flags = IORESOURCE_MEM,
466 .start = MSM_PRNG_PHYS,
467 .end = MSM_PRNG_PHYS + SZ_512 - 1,
468};
469
470struct platform_device msm_device_rng = {
471 .name = "msm_rng",
472 .id = 0,
473 .num_resources = 1,
474 .resource = &rng_resources,
475};
476#endif
Krishna Kondadd794462011-10-01 00:19:29 -0700477
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700478#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
479 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
480 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
481 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
482
483#define QCE_SIZE 0x10000
484#define QCE_0_BASE 0x18500000
485
486#define QCE_HW_KEY_SUPPORT 0
487#define QCE_SHA_HMAC_SUPPORT 1
488#define QCE_SHARE_CE_RESOURCE 1
489#define QCE_CE_SHARED 0
490
491static struct resource qcrypto_resources[] = {
492 [0] = {
493 .start = QCE_0_BASE,
494 .end = QCE_0_BASE + QCE_SIZE - 1,
495 .flags = IORESOURCE_MEM,
496 },
497 [1] = {
498 .name = "crypto_channels",
499 .start = DMOV_CE_IN_CHAN,
500 .end = DMOV_CE_OUT_CHAN,
501 .flags = IORESOURCE_DMA,
502 },
503 [2] = {
504 .name = "crypto_crci_in",
505 .start = DMOV_CE_IN_CRCI,
506 .end = DMOV_CE_IN_CRCI,
507 .flags = IORESOURCE_DMA,
508 },
509 [3] = {
510 .name = "crypto_crci_out",
511 .start = DMOV_CE_OUT_CRCI,
512 .end = DMOV_CE_OUT_CRCI,
513 .flags = IORESOURCE_DMA,
514 },
515};
516
517static struct resource qcedev_resources[] = {
518 [0] = {
519 .start = QCE_0_BASE,
520 .end = QCE_0_BASE + QCE_SIZE - 1,
521 .flags = IORESOURCE_MEM,
522 },
523 [1] = {
524 .name = "crypto_channels",
525 .start = DMOV_CE_IN_CHAN,
526 .end = DMOV_CE_OUT_CHAN,
527 .flags = IORESOURCE_DMA,
528 },
529 [2] = {
530 .name = "crypto_crci_in",
531 .start = DMOV_CE_IN_CRCI,
532 .end = DMOV_CE_IN_CRCI,
533 .flags = IORESOURCE_DMA,
534 },
535 [3] = {
536 .name = "crypto_crci_out",
537 .start = DMOV_CE_OUT_CRCI,
538 .end = DMOV_CE_OUT_CRCI,
539 .flags = IORESOURCE_DMA,
540 },
541};
542
543#endif
544
545#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
546 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
547
548static struct msm_ce_hw_support qcrypto_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_qcrypto_device = {
557 .name = "qcrypto",
558 .id = 0,
559 .num_resources = ARRAY_SIZE(qcrypto_resources),
560 .resource = qcrypto_resources,
561 .dev = {
562 .coherent_dma_mask = DMA_BIT_MASK(32),
563 .platform_data = &qcrypto_ce_hw_suppport,
564 },
565};
566#endif
567
568#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
569 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
570
571static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
572 .ce_shared = QCE_CE_SHARED,
573 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
574 .hw_key_support = QCE_HW_KEY_SUPPORT,
575 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800576 .bus_scale_table = NULL,
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700577};
578
579struct platform_device msm9615_qcedev_device = {
580 .name = "qce",
581 .id = 0,
582 .num_resources = ARRAY_SIZE(qcedev_resources),
583 .resource = qcedev_resources,
584 .dev = {
585 .coherent_dma_mask = DMA_BIT_MASK(32),
586 .platform_data = &qcedev_ce_hw_suppport,
587 },
588};
589#endif
590
Krishna Kondadd794462011-10-01 00:19:29 -0700591#define MSM_SDC1_BASE 0x12180000
592#define MSM_SDC1_DML_BASE (MSM_SDC1_BASE + 0x800)
593#define MSM_SDC1_BAM_BASE (MSM_SDC1_BASE + 0x2000)
Krishna Konda71aef182011-10-01 02:27:51 -0700594#define MSM_SDC2_BASE 0x12140000
595#define MSM_SDC2_DML_BASE (MSM_SDC2_BASE + 0x800)
596#define MSM_SDC2_BAM_BASE (MSM_SDC2_BASE + 0x2000)
Krishna Kondadd794462011-10-01 00:19:29 -0700597
598static struct resource resources_sdc1[] = {
599 {
600 .name = "core_mem",
601 .flags = IORESOURCE_MEM,
602 .start = MSM_SDC1_BASE,
603 .end = MSM_SDC1_DML_BASE - 1,
604 },
605 {
606 .name = "core_irq",
607 .flags = IORESOURCE_IRQ,
608 .start = SDC1_IRQ_0,
609 .end = SDC1_IRQ_0
610 },
611#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
612 {
613 .name = "sdcc_dml_addr",
614 .start = MSM_SDC1_DML_BASE,
615 .end = MSM_SDC1_BAM_BASE - 1,
616 .flags = IORESOURCE_MEM,
617 },
618 {
619 .name = "sdcc_bam_addr",
620 .start = MSM_SDC1_BAM_BASE,
621 .end = MSM_SDC1_BAM_BASE + (2 * SZ_4K) - 1,
622 .flags = IORESOURCE_MEM,
623 },
624 {
625 .name = "sdcc_bam_irq",
626 .start = SDC1_BAM_IRQ,
627 .end = SDC1_BAM_IRQ,
628 .flags = IORESOURCE_IRQ,
629 },
630#endif
631};
632
Krishna Konda71aef182011-10-01 02:27:51 -0700633static struct resource resources_sdc2[] = {
634 {
635 .name = "core_mem",
636 .flags = IORESOURCE_MEM,
637 .start = MSM_SDC2_BASE,
638 .end = MSM_SDC2_DML_BASE - 1,
639 },
640 {
641 .name = "core_irq",
642 .flags = IORESOURCE_IRQ,
643 .start = SDC2_IRQ_0,
644 .end = SDC2_IRQ_0
645 },
646#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
647 {
648 .name = "sdcc_dml_addr",
649 .start = MSM_SDC2_DML_BASE,
650 .end = MSM_SDC2_BAM_BASE - 1,
651 .flags = IORESOURCE_MEM,
652 },
653 {
654 .name = "sdcc_bam_addr",
655 .start = MSM_SDC2_BAM_BASE,
656 .end = MSM_SDC2_BAM_BASE + (2 * SZ_4K) - 1,
657 .flags = IORESOURCE_MEM,
658 },
659 {
660 .name = "sdcc_bam_irq",
661 .start = SDC2_BAM_IRQ,
662 .end = SDC2_BAM_IRQ,
663 .flags = IORESOURCE_IRQ,
664 },
665#endif
666};
667
Krishna Kondadd794462011-10-01 00:19:29 -0700668struct platform_device msm_device_sdc1 = {
669 .name = "msm_sdcc",
670 .id = 1,
671 .num_resources = ARRAY_SIZE(resources_sdc1),
672 .resource = resources_sdc1,
673 .dev = {
674 .coherent_dma_mask = 0xffffffff,
675 },
676};
677
Krishna Konda71aef182011-10-01 02:27:51 -0700678struct platform_device msm_device_sdc2 = {
679 .name = "msm_sdcc",
680 .id = 2,
681 .num_resources = ARRAY_SIZE(resources_sdc2),
682 .resource = resources_sdc2,
683 .dev = {
684 .coherent_dma_mask = 0xffffffff,
685 },
686};
687
Krishna Kondadd794462011-10-01 00:19:29 -0700688static struct platform_device *msm_sdcc_devices[] __initdata = {
689 &msm_device_sdc1,
Krishna Konda71aef182011-10-01 02:27:51 -0700690 &msm_device_sdc2,
Krishna Kondadd794462011-10-01 00:19:29 -0700691};
692
693int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
694{
695 struct platform_device *pdev;
696
697 if (controller < 1 || controller > 2)
698 return -EINVAL;
699
700 pdev = msm_sdcc_devices[controller - 1];
701 pdev->dev.platform_data = plat;
702 return platform_device_register(pdev);
703}
704
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700705#ifdef CONFIG_CACHE_L2X0
706static int __init l2x0_cache_init(void)
707{
708 int aux_ctrl = 0;
709
710 /* Way Size 010(0x2) 32KB */
711 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
712 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
713 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
714
715 /* L2 Latency setting required by hardware. Default is 0x20
716 which is no good.
717 */
718 writel_relaxed(0x220, MSM_L2CC_BASE + L2X0_DATA_LATENCY_CTRL);
719 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
720
721 return 0;
722}
723#else
724static int __init l2x0_cache_init(void){ return 0; }
725#endif
726
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600727struct msm_rpm_map_data rpm_map_data[] __initdata = {
728 MSM_RPM_MAP(TRIGGER_TIMED_TO, TRIGGER_TIMED, 1),
729 MSM_RPM_MAP(TRIGGER_TIMED_SCLK_COUNT, TRIGGER_TIMED, 1),
730
731 MSM_RPM_MAP(RPM_CTL, RPM_CTL, 1),
732
733 MSM_RPM_MAP(CXO_CLK, CXO_CLK, 1),
734 MSM_RPM_MAP(SYSTEM_FABRIC_CLK, SYSTEM_FABRIC_CLK, 1),
735 MSM_RPM_MAP(DAYTONA_FABRIC_CLK, DAYTONA_FABRIC_CLK, 1),
736 MSM_RPM_MAP(SFPB_CLK, SFPB_CLK, 1),
737 MSM_RPM_MAP(CFPB_CLK, CFPB_CLK, 1),
738 MSM_RPM_MAP(EBI1_CLK, EBI1_CLK, 1),
739
740 MSM_RPM_MAP(SYS_FABRIC_CFG_HALT_0, SYS_FABRIC_CFG_HALT, 2),
741 MSM_RPM_MAP(SYS_FABRIC_CFG_CLKMOD_0, SYS_FABRIC_CFG_CLKMOD, 3),
742 MSM_RPM_MAP(SYS_FABRIC_CFG_IOCTL, SYS_FABRIC_CFG_IOCTL, 1),
743 MSM_RPM_MAP(SYSTEM_FABRIC_ARB_0, SYSTEM_FABRIC_ARB, 27),
744
745 MSM_RPM_MAP(PM8018_S1_0, PM8018_S1, 2),
746 MSM_RPM_MAP(PM8018_S2_0, PM8018_S2, 2),
747 MSM_RPM_MAP(PM8018_S3_0, PM8018_S3, 2),
748 MSM_RPM_MAP(PM8018_S4_0, PM8018_S4, 2),
749 MSM_RPM_MAP(PM8018_S5_0, PM8018_S5, 2),
750 MSM_RPM_MAP(PM8018_L1_0, PM8018_L1, 2),
751 MSM_RPM_MAP(PM8018_L2_0, PM8018_L2, 2),
752 MSM_RPM_MAP(PM8018_L3_0, PM8018_L3, 2),
753 MSM_RPM_MAP(PM8018_L4_0, PM8018_L4, 2),
754 MSM_RPM_MAP(PM8018_L5_0, PM8018_L5, 2),
755 MSM_RPM_MAP(PM8018_L6_0, PM8018_L6, 2),
756 MSM_RPM_MAP(PM8018_L7_0, PM8018_L7, 2),
757 MSM_RPM_MAP(PM8018_L8_0, PM8018_L8, 2),
758 MSM_RPM_MAP(PM8018_L9_0, PM8018_L9, 2),
759 MSM_RPM_MAP(PM8018_L10_0, PM8018_L10, 2),
760 MSM_RPM_MAP(PM8018_L11_0, PM8018_L11, 2),
761 MSM_RPM_MAP(PM8018_L12_0, PM8018_L12, 2),
762 MSM_RPM_MAP(PM8018_L13_0, PM8018_L13, 2),
763 MSM_RPM_MAP(PM8018_L14_0, PM8018_L14, 2),
764 MSM_RPM_MAP(PM8018_LVS1, PM8018_LVS1, 1),
765 MSM_RPM_MAP(NCP_0, NCP, 2),
766 MSM_RPM_MAP(CXO_BUFFERS, CXO_BUFFERS, 1),
767 MSM_RPM_MAP(USB_OTG_SWITCH, USB_OTG_SWITCH, 1),
768 MSM_RPM_MAP(HDMI_SWITCH, HDMI_SWITCH, 1),
769};
770unsigned int rpm_map_data_size = ARRAY_SIZE(rpm_map_data);
771
772static struct msm_rpm_platform_data msm_rpm_data = {
773 .reg_base_addrs = {
774 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
775 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
776 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
777 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
778 },
779
780 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
781 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
782 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
783 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
784 .msm_apps_ipc_rpm_val = 4,
785};
786
787struct platform_device msm_rpm_device = {
788 .name = "msm_rpm",
789 .id = -1,
790};
791
792static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] = {
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -0600793 [4] = MSM_GPIO_TO_INT(30),
794 [5] = MSM_GPIO_TO_INT(59),
795 [6] = MSM_GPIO_TO_INT(81),
796 [7] = MSM_GPIO_TO_INT(87),
797 [8] = MSM_GPIO_TO_INT(86),
798 [9] = MSM_GPIO_TO_INT(2),
799 [10] = MSM_GPIO_TO_INT(6),
800 [11] = MSM_GPIO_TO_INT(10),
801 [12] = MSM_GPIO_TO_INT(14),
802 [13] = MSM_GPIO_TO_INT(18),
803 [14] = MSM_GPIO_TO_INT(7),
804 [15] = MSM_GPIO_TO_INT(11),
805 [16] = MSM_GPIO_TO_INT(15),
806 [19] = MSM_GPIO_TO_INT(26),
807 [20] = MSM_GPIO_TO_INT(28),
808 [23] = MSM_GPIO_TO_INT(19),
809 [24] = MSM_GPIO_TO_INT(23),
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -0600810 [26] = MSM_GPIO_TO_INT(3),
811 [27] = MSM_GPIO_TO_INT(68),
812 [29] = MSM_GPIO_TO_INT(78),
813 [31] = MSM_GPIO_TO_INT(0),
814 [32] = MSM_GPIO_TO_INT(4),
815 [33] = MSM_GPIO_TO_INT(22),
816 [34] = MSM_GPIO_TO_INT(17),
817 [37] = MSM_GPIO_TO_INT(20),
818 [39] = MSM_GPIO_TO_INT(84),
Mahesh Sivasubramanian4ce82182012-01-04 14:34:42 -0700819 [40] = USB1_HS_IRQ,
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -0600820 [42] = MSM_GPIO_TO_INT(24),
821 [43] = MSM_GPIO_TO_INT(79),
822 [44] = MSM_GPIO_TO_INT(80),
823 [45] = MSM_GPIO_TO_INT(82),
824 [46] = MSM_GPIO_TO_INT(85),
825 [47] = MSM_GPIO_TO_INT(45),
826 [48] = MSM_GPIO_TO_INT(50),
827 [49] = MSM_GPIO_TO_INT(51),
828 [50] = MSM_GPIO_TO_INT(69),
829 [51] = MSM_GPIO_TO_INT(77),
830 [52] = MSM_GPIO_TO_INT(1),
831 [53] = MSM_GPIO_TO_INT(5),
832 [54] = MSM_GPIO_TO_INT(40),
833 [55] = MSM_GPIO_TO_INT(27),
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600834};
835
836static uint16_t msm_mpm_bypassed_apps_irqs[] = {
837 TLMM_MSM_SUMMARY_IRQ,
838 RPM_APCC_CPU0_GP_HIGH_IRQ,
839 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
840 RPM_APCC_CPU0_GP_LOW_IRQ,
841 RPM_APCC_CPU0_WAKE_UP_IRQ,
Mahesh Sivasubramaniandbf2bb62011-12-12 16:03:40 -0700842 MSS_TO_APPS_IRQ_0,
843 MSS_TO_APPS_IRQ_1,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600844 LPASS_SCSS_GP_LOW_IRQ,
845 LPASS_SCSS_GP_MEDIUM_IRQ,
846 LPASS_SCSS_GP_HIGH_IRQ,
847 SPS_MTI_31,
Mahesh Sivasubramaniandbf2bb62011-12-12 16:03:40 -0700848 A2_BAM_IRQ,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600849};
850
851struct msm_mpm_device_data msm_mpm_dev_data = {
852 .irqs_m2a = msm_mpm_irqs_m2a,
853 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
854 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
855 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
856 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
857 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
858 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
859 .mpm_apps_ipc_val = BIT(1),
860 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600861};
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600862
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600863static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600864 0x00, 0x03, 0x00, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600865};
866
867static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600868 0x34, 0x24, 0x14, 0x04,
869 0x54, 0x03, 0x54, 0x04,
870 0x14, 0x24, 0x3e, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600871};
872
873static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600874 0x34, 0x24, 0x14, 0x04,
875 0x54, 0x07, 0x54, 0x04,
876 0x14, 0x24, 0x3e, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600877};
878
879static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
880 [0] = {
881 .mode = MSM_SPM_MODE_CLOCK_GATING,
882 .notify_rpm = false,
883 .cmd = spm_wfi_cmd_sequence,
884 },
885 [1] = {
886 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
887 .notify_rpm = false,
888 .cmd = spm_power_collapse_without_rpm,
889 },
890 [2] = {
891 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
892 .notify_rpm = true,
893 .cmd = spm_power_collapse_with_rpm,
894 },
895};
896
897static struct msm_spm_platform_data msm_spm_data[] __initdata = {
898 [0] = {
899 .reg_base_addr = MSM_SAW0_BASE,
900 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -0600901 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1001,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600902 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
903 .modes = msm_spm_seq_list,
904 },
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600905};
906
907static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
908 {
909 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
910 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
911 true,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -0600912 100, 8000, 100000, 1,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600913 },
914
915 {
916 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
917 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
918 true,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -0600919 2000, 5000, 60100000, 3000,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600920 },
921 {
922 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
923 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
924 false,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -0600925 6300, 5000, 60350000, 3500,
926 },
927 {
928 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
929 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
930 false,
931 13300, 2000, 71850000, 6800,
932 },
933 {
934 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
935 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
936 false,
937 28300, 0, 76350000, 9800,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600938 },
939};
940
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700941void __init msm9615_device_init(void)
942{
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600943 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600944 BUG_ON(msm_rpm_init(&msm_rpm_data));
945 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
946 ARRAY_SIZE(msm_rpmrs_levels)));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700947}
948
Jeff Hugo56b933a2011-09-28 14:42:05 -0600949#define MSM_SHARED_RAM_PHYS 0x40000000
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700950void __init msm9615_map_io(void)
951{
Jeff Hugo56b933a2011-09-28 14:42:05 -0600952 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700953 msm_map_msm9615_io();
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700954 l2x0_cache_init();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700955 if (socinfo_init() < 0)
956 pr_err("socinfo_init() failed!\n");
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700957}
958
959void __init msm9615_init_irq(void)
960{
Rohit Vaswanib2e42e12011-10-07 21:25:53 -0700961 msm_mpm_irq_extn_init();
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700962 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
963 (void *)MSM_QGIC_CPU_BASE);
964
965 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
966 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
967
968 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
969 mb();
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700970}
Gagan Mac7a827642011-09-22 19:42:21 -0600971
972struct platform_device msm_bus_9615_sys_fabric = {
973 .name = "msm_bus_fabric",
974 .id = MSM_BUS_FAB_SYSTEM,
975};
976
977struct platform_device msm_bus_def_fab = {
978 .name = "msm_bus_fabric",
979 .id = MSM_BUS_FAB_DEFAULT,
980};