blob: 1acc833a30967fe4dc0ec38b2d475ef04ec0a134 [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>
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -070018#include <linux/platform_data/qcom_crypto_device.h>
Amit Blay5e4ec192011-10-20 09:16:54 +020019#include <linux/dma-mapping.h>
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -080020#include <sound/msm-dai-q6.h>
21#include <sound/apr_audio.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070022#include <asm/hardware/gic.h>
Sahitya Tummala38295432011-09-29 10:08:45 +053023#include <asm/mach/flash.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070024#include <mach/board.h>
25#include <mach/msm_iomap.h>
Amit Blay5e4ec192011-10-20 09:16:54 +020026#include <mach/msm_hsusb.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070027#include <mach/irqs.h>
28#include <mach/socinfo.h>
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -060029#include <mach/rpm.h>
Gagan Mac7a827642011-09-22 19:42:21 -060030#include <mach/msm_bus_board.h>
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -070031#include <asm/hardware/cache-l2x0.h>
Yan He092b7272011-09-21 15:25:03 -070032#include <mach/msm_sps.h>
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070033#include <mach/dma.h>
Matt Wagantall7cca4642012-02-01 16:43:24 -080034#include "pm.h"
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070035#include "devices.h"
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -060036#include "mpm.h"
37#include "spm.h"
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -060038#include "rpm_resources.h"
Jeff Ohlstein7e668552011-10-06 16:17:25 -070039#include "msm_watchdog.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060040#include "rpm_stats.h"
41#include "rpm_log.h"
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070042
Harini Jayaramaneba52672011-09-08 15:13:00 -060043/* Address of GSBI blocks */
44#define MSM_GSBI1_PHYS 0x16000000
45#define MSM_GSBI2_PHYS 0x16100000
46#define MSM_GSBI3_PHYS 0x16200000
Rohit Vaswani09666872011-08-23 17:41:54 -070047#define MSM_GSBI4_PHYS 0x16300000
Harini Jayaramaneba52672011-09-08 15:13:00 -060048#define MSM_GSBI5_PHYS 0x16400000
49
Rohit Vaswani09666872011-08-23 17:41:54 -070050#define MSM_UART4DM_PHYS (MSM_GSBI4_PHYS + 0x40000)
51
Harini Jayaramaneba52672011-09-08 15:13:00 -060052/* GSBI QUP devices */
53#define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000)
54#define MSM_GSBI2_QUP_PHYS (MSM_GSBI2_PHYS + 0x80000)
55#define MSM_GSBI3_QUP_PHYS (MSM_GSBI3_PHYS + 0x80000)
56#define MSM_GSBI4_QUP_PHYS (MSM_GSBI4_PHYS + 0x80000)
57#define MSM_GSBI5_QUP_PHYS (MSM_GSBI5_PHYS + 0x80000)
58#define MSM_QUP_SIZE SZ_4K
59
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070060/* Address of SSBI CMD */
61#define MSM_PMIC1_SSBI_CMD_PHYS 0x00500000
62#define MSM_PMIC_SSBI_SIZE SZ_4K
63
Jeff Ohlstein7e668552011-10-06 16:17:25 -070064static struct msm_watchdog_pdata msm_watchdog_pdata = {
65 .pet_time = 10000,
66 .bark_time = 11000,
67 .has_secure = true,
68};
69
70struct platform_device msm9615_device_watchdog = {
71 .name = "msm_watchdog",
72 .id = -1,
73 .dev = {
74 .platform_data = &msm_watchdog_pdata,
75 },
76};
77
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070078static struct resource msm_dmov_resource[] = {
79 {
80 .start = ADM_0_SCSS_1_IRQ,
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070081 .flags = IORESOURCE_IRQ,
82 },
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -070083 {
84 .start = 0x18320000,
85 .end = 0x18320000 + SZ_1M - 1,
86 .flags = IORESOURCE_MEM,
87 },
88};
89
90static struct msm_dmov_pdata msm_dmov_pdata = {
91 .sd = 1,
92 .sd_size = 0x800,
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070093};
94
95struct platform_device msm9615_device_dmov = {
96 .name = "msm_dmov",
97 .id = -1,
98 .resource = msm_dmov_resource,
99 .num_resources = ARRAY_SIZE(msm_dmov_resource),
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700100 .dev = {
101 .platform_data = &msm_dmov_pdata,
102 },
Jeff Ohlsteind19bf442011-09-09 12:48:18 -0700103};
104
Ofir Cohen40a4e862011-12-08 15:17:52 +0200105#define MSM_USB_BAM_BASE 0x12502000
Ofir Cohen010009b2012-01-26 16:49:17 +0200106#define MSM_USB_BAM_SIZE SZ_16K
107#define MSM_HSIC_BAM_BASE 0x12542000
108#define MSM_HSIC_BAM_SIZE SZ_16K
Ofir Cohen40a4e862011-12-08 15:17:52 +0200109
Amit Blay5e4ec192011-10-20 09:16:54 +0200110static struct resource resources_otg[] = {
111 {
112 .start = MSM9615_HSUSB_PHYS,
113 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_SIZE - 1,
114 .flags = IORESOURCE_MEM,
115 },
116 {
117 .start = USB1_HS_IRQ,
118 .end = USB1_HS_IRQ,
119 .flags = IORESOURCE_IRQ,
120 },
121};
122
123struct platform_device msm_device_otg = {
124 .name = "msm_otg",
125 .id = -1,
126 .num_resources = ARRAY_SIZE(resources_otg),
127 .resource = resources_otg,
128 .dev = {
129 .coherent_dma_mask = DMA_BIT_MASK(32),
130 },
131};
132
133static struct resource resources_hsusb[] = {
134 {
135 .start = MSM9615_HSUSB_PHYS,
136 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_SIZE - 1,
137 .flags = IORESOURCE_MEM,
138 },
139 {
140 .start = USB1_HS_IRQ,
141 .end = USB1_HS_IRQ,
142 .flags = IORESOURCE_IRQ,
143 },
144};
145
Ofir Cohen40a4e862011-12-08 15:17:52 +0200146static struct resource resources_usb_bam[] = {
147 {
148 .name = "usb_bam_addr",
149 .start = MSM_USB_BAM_BASE,
Ofir Cohen010009b2012-01-26 16:49:17 +0200150 .end = MSM_USB_BAM_BASE + MSM_USB_BAM_SIZE - 1,
Ofir Cohen40a4e862011-12-08 15:17:52 +0200151 .flags = IORESOURCE_MEM,
152 },
153 {
154 .name = "usb_bam_irq",
155 .start = USB1_HS_BAM_IRQ,
156 .end = USB1_HS_BAM_IRQ,
157 .flags = IORESOURCE_IRQ,
158 },
Ofir Cohen010009b2012-01-26 16:49:17 +0200159 {
160 .name = "hsic_bam_addr",
161 .start = MSM_HSIC_BAM_BASE,
162 .end = MSM_HSIC_BAM_BASE + MSM_HSIC_BAM_SIZE - 1,
163 .flags = IORESOURCE_MEM,
164 },
165 {
166 .name = "hsic_bam_irq",
167 .start = USB_HSIC_BAM_IRQ,
168 .end = USB_HSIC_BAM_IRQ,
169 .flags = IORESOURCE_IRQ,
170 },
Ofir Cohen40a4e862011-12-08 15:17:52 +0200171};
172
173struct platform_device msm_device_usb_bam = {
174 .name = "usb_bam",
175 .id = -1,
176 .num_resources = ARRAY_SIZE(resources_usb_bam),
177 .resource = resources_usb_bam,
178};
179
Amit Blay5e4ec192011-10-20 09:16:54 +0200180struct platform_device msm_device_gadget_peripheral = {
181 .name = "msm_hsusb",
182 .id = -1,
183 .num_resources = ARRAY_SIZE(resources_hsusb),
184 .resource = resources_hsusb,
185 .dev = {
186 .coherent_dma_mask = DMA_BIT_MASK(32),
187 },
188};
189
Ofir Cohen06789f12012-01-16 09:43:13 +0200190static struct resource resources_hsic_peripheral[] = {
191 {
192 .start = MSM9615_HSIC_PHYS,
193 .end = MSM9615_HSIC_PHYS + MSM9615_HSIC_SIZE - 1,
194 .flags = IORESOURCE_MEM,
195 },
196 {
197 .start = USB_HSIC_IRQ,
198 .end = USB_HSIC_IRQ,
199 .flags = IORESOURCE_IRQ,
200 },
201};
202
203struct platform_device msm_device_hsic_peripheral = {
204 .name = "msm_hsic_peripheral",
205 .id = -1,
206 .num_resources = ARRAY_SIZE(resources_hsic_peripheral),
207 .resource = resources_hsic_peripheral,
208 .dev = {
209 .coherent_dma_mask = DMA_BIT_MASK(32),
210 },
211};
212
Amit Blay6a8d4f32011-11-21 10:36:25 +0200213static struct resource resources_hsusb_host[] = {
214 {
215 .start = MSM9615_HSUSB_PHYS,
216 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_PHYS - 1,
217 .flags = IORESOURCE_MEM,
218 },
219 {
220 .start = USB1_HS_IRQ,
221 .end = USB1_HS_IRQ,
222 .flags = IORESOURCE_IRQ,
223 },
224};
225
226static u64 dma_mask = DMA_BIT_MASK(32);
227struct platform_device msm_device_hsusb_host = {
228 .name = "msm_hsusb_host",
229 .id = -1,
230 .num_resources = ARRAY_SIZE(resources_hsusb_host),
231 .resource = resources_hsusb_host,
232 .dev = {
233 .dma_mask = &dma_mask,
234 .coherent_dma_mask = 0xffffffff,
235 },
236};
237
Lena Salman65bcf372012-02-14 15:33:32 +0200238static struct resource resources_hsic_host[] = {
239 {
240 .start = MSM9615_HSIC_PHYS,
241 .end = MSM9615_HSIC_PHYS + MSM9615_HSIC_SIZE - 1,
242 .flags = IORESOURCE_MEM,
243 },
244 {
245 .start = USB_HSIC_IRQ,
246 .end = USB_HSIC_IRQ,
247 .flags = IORESOURCE_IRQ,
248 },
249};
250
251struct platform_device msm_device_hsic_host = {
252 .name = "msm_hsic_host",
253 .id = -1,
254 .num_resources = ARRAY_SIZE(resources_hsic_host),
255 .resource = resources_hsic_host,
256 .dev = {
257 .dma_mask = &dma_mask,
258 .coherent_dma_mask = 0xffffffff,
259 },
260};
261
Rohit Vaswani09666872011-08-23 17:41:54 -0700262static struct resource resources_uart_gsbi4[] = {
263 {
264 .start = GSBI4_UARTDM_IRQ,
265 .end = GSBI4_UARTDM_IRQ,
266 .flags = IORESOURCE_IRQ,
267 },
268 {
269 .start = MSM_UART4DM_PHYS,
270 .end = MSM_UART4DM_PHYS + PAGE_SIZE - 1,
271 .name = "uartdm_resource",
272 .flags = IORESOURCE_MEM,
273 },
274 {
275 .start = MSM_GSBI4_PHYS,
276 .end = MSM_GSBI4_PHYS + PAGE_SIZE - 1,
277 .name = "gsbi_resource",
278 .flags = IORESOURCE_MEM,
279 },
280};
281
282struct platform_device msm9615_device_uart_gsbi4 = {
283 .name = "msm_serial_hsl",
284 .id = 0,
285 .num_resources = ARRAY_SIZE(resources_uart_gsbi4),
286 .resource = resources_uart_gsbi4,
287};
288
Harini Jayaramaneba52672011-09-08 15:13:00 -0600289static struct resource resources_qup_i2c_gsbi5[] = {
290 {
291 .name = "gsbi_qup_i2c_addr",
292 .start = MSM_GSBI5_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600293 .end = MSM_GSBI5_PHYS + 4 - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600294 .flags = IORESOURCE_MEM,
295 },
296 {
297 .name = "qup_phys_addr",
298 .start = MSM_GSBI5_QUP_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600299 .end = MSM_GSBI5_QUP_PHYS + MSM_QUP_SIZE - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600300 .flags = IORESOURCE_MEM,
301 },
302 {
303 .name = "qup_err_intr",
304 .start = GSBI5_QUP_IRQ,
305 .end = GSBI5_QUP_IRQ,
306 .flags = IORESOURCE_IRQ,
307 },
308};
309
310struct platform_device msm9615_device_qup_i2c_gsbi5 = {
311 .name = "qup_i2c",
312 .id = 0,
313 .num_resources = ARRAY_SIZE(resources_qup_i2c_gsbi5),
314 .resource = resources_qup_i2c_gsbi5,
315};
316
Harini Jayaraman738c9312011-09-08 15:22:38 -0600317static struct resource resources_qup_spi_gsbi3[] = {
318 {
319 .name = "spi_base",
320 .start = MSM_GSBI3_QUP_PHYS,
321 .end = MSM_GSBI3_QUP_PHYS + SZ_4K - 1,
322 .flags = IORESOURCE_MEM,
323 },
324 {
325 .name = "gsbi_base",
326 .start = MSM_GSBI3_PHYS,
327 .end = MSM_GSBI3_PHYS + 4 - 1,
328 .flags = IORESOURCE_MEM,
329 },
330 {
331 .name = "spi_irq_in",
332 .start = GSBI3_QUP_IRQ,
333 .end = GSBI3_QUP_IRQ,
334 .flags = IORESOURCE_IRQ,
335 },
336};
337
338struct platform_device msm9615_device_qup_spi_gsbi3 = {
339 .name = "spi_qsd",
340 .id = 0,
341 .num_resources = ARRAY_SIZE(resources_qup_spi_gsbi3),
342 .resource = resources_qup_spi_gsbi3,
343};
344
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700345#define LPASS_SLIMBUS_PHYS 0x28080000
346#define LPASS_SLIMBUS_BAM_PHYS 0x28084000
347#define LPASS_SLIMBUS_SLEW (MSM9615_TLMM_PHYS + 0x207C)
348/* Board info for the slimbus slave device */
349static struct resource slimbus_res[] = {
350 {
351 .start = LPASS_SLIMBUS_PHYS,
352 .end = LPASS_SLIMBUS_PHYS + 8191,
353 .flags = IORESOURCE_MEM,
354 .name = "slimbus_physical",
355 },
356 {
357 .start = LPASS_SLIMBUS_BAM_PHYS,
358 .end = LPASS_SLIMBUS_BAM_PHYS + 8191,
359 .flags = IORESOURCE_MEM,
360 .name = "slimbus_bam_physical",
361 },
362 {
363 .start = LPASS_SLIMBUS_SLEW,
364 .end = LPASS_SLIMBUS_SLEW + 4 - 1,
365 .flags = IORESOURCE_MEM,
366 .name = "slimbus_slew_reg",
367 },
368 {
369 .start = SLIMBUS0_CORE_EE1_IRQ,
370 .end = SLIMBUS0_CORE_EE1_IRQ,
371 .flags = IORESOURCE_IRQ,
372 .name = "slimbus_irq",
373 },
374 {
375 .start = SLIMBUS0_BAM_EE1_IRQ,
376 .end = SLIMBUS0_BAM_EE1_IRQ,
377 .flags = IORESOURCE_IRQ,
378 .name = "slimbus_bam_irq",
379 },
380};
381
382struct platform_device msm9615_slim_ctrl = {
383 .name = "msm_slim_ctrl",
384 .id = 1,
385 .num_resources = ARRAY_SIZE(slimbus_res),
386 .resource = slimbus_res,
387 .dev = {
388 .coherent_dma_mask = 0xffffffffULL,
389 },
390};
391
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800392struct platform_device msm_pcm = {
393 .name = "msm-pcm-dsp",
394 .id = -1,
395};
396
397struct platform_device msm_multi_ch_pcm = {
398 .name = "msm-multi-ch-pcm-dsp",
399 .id = -1,
400};
401
402struct platform_device msm_pcm_routing = {
403 .name = "msm-pcm-routing",
404 .id = -1,
405};
406
407struct platform_device msm_cpudai0 = {
408 .name = "msm-dai-q6",
409 .id = 0x4000,
410};
411
412struct platform_device msm_cpudai1 = {
413 .name = "msm-dai-q6",
414 .id = 0x4001,
415};
416
417struct platform_device msm_cpudai_bt_rx = {
418 .name = "msm-dai-q6",
419 .id = 0x3000,
420};
421
422struct platform_device msm_cpudai_bt_tx = {
423 .name = "msm-dai-q6",
424 .id = 0x3001,
425};
426
427/*
428 * Machine specific data for AUX PCM Interface
429 * which the driver will be unware of.
430 */
Shiv Maliyappanahalli19e86e22012-03-28 17:27:26 -0700431struct msm_dai_auxpcm_pdata auxpcm_pdata = {
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800432 .clk = "pcm_clk",
433 .mode = AFE_PCM_CFG_MODE_PCM,
434 .sync = AFE_PCM_CFG_SYNC_INT,
435 .frame = AFE_PCM_CFG_FRM_256BPF,
436 .quant = AFE_PCM_CFG_QUANT_LINEAR_NOPAD,
437 .slot = 0,
438 .data = AFE_PCM_CFG_CDATAOE_MASTER,
439 .pcm_clk_rate = 2048000,
440};
441
442struct platform_device msm_cpudai_auxpcm_rx = {
443 .name = "msm-dai-q6",
444 .id = 2,
445 .dev = {
Shiv Maliyappanahalli19e86e22012-03-28 17:27:26 -0700446 .platform_data = &auxpcm_pdata,
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800447 },
448};
449
450struct platform_device msm_cpudai_auxpcm_tx = {
451 .name = "msm-dai-q6",
452 .id = 3,
Shiv Maliyappanahalli19e86e22012-03-28 17:27:26 -0700453 .dev = {
454 .platform_data = &auxpcm_pdata,
455 },
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800456};
457
458struct platform_device msm_cpu_fe = {
459 .name = "msm-dai-fe",
460 .id = -1,
461};
462
463struct platform_device msm_stub_codec = {
464 .name = "msm-stub-codec",
465 .id = 1,
466};
467
468struct platform_device msm_voice = {
469 .name = "msm-pcm-voice",
470 .id = -1,
471};
472
473struct platform_device msm_voip = {
474 .name = "msm-voip-dsp",
475 .id = -1,
476};
477
478struct platform_device msm_compr_dsp = {
479 .name = "msm-compr-dsp",
480 .id = -1,
481};
482
483struct platform_device msm_pcm_hostless = {
484 .name = "msm-pcm-hostless",
485 .id = -1,
486};
487
488struct platform_device msm_cpudai_afe_01_rx = {
489 .name = "msm-dai-q6",
490 .id = 0xE0,
491};
492
493struct platform_device msm_cpudai_afe_01_tx = {
494 .name = "msm-dai-q6",
495 .id = 0xF0,
496};
497
498struct platform_device msm_cpudai_afe_02_rx = {
499 .name = "msm-dai-q6",
500 .id = 0xF1,
501};
502
503struct platform_device msm_cpudai_afe_02_tx = {
504 .name = "msm-dai-q6",
505 .id = 0xE1,
506};
507
508struct platform_device msm_pcm_afe = {
509 .name = "msm-pcm-afe",
510 .id = -1,
511};
512
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700513static struct resource resources_ssbi_pmic1[] = {
514 {
515 .start = MSM_PMIC1_SSBI_CMD_PHYS,
516 .end = MSM_PMIC1_SSBI_CMD_PHYS + MSM_PMIC_SSBI_SIZE - 1,
517 .flags = IORESOURCE_MEM,
518 },
519};
520
521struct platform_device msm9615_device_ssbi_pmic1 = {
522 .name = "msm_ssbi",
523 .id = 0,
524 .resource = resources_ssbi_pmic1,
525 .num_resources = ARRAY_SIZE(resources_ssbi_pmic1),
526};
527
Yan He092b7272011-09-21 15:25:03 -0700528static struct resource resources_sps[] = {
529 {
530 .name = "pipe_mem",
531 .start = 0x12800000,
532 .end = 0x12800000 + 0x4000 - 1,
533 .flags = IORESOURCE_MEM,
534 },
535 {
536 .name = "bamdma_dma",
537 .start = 0x12240000,
538 .end = 0x12240000 + 0x1000 - 1,
539 .flags = IORESOURCE_MEM,
540 },
541 {
542 .name = "bamdma_bam",
543 .start = 0x12244000,
544 .end = 0x12244000 + 0x4000 - 1,
545 .flags = IORESOURCE_MEM,
546 },
547 {
548 .name = "bamdma_irq",
549 .start = SPS_BAM_DMA_IRQ,
550 .end = SPS_BAM_DMA_IRQ,
551 .flags = IORESOURCE_IRQ,
552 },
553};
554
555struct msm_sps_platform_data msm_sps_pdata = {
556 .bamdma_restricted_pipes = 0x06,
557};
558
559struct platform_device msm_device_sps = {
560 .name = "msm_sps",
561 .id = -1,
562 .num_resources = ARRAY_SIZE(resources_sps),
563 .resource = resources_sps,
564 .dev.platform_data = &msm_sps_pdata,
565};
566
Sahitya Tummala38295432011-09-29 10:08:45 +0530567#define MSM_NAND_PHYS 0x1B400000
568static struct resource resources_nand[] = {
569 [0] = {
570 .name = "msm_nand_dmac",
571 .start = DMOV_NAND_CHAN,
572 .end = DMOV_NAND_CHAN,
573 .flags = IORESOURCE_DMA,
574 },
575 [1] = {
576 .name = "msm_nand_phys",
577 .start = MSM_NAND_PHYS,
578 .end = MSM_NAND_PHYS + 0x7FF,
579 .flags = IORESOURCE_MEM,
580 },
581};
582
583struct flash_platform_data msm_nand_data = {
584 .parts = NULL,
585 .nr_parts = 0,
586};
587
588struct platform_device msm_device_nand = {
589 .name = "msm_nand",
590 .id = -1,
591 .num_resources = ARRAY_SIZE(resources_nand),
592 .resource = resources_nand,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700593 .dev = {
Sahitya Tummala38295432011-09-29 10:08:45 +0530594 .platform_data = &msm_nand_data,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700595 },
596};
597
Jeff Hugo56b933a2011-09-28 14:42:05 -0600598struct platform_device msm_device_smd = {
599 .name = "msm_smd",
600 .id = -1,
601};
602
Eric Holmberg0c96e702011-11-08 18:04:31 -0700603struct platform_device msm_device_bam_dmux = {
604 .name = "BAM_RMNT",
605 .id = -1,
606};
607
Ramesh Masavarapu5ad37392011-10-10 10:44:10 -0700608#ifdef CONFIG_HW_RANDOM_MSM
609/* PRNG device */
610#define MSM_PRNG_PHYS 0x1A500000
611static struct resource rng_resources = {
612 .flags = IORESOURCE_MEM,
613 .start = MSM_PRNG_PHYS,
614 .end = MSM_PRNG_PHYS + SZ_512 - 1,
615};
616
617struct platform_device msm_device_rng = {
618 .name = "msm_rng",
619 .id = 0,
620 .num_resources = 1,
621 .resource = &rng_resources,
622};
623#endif
Krishna Kondadd794462011-10-01 00:19:29 -0700624
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700625#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
626 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
627 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
628 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
629
630#define QCE_SIZE 0x10000
631#define QCE_0_BASE 0x18500000
632
633#define QCE_HW_KEY_SUPPORT 0
634#define QCE_SHA_HMAC_SUPPORT 1
635#define QCE_SHARE_CE_RESOURCE 1
636#define QCE_CE_SHARED 0
637
638static struct resource qcrypto_resources[] = {
639 [0] = {
640 .start = QCE_0_BASE,
641 .end = QCE_0_BASE + QCE_SIZE - 1,
642 .flags = IORESOURCE_MEM,
643 },
644 [1] = {
645 .name = "crypto_channels",
646 .start = DMOV_CE_IN_CHAN,
647 .end = DMOV_CE_OUT_CHAN,
648 .flags = IORESOURCE_DMA,
649 },
650 [2] = {
651 .name = "crypto_crci_in",
652 .start = DMOV_CE_IN_CRCI,
653 .end = DMOV_CE_IN_CRCI,
654 .flags = IORESOURCE_DMA,
655 },
656 [3] = {
657 .name = "crypto_crci_out",
658 .start = DMOV_CE_OUT_CRCI,
659 .end = DMOV_CE_OUT_CRCI,
660 .flags = IORESOURCE_DMA,
661 },
662};
663
664static struct resource qcedev_resources[] = {
665 [0] = {
666 .start = QCE_0_BASE,
667 .end = QCE_0_BASE + QCE_SIZE - 1,
668 .flags = IORESOURCE_MEM,
669 },
670 [1] = {
671 .name = "crypto_channels",
672 .start = DMOV_CE_IN_CHAN,
673 .end = DMOV_CE_OUT_CHAN,
674 .flags = IORESOURCE_DMA,
675 },
676 [2] = {
677 .name = "crypto_crci_in",
678 .start = DMOV_CE_IN_CRCI,
679 .end = DMOV_CE_IN_CRCI,
680 .flags = IORESOURCE_DMA,
681 },
682 [3] = {
683 .name = "crypto_crci_out",
684 .start = DMOV_CE_OUT_CRCI,
685 .end = DMOV_CE_OUT_CRCI,
686 .flags = IORESOURCE_DMA,
687 },
688};
689
690#endif
691
692#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
693 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
694
695static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
696 .ce_shared = QCE_CE_SHARED,
697 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
698 .hw_key_support = QCE_HW_KEY_SUPPORT,
699 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800700 .bus_scale_table = NULL,
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700701};
702
703struct platform_device msm9615_qcrypto_device = {
704 .name = "qcrypto",
705 .id = 0,
706 .num_resources = ARRAY_SIZE(qcrypto_resources),
707 .resource = qcrypto_resources,
708 .dev = {
709 .coherent_dma_mask = DMA_BIT_MASK(32),
710 .platform_data = &qcrypto_ce_hw_suppport,
711 },
712};
713#endif
714
715#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
716 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
717
718static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
719 .ce_shared = QCE_CE_SHARED,
720 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
721 .hw_key_support = QCE_HW_KEY_SUPPORT,
722 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800723 .bus_scale_table = NULL,
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700724};
725
726struct platform_device msm9615_qcedev_device = {
727 .name = "qce",
728 .id = 0,
729 .num_resources = ARRAY_SIZE(qcedev_resources),
730 .resource = qcedev_resources,
731 .dev = {
732 .coherent_dma_mask = DMA_BIT_MASK(32),
733 .platform_data = &qcedev_ce_hw_suppport,
734 },
735};
736#endif
737
Krishna Kondadd794462011-10-01 00:19:29 -0700738#define MSM_SDC1_BASE 0x12180000
739#define MSM_SDC1_DML_BASE (MSM_SDC1_BASE + 0x800)
740#define MSM_SDC1_BAM_BASE (MSM_SDC1_BASE + 0x2000)
Krishna Konda71aef182011-10-01 02:27:51 -0700741#define MSM_SDC2_BASE 0x12140000
742#define MSM_SDC2_DML_BASE (MSM_SDC2_BASE + 0x800)
743#define MSM_SDC2_BAM_BASE (MSM_SDC2_BASE + 0x2000)
Krishna Kondadd794462011-10-01 00:19:29 -0700744
745static struct resource resources_sdc1[] = {
746 {
747 .name = "core_mem",
748 .flags = IORESOURCE_MEM,
749 .start = MSM_SDC1_BASE,
750 .end = MSM_SDC1_DML_BASE - 1,
751 },
752 {
753 .name = "core_irq",
754 .flags = IORESOURCE_IRQ,
755 .start = SDC1_IRQ_0,
756 .end = SDC1_IRQ_0
757 },
758#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
759 {
760 .name = "sdcc_dml_addr",
761 .start = MSM_SDC1_DML_BASE,
762 .end = MSM_SDC1_BAM_BASE - 1,
763 .flags = IORESOURCE_MEM,
764 },
765 {
766 .name = "sdcc_bam_addr",
767 .start = MSM_SDC1_BAM_BASE,
768 .end = MSM_SDC1_BAM_BASE + (2 * SZ_4K) - 1,
769 .flags = IORESOURCE_MEM,
770 },
771 {
772 .name = "sdcc_bam_irq",
773 .start = SDC1_BAM_IRQ,
774 .end = SDC1_BAM_IRQ,
775 .flags = IORESOURCE_IRQ,
776 },
777#endif
778};
779
Krishna Konda71aef182011-10-01 02:27:51 -0700780static struct resource resources_sdc2[] = {
781 {
782 .name = "core_mem",
783 .flags = IORESOURCE_MEM,
784 .start = MSM_SDC2_BASE,
785 .end = MSM_SDC2_DML_BASE - 1,
786 },
787 {
788 .name = "core_irq",
789 .flags = IORESOURCE_IRQ,
790 .start = SDC2_IRQ_0,
791 .end = SDC2_IRQ_0
792 },
793#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
794 {
795 .name = "sdcc_dml_addr",
796 .start = MSM_SDC2_DML_BASE,
797 .end = MSM_SDC2_BAM_BASE - 1,
798 .flags = IORESOURCE_MEM,
799 },
800 {
801 .name = "sdcc_bam_addr",
802 .start = MSM_SDC2_BAM_BASE,
803 .end = MSM_SDC2_BAM_BASE + (2 * SZ_4K) - 1,
804 .flags = IORESOURCE_MEM,
805 },
806 {
807 .name = "sdcc_bam_irq",
808 .start = SDC2_BAM_IRQ,
809 .end = SDC2_BAM_IRQ,
810 .flags = IORESOURCE_IRQ,
811 },
812#endif
813};
814
Krishna Kondadd794462011-10-01 00:19:29 -0700815struct platform_device msm_device_sdc1 = {
816 .name = "msm_sdcc",
817 .id = 1,
818 .num_resources = ARRAY_SIZE(resources_sdc1),
819 .resource = resources_sdc1,
820 .dev = {
821 .coherent_dma_mask = 0xffffffff,
822 },
823};
824
Krishna Konda71aef182011-10-01 02:27:51 -0700825struct platform_device msm_device_sdc2 = {
826 .name = "msm_sdcc",
827 .id = 2,
828 .num_resources = ARRAY_SIZE(resources_sdc2),
829 .resource = resources_sdc2,
830 .dev = {
831 .coherent_dma_mask = 0xffffffff,
832 },
833};
834
Krishna Kondadd794462011-10-01 00:19:29 -0700835static struct platform_device *msm_sdcc_devices[] __initdata = {
836 &msm_device_sdc1,
Krishna Konda71aef182011-10-01 02:27:51 -0700837 &msm_device_sdc2,
Krishna Kondadd794462011-10-01 00:19:29 -0700838};
839
840int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
841{
842 struct platform_device *pdev;
843
844 if (controller < 1 || controller > 2)
845 return -EINVAL;
846
847 pdev = msm_sdcc_devices[controller - 1];
848 pdev->dev.platform_data = plat;
849 return platform_device_register(pdev);
850}
851
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700852#ifdef CONFIG_CACHE_L2X0
853static int __init l2x0_cache_init(void)
854{
855 int aux_ctrl = 0;
856
857 /* Way Size 010(0x2) 32KB */
858 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
859 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
860 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
861
862 /* L2 Latency setting required by hardware. Default is 0x20
863 which is no good.
864 */
865 writel_relaxed(0x220, MSM_L2CC_BASE + L2X0_DATA_LATENCY_CTRL);
866 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
867
868 return 0;
869}
870#else
871static int __init l2x0_cache_init(void){ return 0; }
872#endif
873
Praveen Chidambaram78499012011-11-01 17:15:17 -0600874struct msm_rpm_platform_data msm9615_rpm_data __initdata = {
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600875 .reg_base_addrs = {
876 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
877 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
878 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
879 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
880 },
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600881 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
Stephen Boydf61255e2012-02-24 14:31:09 -0800882 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600883 .ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
884 .ipc_rpm_val = 4,
885 .target_id = {
886 MSM_RPM_MAP(9615, NOTIFICATION_CONFIGURED_0, NOTIFICATION, 4),
887 MSM_RPM_MAP(9615, NOTIFICATION_REGISTERED_0, NOTIFICATION, 4),
888 MSM_RPM_MAP(9615, INVALIDATE_0, INVALIDATE, 8),
889 MSM_RPM_MAP(9615, TRIGGER_TIMED_TO, TRIGGER_TIMED, 1),
890 MSM_RPM_MAP(9615, TRIGGER_TIMED_SCLK_COUNT, TRIGGER_TIMED, 1),
891 MSM_RPM_MAP(9615, RPM_CTL, RPM_CTL, 1),
892 MSM_RPM_MAP(9615, CXO_CLK, CXO_CLK, 1),
893 MSM_RPM_MAP(9615, SYSTEM_FABRIC_CLK, SYSTEM_FABRIC_CLK, 1),
894 MSM_RPM_MAP(9615, DAYTONA_FABRIC_CLK, DAYTONA_FABRIC_CLK, 1),
895 MSM_RPM_MAP(9615, SFPB_CLK, SFPB_CLK, 1),
896 MSM_RPM_MAP(9615, CFPB_CLK, CFPB_CLK, 1),
897 MSM_RPM_MAP(9615, EBI1_CLK, EBI1_CLK, 1),
898 MSM_RPM_MAP(9615, SYS_FABRIC_CFG_HALT_0,
899 SYS_FABRIC_CFG_HALT, 2),
900 MSM_RPM_MAP(9615, SYS_FABRIC_CFG_CLKMOD_0,
901 SYS_FABRIC_CFG_CLKMOD, 3),
902 MSM_RPM_MAP(9615, SYS_FABRIC_CFG_IOCTL,
903 SYS_FABRIC_CFG_IOCTL, 1),
904 MSM_RPM_MAP(9615, SYSTEM_FABRIC_ARB_0,
905 SYSTEM_FABRIC_ARB, 27),
906 MSM_RPM_MAP(9615, PM8018_S1_0, PM8018_S1, 2),
907 MSM_RPM_MAP(9615, PM8018_S2_0, PM8018_S2, 2),
908 MSM_RPM_MAP(9615, PM8018_S3_0, PM8018_S3, 2),
909 MSM_RPM_MAP(9615, PM8018_S4_0, PM8018_S4, 2),
910 MSM_RPM_MAP(9615, PM8018_S5_0, PM8018_S5, 2),
911 MSM_RPM_MAP(9615, PM8018_L1_0, PM8018_L1, 2),
912 MSM_RPM_MAP(9615, PM8018_L2_0, PM8018_L2, 2),
913 MSM_RPM_MAP(9615, PM8018_L3_0, PM8018_L3, 2),
914 MSM_RPM_MAP(9615, PM8018_L4_0, PM8018_L4, 2),
915 MSM_RPM_MAP(9615, PM8018_L5_0, PM8018_L5, 2),
916 MSM_RPM_MAP(9615, PM8018_L6_0, PM8018_L6, 2),
917 MSM_RPM_MAP(9615, PM8018_L7_0, PM8018_L7, 2),
918 MSM_RPM_MAP(9615, PM8018_L8_0, PM8018_L8, 2),
919 MSM_RPM_MAP(9615, PM8018_L9_0, PM8018_L9, 2),
920 MSM_RPM_MAP(9615, PM8018_L10_0, PM8018_L10, 2),
921 MSM_RPM_MAP(9615, PM8018_L11_0, PM8018_L11, 2),
922 MSM_RPM_MAP(9615, PM8018_L12_0, PM8018_L12, 2),
923 MSM_RPM_MAP(9615, PM8018_L13_0, PM8018_L13, 2),
924 MSM_RPM_MAP(9615, PM8018_L14_0, PM8018_L14, 2),
925 MSM_RPM_MAP(9615, PM8018_LVS1, PM8018_LVS1, 1),
926 MSM_RPM_MAP(9615, NCP_0, NCP, 2),
927 MSM_RPM_MAP(9615, CXO_BUFFERS, CXO_BUFFERS, 1),
928 MSM_RPM_MAP(9615, USB_OTG_SWITCH, USB_OTG_SWITCH, 1),
929 MSM_RPM_MAP(9615, HDMI_SWITCH, HDMI_SWITCH, 1),
930 },
931 .target_status = {
932 MSM_RPM_STATUS_ID_MAP(9615, VERSION_MAJOR),
933 MSM_RPM_STATUS_ID_MAP(9615, VERSION_MINOR),
934 MSM_RPM_STATUS_ID_MAP(9615, VERSION_BUILD),
935 MSM_RPM_STATUS_ID_MAP(9615, SUPPORTED_RESOURCES_0),
936 MSM_RPM_STATUS_ID_MAP(9615, SUPPORTED_RESOURCES_1),
937 MSM_RPM_STATUS_ID_MAP(9615, SUPPORTED_RESOURCES_2),
938 MSM_RPM_STATUS_ID_MAP(9615, RESERVED_SUPPORTED_RESOURCES_0),
939 MSM_RPM_STATUS_ID_MAP(9615, SEQUENCE),
940 MSM_RPM_STATUS_ID_MAP(9615, RPM_CTL),
941 MSM_RPM_STATUS_ID_MAP(9615, CXO_CLK),
942 MSM_RPM_STATUS_ID_MAP(9615, SYSTEM_FABRIC_CLK),
943 MSM_RPM_STATUS_ID_MAP(9615, DAYTONA_FABRIC_CLK),
944 MSM_RPM_STATUS_ID_MAP(9615, SFPB_CLK),
945 MSM_RPM_STATUS_ID_MAP(9615, CFPB_CLK),
946 MSM_RPM_STATUS_ID_MAP(9615, EBI1_CLK),
947 MSM_RPM_STATUS_ID_MAP(9615, SYS_FABRIC_CFG_HALT),
948 MSM_RPM_STATUS_ID_MAP(9615, SYS_FABRIC_CFG_CLKMOD),
949 MSM_RPM_STATUS_ID_MAP(9615, SYS_FABRIC_CFG_IOCTL),
950 MSM_RPM_STATUS_ID_MAP(9615, SYSTEM_FABRIC_ARB),
951 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S1_0),
952 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S1_1),
953 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S2_0),
954 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S2_1),
955 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S3_0),
956 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S3_1),
957 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S4_0),
958 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S4_1),
959 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S5_0),
960 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S5_1),
961 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L1_0),
962 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L1_1),
963 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L2_0),
964 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L2_1),
965 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L3_0),
966 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L3_1),
967 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L4_0),
968 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L4_1),
969 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L5_0),
970 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L5_1),
971 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L6_0),
972 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L6_1),
973 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L7_0),
974 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L7_1),
975 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L8_0),
976 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L8_1),
977 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L9_0),
978 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L9_1),
979 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L10_0),
980 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L10_1),
981 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L11_0),
982 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L11_1),
983 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L12_0),
984 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L12_1),
985 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L13_0),
986 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L13_1),
987 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L14_0),
988 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L14_1),
989 MSM_RPM_STATUS_ID_MAP(9615, PM8018_LVS1),
990 MSM_RPM_STATUS_ID_MAP(9615, NCP_0),
991 MSM_RPM_STATUS_ID_MAP(9615, NCP_1),
992 MSM_RPM_STATUS_ID_MAP(9615, CXO_BUFFERS),
993 MSM_RPM_STATUS_ID_MAP(9615, USB_OTG_SWITCH),
994 MSM_RPM_STATUS_ID_MAP(9615, HDMI_SWITCH),
995 },
996 .target_ctrl_id = {
997 MSM_RPM_CTRL_MAP(9615, VERSION_MAJOR),
998 MSM_RPM_CTRL_MAP(9615, VERSION_MINOR),
999 MSM_RPM_CTRL_MAP(9615, VERSION_BUILD),
1000 MSM_RPM_CTRL_MAP(9615, REQ_CTX_0),
1001 MSM_RPM_CTRL_MAP(9615, REQ_SEL_0),
1002 MSM_RPM_CTRL_MAP(9615, ACK_CTX_0),
1003 MSM_RPM_CTRL_MAP(9615, ACK_SEL_0),
1004 },
1005 .sel_invalidate = MSM_RPM_9615_SEL_INVALIDATE,
1006 .sel_notification = MSM_RPM_9615_SEL_NOTIFICATION,
1007 .sel_last = MSM_RPM_9615_SEL_LAST,
1008 .ver = {3, 0, 0},
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001009};
1010
Praveen Chidambaram78499012011-11-01 17:15:17 -06001011struct platform_device msm9615_rpm_device = {
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001012 .name = "msm_rpm",
1013 .id = -1,
1014};
1015
Praveen Chidambaram78499012011-11-01 17:15:17 -06001016static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = {
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -06001017 [4] = MSM_GPIO_TO_INT(30),
1018 [5] = MSM_GPIO_TO_INT(59),
1019 [6] = MSM_GPIO_TO_INT(81),
1020 [7] = MSM_GPIO_TO_INT(87),
1021 [8] = MSM_GPIO_TO_INT(86),
1022 [9] = MSM_GPIO_TO_INT(2),
1023 [10] = MSM_GPIO_TO_INT(6),
1024 [11] = MSM_GPIO_TO_INT(10),
1025 [12] = MSM_GPIO_TO_INT(14),
1026 [13] = MSM_GPIO_TO_INT(18),
1027 [14] = MSM_GPIO_TO_INT(7),
1028 [15] = MSM_GPIO_TO_INT(11),
1029 [16] = MSM_GPIO_TO_INT(15),
1030 [19] = MSM_GPIO_TO_INT(26),
1031 [20] = MSM_GPIO_TO_INT(28),
Ofir Cohendca06cb2012-03-08 16:37:45 +02001032 [22] = USB_HSIC_IRQ,
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -06001033 [23] = MSM_GPIO_TO_INT(19),
1034 [24] = MSM_GPIO_TO_INT(23),
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -06001035 [26] = MSM_GPIO_TO_INT(3),
1036 [27] = MSM_GPIO_TO_INT(68),
1037 [29] = MSM_GPIO_TO_INT(78),
1038 [31] = MSM_GPIO_TO_INT(0),
1039 [32] = MSM_GPIO_TO_INT(4),
1040 [33] = MSM_GPIO_TO_INT(22),
1041 [34] = MSM_GPIO_TO_INT(17),
1042 [37] = MSM_GPIO_TO_INT(20),
1043 [39] = MSM_GPIO_TO_INT(84),
Mahesh Sivasubramanian4ce82182012-01-04 14:34:42 -07001044 [40] = USB1_HS_IRQ,
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -06001045 [42] = MSM_GPIO_TO_INT(24),
1046 [43] = MSM_GPIO_TO_INT(79),
1047 [44] = MSM_GPIO_TO_INT(80),
1048 [45] = MSM_GPIO_TO_INT(82),
1049 [46] = MSM_GPIO_TO_INT(85),
1050 [47] = MSM_GPIO_TO_INT(45),
1051 [48] = MSM_GPIO_TO_INT(50),
1052 [49] = MSM_GPIO_TO_INT(51),
1053 [50] = MSM_GPIO_TO_INT(69),
1054 [51] = MSM_GPIO_TO_INT(77),
1055 [52] = MSM_GPIO_TO_INT(1),
1056 [53] = MSM_GPIO_TO_INT(5),
1057 [54] = MSM_GPIO_TO_INT(40),
1058 [55] = MSM_GPIO_TO_INT(27),
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001059};
1060
Praveen Chidambaram78499012011-11-01 17:15:17 -06001061static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = {
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001062 TLMM_MSM_SUMMARY_IRQ,
1063 RPM_APCC_CPU0_GP_HIGH_IRQ,
1064 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1065 RPM_APCC_CPU0_GP_LOW_IRQ,
1066 RPM_APCC_CPU0_WAKE_UP_IRQ,
Mahesh Sivasubramaniandbf2bb62011-12-12 16:03:40 -07001067 MSS_TO_APPS_IRQ_0,
1068 MSS_TO_APPS_IRQ_1,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001069 LPASS_SCSS_GP_LOW_IRQ,
1070 LPASS_SCSS_GP_MEDIUM_IRQ,
1071 LPASS_SCSS_GP_HIGH_IRQ,
1072 SPS_MTI_31,
Mahesh Sivasubramaniandbf2bb62011-12-12 16:03:40 -07001073 A2_BAM_IRQ,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001074};
1075
Praveen Chidambaram78499012011-11-01 17:15:17 -06001076struct msm_mpm_device_data msm9615_mpm_dev_data __initdata = {
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001077 .irqs_m2a = msm_mpm_irqs_m2a,
1078 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
1079 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
1080 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
1081 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
1082 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
1083 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
1084 .mpm_apps_ipc_val = BIT(1),
1085 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -06001086};
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001087
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -06001088static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -06001089 0x00, 0x03, 0x00, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -06001090};
1091
1092static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -06001093 0x34, 0x24, 0x14, 0x04,
1094 0x54, 0x03, 0x54, 0x04,
1095 0x14, 0x24, 0x3e, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -06001096};
1097
1098static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -06001099 0x34, 0x24, 0x14, 0x04,
1100 0x54, 0x07, 0x54, 0x04,
1101 0x14, 0x24, 0x3e, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -06001102};
1103
1104static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1105 [0] = {
1106 .mode = MSM_SPM_MODE_CLOCK_GATING,
1107 .notify_rpm = false,
1108 .cmd = spm_wfi_cmd_sequence,
1109 },
1110 [1] = {
1111 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1112 .notify_rpm = false,
1113 .cmd = spm_power_collapse_without_rpm,
1114 },
1115 [2] = {
1116 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1117 .notify_rpm = true,
1118 .cmd = spm_power_collapse_with_rpm,
1119 },
1120};
1121
1122static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1123 [0] = {
1124 .reg_base_addr = MSM_SAW0_BASE,
1125 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -06001126 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1001,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -06001127 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1128 .modes = msm_spm_seq_list,
1129 },
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001130};
1131
1132static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1133 {
1134 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1135 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1136 true,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -06001137 100, 8000, 100000, 1,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001138 },
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001139 {
1140 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1141 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1142 true,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -06001143 2000, 5000, 60100000, 3000,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001144 },
1145 {
1146 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1147 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1148 false,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -06001149 6300, 5000, 60350000, 3500,
1150 },
1151 {
1152 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1153 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1154 false,
1155 13300, 2000, 71850000, 6800,
1156 },
1157 {
1158 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1159 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1160 false,
1161 28300, 0, 76350000, 9800,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001162 },
1163};
1164
Praveen Chidambaram78499012011-11-01 17:15:17 -06001165static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1166 .levels = &msm_rpmrs_levels[0],
1167 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1168 .vdd_mem_levels = {
1169 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1170 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1171 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1172 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1173 },
1174 .vdd_dig_levels = {
1175 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1176 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1177 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1178 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1179 },
1180 .vdd_mask = 0x7FFFFF,
1181 .rpmrs_target_id = {
1182 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_CXO_CLK,
1183 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1184 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8018_S1_0,
1185 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8018_S1_1,
1186 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8018_L9_0,
1187 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8018_L9_1,
1188 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1189 },
1190};
1191
1192static struct msm_rpmstats_platform_data msm_rpm_stat_pdata = {
1193 .phys_addr_base = 0x0010D204,
1194 .phys_size = SZ_8K,
1195};
1196
1197struct platform_device msm9615_rpm_stat_device = {
1198 .name = "msm_rpm_stat",
1199 .id = -1,
1200 .dev = {
1201 .platform_data = &msm_rpm_stat_pdata,
1202 },
1203};
1204
1205static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
1206 .phys_addr_base = 0x0010AC00,
1207 .reg_offsets = {
1208 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
1209 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
1210 },
1211 .phys_size = SZ_8K,
1212 .log_len = 4096, /* log's buffer length in bytes */
1213 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
1214};
1215
1216struct platform_device msm9615_rpm_log_device = {
1217 .name = "msm_rpm_log",
1218 .id = -1,
1219 .dev = {
1220 .platform_data = &msm_rpm_log_pdata,
1221 },
1222};
1223
Krishna Konda39f5b2c2012-03-14 12:55:22 -07001224uint32_t __init msm9615_rpm_get_swfi_latency(void)
1225{
1226 int i;
1227
1228 for (i = 0; i < ARRAY_SIZE(msm_rpmrs_levels); i++) {
1229 if (msm_rpmrs_levels[i].sleep_mode ==
1230 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)
1231 return msm_rpmrs_levels[i].latency_us;
1232 }
1233 return 0;
1234}
1235
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001236void __init msm9615_device_init(void)
1237{
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -06001238 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Praveen Chidambaram78499012011-11-01 17:15:17 -06001239 BUG_ON(msm_rpm_init(&msm9615_rpm_data));
1240 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001241}
1242
Jeff Hugo56b933a2011-09-28 14:42:05 -06001243#define MSM_SHARED_RAM_PHYS 0x40000000
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001244void __init msm9615_map_io(void)
1245{
Jeff Hugo56b933a2011-09-28 14:42:05 -06001246 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001247 msm_map_msm9615_io();
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -07001248 l2x0_cache_init();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001249 if (socinfo_init() < 0)
1250 pr_err("socinfo_init() failed!\n");
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001251}
1252
1253void __init msm9615_init_irq(void)
1254{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001255 struct msm_mpm_device_data *data = NULL;
1256
1257#ifdef CONFIG_MSM_MPM
1258 data = &msm9615_mpm_dev_data;
1259#endif
1260
1261 msm_mpm_irq_extn_init(data);
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001262 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1263 (void *)MSM_QGIC_CPU_BASE);
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001264}
Gagan Mac7a827642011-09-22 19:42:21 -06001265
1266struct platform_device msm_bus_9615_sys_fabric = {
1267 .name = "msm_bus_fabric",
1268 .id = MSM_BUS_FAB_SYSTEM,
1269};
1270
1271struct platform_device msm_bus_def_fab = {
1272 .name = "msm_bus_fabric",
1273 .id = MSM_BUS_FAB_DEFAULT,
1274};