blob: f7306d2300556da176d51798b3ba7c14b69b616b [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,
Rohit Vaswaniead426f2012-01-05 20:24:52 -080067 .has_secure = false,
68 .use_kernel_fiq = true,
Jeff Ohlstein7e668552011-10-06 16:17:25 -070069};
70
71struct platform_device msm9615_device_watchdog = {
72 .name = "msm_watchdog",
73 .id = -1,
74 .dev = {
75 .platform_data = &msm_watchdog_pdata,
76 },
77};
78
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070079static struct resource msm_dmov_resource[] = {
80 {
81 .start = ADM_0_SCSS_1_IRQ,
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070082 .flags = IORESOURCE_IRQ,
83 },
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -070084 {
85 .start = 0x18320000,
86 .end = 0x18320000 + SZ_1M - 1,
87 .flags = IORESOURCE_MEM,
88 },
89};
90
91static struct msm_dmov_pdata msm_dmov_pdata = {
92 .sd = 1,
93 .sd_size = 0x800,
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070094};
95
96struct platform_device msm9615_device_dmov = {
97 .name = "msm_dmov",
98 .id = -1,
99 .resource = msm_dmov_resource,
100 .num_resources = ARRAY_SIZE(msm_dmov_resource),
Jeff Ohlstein905f1ce2011-09-07 18:50:18 -0700101 .dev = {
102 .platform_data = &msm_dmov_pdata,
103 },
Jeff Ohlsteind19bf442011-09-09 12:48:18 -0700104};
105
Ofir Cohen40a4e862011-12-08 15:17:52 +0200106#define MSM_USB_BAM_BASE 0x12502000
Ofir Cohen010009b2012-01-26 16:49:17 +0200107#define MSM_USB_BAM_SIZE SZ_16K
108#define MSM_HSIC_BAM_BASE 0x12542000
109#define MSM_HSIC_BAM_SIZE SZ_16K
Ofir Cohen40a4e862011-12-08 15:17:52 +0200110
Amit Blay5e4ec192011-10-20 09:16:54 +0200111static struct resource resources_otg[] = {
112 {
113 .start = MSM9615_HSUSB_PHYS,
114 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_SIZE - 1,
115 .flags = IORESOURCE_MEM,
116 },
117 {
118 .start = USB1_HS_IRQ,
119 .end = USB1_HS_IRQ,
120 .flags = IORESOURCE_IRQ,
121 },
122};
123
124struct platform_device msm_device_otg = {
125 .name = "msm_otg",
126 .id = -1,
127 .num_resources = ARRAY_SIZE(resources_otg),
128 .resource = resources_otg,
129 .dev = {
130 .coherent_dma_mask = DMA_BIT_MASK(32),
131 },
132};
133
134static struct resource resources_hsusb[] = {
135 {
136 .start = MSM9615_HSUSB_PHYS,
137 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_SIZE - 1,
138 .flags = IORESOURCE_MEM,
139 },
140 {
141 .start = USB1_HS_IRQ,
142 .end = USB1_HS_IRQ,
143 .flags = IORESOURCE_IRQ,
144 },
145};
146
Ofir Cohen40a4e862011-12-08 15:17:52 +0200147static struct resource resources_usb_bam[] = {
148 {
149 .name = "usb_bam_addr",
150 .start = MSM_USB_BAM_BASE,
Ofir Cohen010009b2012-01-26 16:49:17 +0200151 .end = MSM_USB_BAM_BASE + MSM_USB_BAM_SIZE - 1,
Ofir Cohen40a4e862011-12-08 15:17:52 +0200152 .flags = IORESOURCE_MEM,
153 },
154 {
155 .name = "usb_bam_irq",
156 .start = USB1_HS_BAM_IRQ,
157 .end = USB1_HS_BAM_IRQ,
158 .flags = IORESOURCE_IRQ,
159 },
Ofir Cohen010009b2012-01-26 16:49:17 +0200160 {
161 .name = "hsic_bam_addr",
162 .start = MSM_HSIC_BAM_BASE,
163 .end = MSM_HSIC_BAM_BASE + MSM_HSIC_BAM_SIZE - 1,
164 .flags = IORESOURCE_MEM,
165 },
166 {
167 .name = "hsic_bam_irq",
168 .start = USB_HSIC_BAM_IRQ,
169 .end = USB_HSIC_BAM_IRQ,
170 .flags = IORESOURCE_IRQ,
171 },
Ofir Cohen40a4e862011-12-08 15:17:52 +0200172};
173
174struct platform_device msm_device_usb_bam = {
175 .name = "usb_bam",
176 .id = -1,
177 .num_resources = ARRAY_SIZE(resources_usb_bam),
178 .resource = resources_usb_bam,
179};
180
Amit Blay5e4ec192011-10-20 09:16:54 +0200181struct platform_device msm_device_gadget_peripheral = {
182 .name = "msm_hsusb",
183 .id = -1,
184 .num_resources = ARRAY_SIZE(resources_hsusb),
185 .resource = resources_hsusb,
186 .dev = {
187 .coherent_dma_mask = DMA_BIT_MASK(32),
188 },
189};
190
Ofir Cohen06789f12012-01-16 09:43:13 +0200191static struct resource resources_hsic_peripheral[] = {
192 {
193 .start = MSM9615_HSIC_PHYS,
194 .end = MSM9615_HSIC_PHYS + MSM9615_HSIC_SIZE - 1,
195 .flags = IORESOURCE_MEM,
196 },
197 {
198 .start = USB_HSIC_IRQ,
199 .end = USB_HSIC_IRQ,
200 .flags = IORESOURCE_IRQ,
201 },
202};
203
204struct platform_device msm_device_hsic_peripheral = {
205 .name = "msm_hsic_peripheral",
206 .id = -1,
207 .num_resources = ARRAY_SIZE(resources_hsic_peripheral),
208 .resource = resources_hsic_peripheral,
209 .dev = {
210 .coherent_dma_mask = DMA_BIT_MASK(32),
211 },
212};
213
Amit Blay6a8d4f32011-11-21 10:36:25 +0200214static struct resource resources_hsusb_host[] = {
215 {
216 .start = MSM9615_HSUSB_PHYS,
217 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_PHYS - 1,
218 .flags = IORESOURCE_MEM,
219 },
220 {
221 .start = USB1_HS_IRQ,
222 .end = USB1_HS_IRQ,
223 .flags = IORESOURCE_IRQ,
224 },
225};
226
227static u64 dma_mask = DMA_BIT_MASK(32);
228struct platform_device msm_device_hsusb_host = {
229 .name = "msm_hsusb_host",
230 .id = -1,
231 .num_resources = ARRAY_SIZE(resources_hsusb_host),
232 .resource = resources_hsusb_host,
233 .dev = {
234 .dma_mask = &dma_mask,
235 .coherent_dma_mask = 0xffffffff,
236 },
237};
238
Lena Salman65bcf372012-02-14 15:33:32 +0200239static struct resource resources_hsic_host[] = {
240 {
241 .start = MSM9615_HSIC_PHYS,
242 .end = MSM9615_HSIC_PHYS + MSM9615_HSIC_SIZE - 1,
243 .flags = IORESOURCE_MEM,
244 },
245 {
246 .start = USB_HSIC_IRQ,
247 .end = USB_HSIC_IRQ,
248 .flags = IORESOURCE_IRQ,
249 },
250};
251
252struct platform_device msm_device_hsic_host = {
253 .name = "msm_hsic_host",
254 .id = -1,
255 .num_resources = ARRAY_SIZE(resources_hsic_host),
256 .resource = resources_hsic_host,
257 .dev = {
258 .dma_mask = &dma_mask,
259 .coherent_dma_mask = 0xffffffff,
260 },
261};
262
Rohit Vaswani09666872011-08-23 17:41:54 -0700263static struct resource resources_uart_gsbi4[] = {
264 {
265 .start = GSBI4_UARTDM_IRQ,
266 .end = GSBI4_UARTDM_IRQ,
267 .flags = IORESOURCE_IRQ,
268 },
269 {
270 .start = MSM_UART4DM_PHYS,
271 .end = MSM_UART4DM_PHYS + PAGE_SIZE - 1,
272 .name = "uartdm_resource",
273 .flags = IORESOURCE_MEM,
274 },
275 {
276 .start = MSM_GSBI4_PHYS,
277 .end = MSM_GSBI4_PHYS + PAGE_SIZE - 1,
278 .name = "gsbi_resource",
279 .flags = IORESOURCE_MEM,
280 },
281};
282
283struct platform_device msm9615_device_uart_gsbi4 = {
284 .name = "msm_serial_hsl",
285 .id = 0,
286 .num_resources = ARRAY_SIZE(resources_uart_gsbi4),
287 .resource = resources_uart_gsbi4,
288};
289
Harini Jayaramaneba52672011-09-08 15:13:00 -0600290static struct resource resources_qup_i2c_gsbi5[] = {
291 {
292 .name = "gsbi_qup_i2c_addr",
293 .start = MSM_GSBI5_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600294 .end = MSM_GSBI5_PHYS + 4 - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600295 .flags = IORESOURCE_MEM,
296 },
297 {
298 .name = "qup_phys_addr",
299 .start = MSM_GSBI5_QUP_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600300 .end = MSM_GSBI5_QUP_PHYS + MSM_QUP_SIZE - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600301 .flags = IORESOURCE_MEM,
302 },
303 {
304 .name = "qup_err_intr",
305 .start = GSBI5_QUP_IRQ,
306 .end = GSBI5_QUP_IRQ,
307 .flags = IORESOURCE_IRQ,
308 },
309};
310
311struct platform_device msm9615_device_qup_i2c_gsbi5 = {
312 .name = "qup_i2c",
313 .id = 0,
314 .num_resources = ARRAY_SIZE(resources_qup_i2c_gsbi5),
315 .resource = resources_qup_i2c_gsbi5,
316};
317
Harini Jayaraman738c9312011-09-08 15:22:38 -0600318static struct resource resources_qup_spi_gsbi3[] = {
319 {
320 .name = "spi_base",
321 .start = MSM_GSBI3_QUP_PHYS,
322 .end = MSM_GSBI3_QUP_PHYS + SZ_4K - 1,
323 .flags = IORESOURCE_MEM,
324 },
325 {
326 .name = "gsbi_base",
327 .start = MSM_GSBI3_PHYS,
328 .end = MSM_GSBI3_PHYS + 4 - 1,
329 .flags = IORESOURCE_MEM,
330 },
331 {
332 .name = "spi_irq_in",
333 .start = GSBI3_QUP_IRQ,
334 .end = GSBI3_QUP_IRQ,
335 .flags = IORESOURCE_IRQ,
336 },
337};
338
339struct platform_device msm9615_device_qup_spi_gsbi3 = {
340 .name = "spi_qsd",
341 .id = 0,
342 .num_resources = ARRAY_SIZE(resources_qup_spi_gsbi3),
343 .resource = resources_qup_spi_gsbi3,
344};
345
Sagar Dharia2a5378d2011-12-01 20:00:11 -0700346#define LPASS_SLIMBUS_PHYS 0x28080000
347#define LPASS_SLIMBUS_BAM_PHYS 0x28084000
348#define LPASS_SLIMBUS_SLEW (MSM9615_TLMM_PHYS + 0x207C)
349/* Board info for the slimbus slave device */
350static struct resource slimbus_res[] = {
351 {
352 .start = LPASS_SLIMBUS_PHYS,
353 .end = LPASS_SLIMBUS_PHYS + 8191,
354 .flags = IORESOURCE_MEM,
355 .name = "slimbus_physical",
356 },
357 {
358 .start = LPASS_SLIMBUS_BAM_PHYS,
359 .end = LPASS_SLIMBUS_BAM_PHYS + 8191,
360 .flags = IORESOURCE_MEM,
361 .name = "slimbus_bam_physical",
362 },
363 {
364 .start = LPASS_SLIMBUS_SLEW,
365 .end = LPASS_SLIMBUS_SLEW + 4 - 1,
366 .flags = IORESOURCE_MEM,
367 .name = "slimbus_slew_reg",
368 },
369 {
370 .start = SLIMBUS0_CORE_EE1_IRQ,
371 .end = SLIMBUS0_CORE_EE1_IRQ,
372 .flags = IORESOURCE_IRQ,
373 .name = "slimbus_irq",
374 },
375 {
376 .start = SLIMBUS0_BAM_EE1_IRQ,
377 .end = SLIMBUS0_BAM_EE1_IRQ,
378 .flags = IORESOURCE_IRQ,
379 .name = "slimbus_bam_irq",
380 },
381};
382
383struct platform_device msm9615_slim_ctrl = {
384 .name = "msm_slim_ctrl",
385 .id = 1,
386 .num_resources = ARRAY_SIZE(slimbus_res),
387 .resource = slimbus_res,
388 .dev = {
389 .coherent_dma_mask = 0xffffffffULL,
390 },
391};
392
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800393struct platform_device msm_pcm = {
394 .name = "msm-pcm-dsp",
395 .id = -1,
396};
397
398struct platform_device msm_multi_ch_pcm = {
399 .name = "msm-multi-ch-pcm-dsp",
400 .id = -1,
401};
402
403struct platform_device msm_pcm_routing = {
404 .name = "msm-pcm-routing",
405 .id = -1,
406};
407
408struct platform_device msm_cpudai0 = {
409 .name = "msm-dai-q6",
410 .id = 0x4000,
411};
412
413struct platform_device msm_cpudai1 = {
414 .name = "msm-dai-q6",
415 .id = 0x4001,
416};
417
418struct platform_device msm_cpudai_bt_rx = {
419 .name = "msm-dai-q6",
420 .id = 0x3000,
421};
422
423struct platform_device msm_cpudai_bt_tx = {
424 .name = "msm-dai-q6",
425 .id = 0x3001,
426};
427
428/*
429 * Machine specific data for AUX PCM Interface
430 * which the driver will be unware of.
431 */
Shiv Maliyappanahalli19e86e22012-03-28 17:27:26 -0700432struct msm_dai_auxpcm_pdata auxpcm_pdata = {
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800433 .clk = "pcm_clk",
434 .mode = AFE_PCM_CFG_MODE_PCM,
435 .sync = AFE_PCM_CFG_SYNC_INT,
436 .frame = AFE_PCM_CFG_FRM_256BPF,
437 .quant = AFE_PCM_CFG_QUANT_LINEAR_NOPAD,
438 .slot = 0,
439 .data = AFE_PCM_CFG_CDATAOE_MASTER,
440 .pcm_clk_rate = 2048000,
441};
442
443struct platform_device msm_cpudai_auxpcm_rx = {
444 .name = "msm-dai-q6",
445 .id = 2,
446 .dev = {
Shiv Maliyappanahalli19e86e22012-03-28 17:27:26 -0700447 .platform_data = &auxpcm_pdata,
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800448 },
449};
450
451struct platform_device msm_cpudai_auxpcm_tx = {
452 .name = "msm-dai-q6",
453 .id = 3,
Shiv Maliyappanahalli19e86e22012-03-28 17:27:26 -0700454 .dev = {
455 .platform_data = &auxpcm_pdata,
456 },
Shiv Maliyappanahalli9ec55e92012-01-09 14:44:59 -0800457};
458
459struct platform_device msm_cpu_fe = {
460 .name = "msm-dai-fe",
461 .id = -1,
462};
463
464struct platform_device msm_stub_codec = {
465 .name = "msm-stub-codec",
466 .id = 1,
467};
468
469struct platform_device msm_voice = {
470 .name = "msm-pcm-voice",
471 .id = -1,
472};
473
474struct platform_device msm_voip = {
475 .name = "msm-voip-dsp",
476 .id = -1,
477};
478
479struct platform_device msm_compr_dsp = {
480 .name = "msm-compr-dsp",
481 .id = -1,
482};
483
484struct platform_device msm_pcm_hostless = {
485 .name = "msm-pcm-hostless",
486 .id = -1,
487};
488
489struct platform_device msm_cpudai_afe_01_rx = {
490 .name = "msm-dai-q6",
491 .id = 0xE0,
492};
493
494struct platform_device msm_cpudai_afe_01_tx = {
495 .name = "msm-dai-q6",
496 .id = 0xF0,
497};
498
499struct platform_device msm_cpudai_afe_02_rx = {
500 .name = "msm-dai-q6",
501 .id = 0xF1,
502};
503
504struct platform_device msm_cpudai_afe_02_tx = {
505 .name = "msm-dai-q6",
506 .id = 0xE1,
507};
508
509struct platform_device msm_pcm_afe = {
510 .name = "msm-pcm-afe",
511 .id = -1,
512};
513
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700514static struct resource resources_ssbi_pmic1[] = {
515 {
516 .start = MSM_PMIC1_SSBI_CMD_PHYS,
517 .end = MSM_PMIC1_SSBI_CMD_PHYS + MSM_PMIC_SSBI_SIZE - 1,
518 .flags = IORESOURCE_MEM,
519 },
520};
521
522struct platform_device msm9615_device_ssbi_pmic1 = {
523 .name = "msm_ssbi",
524 .id = 0,
525 .resource = resources_ssbi_pmic1,
526 .num_resources = ARRAY_SIZE(resources_ssbi_pmic1),
527};
528
Yan He092b7272011-09-21 15:25:03 -0700529static struct resource resources_sps[] = {
530 {
531 .name = "pipe_mem",
532 .start = 0x12800000,
533 .end = 0x12800000 + 0x4000 - 1,
534 .flags = IORESOURCE_MEM,
535 },
536 {
537 .name = "bamdma_dma",
538 .start = 0x12240000,
539 .end = 0x12240000 + 0x1000 - 1,
540 .flags = IORESOURCE_MEM,
541 },
542 {
543 .name = "bamdma_bam",
544 .start = 0x12244000,
545 .end = 0x12244000 + 0x4000 - 1,
546 .flags = IORESOURCE_MEM,
547 },
548 {
549 .name = "bamdma_irq",
550 .start = SPS_BAM_DMA_IRQ,
551 .end = SPS_BAM_DMA_IRQ,
552 .flags = IORESOURCE_IRQ,
553 },
554};
555
556struct msm_sps_platform_data msm_sps_pdata = {
557 .bamdma_restricted_pipes = 0x06,
558};
559
560struct platform_device msm_device_sps = {
561 .name = "msm_sps",
562 .id = -1,
563 .num_resources = ARRAY_SIZE(resources_sps),
564 .resource = resources_sps,
565 .dev.platform_data = &msm_sps_pdata,
566};
567
Sahitya Tummala38295432011-09-29 10:08:45 +0530568#define MSM_NAND_PHYS 0x1B400000
569static struct resource resources_nand[] = {
570 [0] = {
571 .name = "msm_nand_dmac",
572 .start = DMOV_NAND_CHAN,
573 .end = DMOV_NAND_CHAN,
574 .flags = IORESOURCE_DMA,
575 },
576 [1] = {
577 .name = "msm_nand_phys",
578 .start = MSM_NAND_PHYS,
579 .end = MSM_NAND_PHYS + 0x7FF,
580 .flags = IORESOURCE_MEM,
581 },
582};
583
584struct flash_platform_data msm_nand_data = {
585 .parts = NULL,
586 .nr_parts = 0,
587};
588
589struct platform_device msm_device_nand = {
590 .name = "msm_nand",
591 .id = -1,
592 .num_resources = ARRAY_SIZE(resources_nand),
593 .resource = resources_nand,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700594 .dev = {
Sahitya Tummala38295432011-09-29 10:08:45 +0530595 .platform_data = &msm_nand_data,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700596 },
597};
598
Jeff Hugo56b933a2011-09-28 14:42:05 -0600599struct platform_device msm_device_smd = {
600 .name = "msm_smd",
601 .id = -1,
602};
603
Eric Holmberg0c96e702011-11-08 18:04:31 -0700604struct platform_device msm_device_bam_dmux = {
605 .name = "BAM_RMNT",
606 .id = -1,
607};
608
Ramesh Masavarapu5ad37392011-10-10 10:44:10 -0700609#ifdef CONFIG_HW_RANDOM_MSM
610/* PRNG device */
611#define MSM_PRNG_PHYS 0x1A500000
612static struct resource rng_resources = {
613 .flags = IORESOURCE_MEM,
614 .start = MSM_PRNG_PHYS,
615 .end = MSM_PRNG_PHYS + SZ_512 - 1,
616};
617
618struct platform_device msm_device_rng = {
619 .name = "msm_rng",
620 .id = 0,
621 .num_resources = 1,
622 .resource = &rng_resources,
623};
624#endif
Krishna Kondadd794462011-10-01 00:19:29 -0700625
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700626#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
627 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE) || \
628 defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
629 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
630
631#define QCE_SIZE 0x10000
632#define QCE_0_BASE 0x18500000
633
634#define QCE_HW_KEY_SUPPORT 0
635#define QCE_SHA_HMAC_SUPPORT 1
636#define QCE_SHARE_CE_RESOURCE 1
637#define QCE_CE_SHARED 0
638
639static struct resource qcrypto_resources[] = {
640 [0] = {
641 .start = QCE_0_BASE,
642 .end = QCE_0_BASE + QCE_SIZE - 1,
643 .flags = IORESOURCE_MEM,
644 },
645 [1] = {
646 .name = "crypto_channels",
647 .start = DMOV_CE_IN_CHAN,
648 .end = DMOV_CE_OUT_CHAN,
649 .flags = IORESOURCE_DMA,
650 },
651 [2] = {
652 .name = "crypto_crci_in",
653 .start = DMOV_CE_IN_CRCI,
654 .end = DMOV_CE_IN_CRCI,
655 .flags = IORESOURCE_DMA,
656 },
657 [3] = {
658 .name = "crypto_crci_out",
659 .start = DMOV_CE_OUT_CRCI,
660 .end = DMOV_CE_OUT_CRCI,
661 .flags = IORESOURCE_DMA,
662 },
663};
664
665static struct resource qcedev_resources[] = {
666 [0] = {
667 .start = QCE_0_BASE,
668 .end = QCE_0_BASE + QCE_SIZE - 1,
669 .flags = IORESOURCE_MEM,
670 },
671 [1] = {
672 .name = "crypto_channels",
673 .start = DMOV_CE_IN_CHAN,
674 .end = DMOV_CE_OUT_CHAN,
675 .flags = IORESOURCE_DMA,
676 },
677 [2] = {
678 .name = "crypto_crci_in",
679 .start = DMOV_CE_IN_CRCI,
680 .end = DMOV_CE_IN_CRCI,
681 .flags = IORESOURCE_DMA,
682 },
683 [3] = {
684 .name = "crypto_crci_out",
685 .start = DMOV_CE_OUT_CRCI,
686 .end = DMOV_CE_OUT_CRCI,
687 .flags = IORESOURCE_DMA,
688 },
689};
690
691#endif
692
693#if defined(CONFIG_CRYPTO_DEV_QCRYPTO) || \
694 defined(CONFIG_CRYPTO_DEV_QCRYPTO_MODULE)
695
696static struct msm_ce_hw_support qcrypto_ce_hw_suppport = {
697 .ce_shared = QCE_CE_SHARED,
698 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
699 .hw_key_support = QCE_HW_KEY_SUPPORT,
700 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800701 .bus_scale_table = NULL,
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700702};
703
704struct platform_device msm9615_qcrypto_device = {
705 .name = "qcrypto",
706 .id = 0,
707 .num_resources = ARRAY_SIZE(qcrypto_resources),
708 .resource = qcrypto_resources,
709 .dev = {
710 .coherent_dma_mask = DMA_BIT_MASK(32),
711 .platform_data = &qcrypto_ce_hw_suppport,
712 },
713};
714#endif
715
716#if defined(CONFIG_CRYPTO_DEV_QCEDEV) || \
717 defined(CONFIG_CRYPTO_DEV_QCEDEV_MODULE)
718
719static struct msm_ce_hw_support qcedev_ce_hw_suppport = {
720 .ce_shared = QCE_CE_SHARED,
721 .shared_ce_resource = QCE_SHARE_CE_RESOURCE,
722 .hw_key_support = QCE_HW_KEY_SUPPORT,
723 .sha_hmac = QCE_SHA_HMAC_SUPPORT,
Ramesh Masavarapu49259682011-12-02 14:00:18 -0800724 .bus_scale_table = NULL,
Ramesh Masavarapuaa28b5b2011-10-21 10:26:03 -0700725};
726
727struct platform_device msm9615_qcedev_device = {
728 .name = "qce",
729 .id = 0,
730 .num_resources = ARRAY_SIZE(qcedev_resources),
731 .resource = qcedev_resources,
732 .dev = {
733 .coherent_dma_mask = DMA_BIT_MASK(32),
734 .platform_data = &qcedev_ce_hw_suppport,
735 },
736};
737#endif
738
Krishna Kondadd794462011-10-01 00:19:29 -0700739#define MSM_SDC1_BASE 0x12180000
740#define MSM_SDC1_DML_BASE (MSM_SDC1_BASE + 0x800)
741#define MSM_SDC1_BAM_BASE (MSM_SDC1_BASE + 0x2000)
Krishna Konda71aef182011-10-01 02:27:51 -0700742#define MSM_SDC2_BASE 0x12140000
743#define MSM_SDC2_DML_BASE (MSM_SDC2_BASE + 0x800)
744#define MSM_SDC2_BAM_BASE (MSM_SDC2_BASE + 0x2000)
Krishna Kondadd794462011-10-01 00:19:29 -0700745
746static struct resource resources_sdc1[] = {
747 {
748 .name = "core_mem",
749 .flags = IORESOURCE_MEM,
750 .start = MSM_SDC1_BASE,
751 .end = MSM_SDC1_DML_BASE - 1,
752 },
753 {
754 .name = "core_irq",
755 .flags = IORESOURCE_IRQ,
756 .start = SDC1_IRQ_0,
757 .end = SDC1_IRQ_0
758 },
759#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
760 {
761 .name = "sdcc_dml_addr",
762 .start = MSM_SDC1_DML_BASE,
763 .end = MSM_SDC1_BAM_BASE - 1,
764 .flags = IORESOURCE_MEM,
765 },
766 {
767 .name = "sdcc_bam_addr",
768 .start = MSM_SDC1_BAM_BASE,
769 .end = MSM_SDC1_BAM_BASE + (2 * SZ_4K) - 1,
770 .flags = IORESOURCE_MEM,
771 },
772 {
773 .name = "sdcc_bam_irq",
774 .start = SDC1_BAM_IRQ,
775 .end = SDC1_BAM_IRQ,
776 .flags = IORESOURCE_IRQ,
777 },
778#endif
779};
780
Krishna Konda71aef182011-10-01 02:27:51 -0700781static struct resource resources_sdc2[] = {
782 {
783 .name = "core_mem",
784 .flags = IORESOURCE_MEM,
785 .start = MSM_SDC2_BASE,
786 .end = MSM_SDC2_DML_BASE - 1,
787 },
788 {
789 .name = "core_irq",
790 .flags = IORESOURCE_IRQ,
791 .start = SDC2_IRQ_0,
792 .end = SDC2_IRQ_0
793 },
794#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
795 {
796 .name = "sdcc_dml_addr",
797 .start = MSM_SDC2_DML_BASE,
798 .end = MSM_SDC2_BAM_BASE - 1,
799 .flags = IORESOURCE_MEM,
800 },
801 {
802 .name = "sdcc_bam_addr",
803 .start = MSM_SDC2_BAM_BASE,
804 .end = MSM_SDC2_BAM_BASE + (2 * SZ_4K) - 1,
805 .flags = IORESOURCE_MEM,
806 },
807 {
808 .name = "sdcc_bam_irq",
809 .start = SDC2_BAM_IRQ,
810 .end = SDC2_BAM_IRQ,
811 .flags = IORESOURCE_IRQ,
812 },
813#endif
814};
815
Krishna Kondadd794462011-10-01 00:19:29 -0700816struct platform_device msm_device_sdc1 = {
817 .name = "msm_sdcc",
818 .id = 1,
819 .num_resources = ARRAY_SIZE(resources_sdc1),
820 .resource = resources_sdc1,
821 .dev = {
822 .coherent_dma_mask = 0xffffffff,
823 },
824};
825
Krishna Konda71aef182011-10-01 02:27:51 -0700826struct platform_device msm_device_sdc2 = {
827 .name = "msm_sdcc",
828 .id = 2,
829 .num_resources = ARRAY_SIZE(resources_sdc2),
830 .resource = resources_sdc2,
831 .dev = {
832 .coherent_dma_mask = 0xffffffff,
833 },
834};
835
Krishna Kondadd794462011-10-01 00:19:29 -0700836static struct platform_device *msm_sdcc_devices[] __initdata = {
837 &msm_device_sdc1,
Krishna Konda71aef182011-10-01 02:27:51 -0700838 &msm_device_sdc2,
Krishna Kondadd794462011-10-01 00:19:29 -0700839};
840
841int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
842{
843 struct platform_device *pdev;
844
845 if (controller < 1 || controller > 2)
846 return -EINVAL;
847
848 pdev = msm_sdcc_devices[controller - 1];
849 pdev->dev.platform_data = plat;
850 return platform_device_register(pdev);
851}
852
Zhang Chang Kenc2f2bcc2012-03-30 18:32:02 -0400853#ifdef CONFIG_FB_MSM_EBI2
854static struct resource msm_ebi2_lcdc_resources[] = {
855 {
856 .name = "base",
857 .start = 0x1B300000,
858 .end = 0x1B300000 + PAGE_SIZE - 1,
859 .flags = IORESOURCE_MEM,
860 },
861 {
862 .name = "lcd01",
863 .start = 0x1FC00000,
864 .end = 0x1FC00000 + 0x80000 - 1,
865 .flags = IORESOURCE_MEM,
866 },
867};
868
869struct platform_device msm_ebi2_lcdc_device = {
870 .name = "ebi2_lcd",
871 .id = 0,
872 .num_resources = ARRAY_SIZE(msm_ebi2_lcdc_resources),
873 .resource = msm_ebi2_lcdc_resources,
874};
875#endif
876
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700877#ifdef CONFIG_CACHE_L2X0
878static int __init l2x0_cache_init(void)
879{
880 int aux_ctrl = 0;
881
882 /* Way Size 010(0x2) 32KB */
883 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
884 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
885 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
886
887 /* L2 Latency setting required by hardware. Default is 0x20
888 which is no good.
889 */
890 writel_relaxed(0x220, MSM_L2CC_BASE + L2X0_DATA_LATENCY_CTRL);
891 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
892
893 return 0;
894}
895#else
896static int __init l2x0_cache_init(void){ return 0; }
897#endif
898
Praveen Chidambaram78499012011-11-01 17:15:17 -0600899struct msm_rpm_platform_data msm9615_rpm_data __initdata = {
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600900 .reg_base_addrs = {
901 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
902 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
903 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
904 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
905 },
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600906 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
Stephen Boydf61255e2012-02-24 14:31:09 -0800907 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
Praveen Chidambaram78499012011-11-01 17:15:17 -0600908 .ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
909 .ipc_rpm_val = 4,
910 .target_id = {
911 MSM_RPM_MAP(9615, NOTIFICATION_CONFIGURED_0, NOTIFICATION, 4),
912 MSM_RPM_MAP(9615, NOTIFICATION_REGISTERED_0, NOTIFICATION, 4),
913 MSM_RPM_MAP(9615, INVALIDATE_0, INVALIDATE, 8),
914 MSM_RPM_MAP(9615, TRIGGER_TIMED_TO, TRIGGER_TIMED, 1),
915 MSM_RPM_MAP(9615, TRIGGER_TIMED_SCLK_COUNT, TRIGGER_TIMED, 1),
916 MSM_RPM_MAP(9615, RPM_CTL, RPM_CTL, 1),
917 MSM_RPM_MAP(9615, CXO_CLK, CXO_CLK, 1),
918 MSM_RPM_MAP(9615, SYSTEM_FABRIC_CLK, SYSTEM_FABRIC_CLK, 1),
919 MSM_RPM_MAP(9615, DAYTONA_FABRIC_CLK, DAYTONA_FABRIC_CLK, 1),
920 MSM_RPM_MAP(9615, SFPB_CLK, SFPB_CLK, 1),
921 MSM_RPM_MAP(9615, CFPB_CLK, CFPB_CLK, 1),
922 MSM_RPM_MAP(9615, EBI1_CLK, EBI1_CLK, 1),
923 MSM_RPM_MAP(9615, SYS_FABRIC_CFG_HALT_0,
924 SYS_FABRIC_CFG_HALT, 2),
925 MSM_RPM_MAP(9615, SYS_FABRIC_CFG_CLKMOD_0,
926 SYS_FABRIC_CFG_CLKMOD, 3),
927 MSM_RPM_MAP(9615, SYS_FABRIC_CFG_IOCTL,
928 SYS_FABRIC_CFG_IOCTL, 1),
929 MSM_RPM_MAP(9615, SYSTEM_FABRIC_ARB_0,
930 SYSTEM_FABRIC_ARB, 27),
931 MSM_RPM_MAP(9615, PM8018_S1_0, PM8018_S1, 2),
932 MSM_RPM_MAP(9615, PM8018_S2_0, PM8018_S2, 2),
933 MSM_RPM_MAP(9615, PM8018_S3_0, PM8018_S3, 2),
934 MSM_RPM_MAP(9615, PM8018_S4_0, PM8018_S4, 2),
935 MSM_RPM_MAP(9615, PM8018_S5_0, PM8018_S5, 2),
936 MSM_RPM_MAP(9615, PM8018_L1_0, PM8018_L1, 2),
937 MSM_RPM_MAP(9615, PM8018_L2_0, PM8018_L2, 2),
938 MSM_RPM_MAP(9615, PM8018_L3_0, PM8018_L3, 2),
939 MSM_RPM_MAP(9615, PM8018_L4_0, PM8018_L4, 2),
940 MSM_RPM_MAP(9615, PM8018_L5_0, PM8018_L5, 2),
941 MSM_RPM_MAP(9615, PM8018_L6_0, PM8018_L6, 2),
942 MSM_RPM_MAP(9615, PM8018_L7_0, PM8018_L7, 2),
943 MSM_RPM_MAP(9615, PM8018_L8_0, PM8018_L8, 2),
944 MSM_RPM_MAP(9615, PM8018_L9_0, PM8018_L9, 2),
945 MSM_RPM_MAP(9615, PM8018_L10_0, PM8018_L10, 2),
946 MSM_RPM_MAP(9615, PM8018_L11_0, PM8018_L11, 2),
947 MSM_RPM_MAP(9615, PM8018_L12_0, PM8018_L12, 2),
948 MSM_RPM_MAP(9615, PM8018_L13_0, PM8018_L13, 2),
949 MSM_RPM_MAP(9615, PM8018_L14_0, PM8018_L14, 2),
950 MSM_RPM_MAP(9615, PM8018_LVS1, PM8018_LVS1, 1),
951 MSM_RPM_MAP(9615, NCP_0, NCP, 2),
952 MSM_RPM_MAP(9615, CXO_BUFFERS, CXO_BUFFERS, 1),
953 MSM_RPM_MAP(9615, USB_OTG_SWITCH, USB_OTG_SWITCH, 1),
954 MSM_RPM_MAP(9615, HDMI_SWITCH, HDMI_SWITCH, 1),
955 },
956 .target_status = {
957 MSM_RPM_STATUS_ID_MAP(9615, VERSION_MAJOR),
958 MSM_RPM_STATUS_ID_MAP(9615, VERSION_MINOR),
959 MSM_RPM_STATUS_ID_MAP(9615, VERSION_BUILD),
960 MSM_RPM_STATUS_ID_MAP(9615, SUPPORTED_RESOURCES_0),
961 MSM_RPM_STATUS_ID_MAP(9615, SUPPORTED_RESOURCES_1),
962 MSM_RPM_STATUS_ID_MAP(9615, SUPPORTED_RESOURCES_2),
963 MSM_RPM_STATUS_ID_MAP(9615, RESERVED_SUPPORTED_RESOURCES_0),
964 MSM_RPM_STATUS_ID_MAP(9615, SEQUENCE),
965 MSM_RPM_STATUS_ID_MAP(9615, RPM_CTL),
966 MSM_RPM_STATUS_ID_MAP(9615, CXO_CLK),
967 MSM_RPM_STATUS_ID_MAP(9615, SYSTEM_FABRIC_CLK),
968 MSM_RPM_STATUS_ID_MAP(9615, DAYTONA_FABRIC_CLK),
969 MSM_RPM_STATUS_ID_MAP(9615, SFPB_CLK),
970 MSM_RPM_STATUS_ID_MAP(9615, CFPB_CLK),
971 MSM_RPM_STATUS_ID_MAP(9615, EBI1_CLK),
972 MSM_RPM_STATUS_ID_MAP(9615, SYS_FABRIC_CFG_HALT),
973 MSM_RPM_STATUS_ID_MAP(9615, SYS_FABRIC_CFG_CLKMOD),
974 MSM_RPM_STATUS_ID_MAP(9615, SYS_FABRIC_CFG_IOCTL),
975 MSM_RPM_STATUS_ID_MAP(9615, SYSTEM_FABRIC_ARB),
976 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S1_0),
977 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S1_1),
978 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S2_0),
979 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S2_1),
980 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S3_0),
981 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S3_1),
982 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S4_0),
983 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S4_1),
984 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S5_0),
985 MSM_RPM_STATUS_ID_MAP(9615, PM8018_S5_1),
986 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L1_0),
987 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L1_1),
988 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L2_0),
989 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L2_1),
990 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L3_0),
991 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L3_1),
992 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L4_0),
993 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L4_1),
994 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L5_0),
995 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L5_1),
996 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L6_0),
997 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L6_1),
998 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L7_0),
999 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L7_1),
1000 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L8_0),
1001 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L8_1),
1002 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L9_0),
1003 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L9_1),
1004 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L10_0),
1005 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L10_1),
1006 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L11_0),
1007 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L11_1),
1008 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L12_0),
1009 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L12_1),
1010 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L13_0),
1011 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L13_1),
1012 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L14_0),
1013 MSM_RPM_STATUS_ID_MAP(9615, PM8018_L14_1),
1014 MSM_RPM_STATUS_ID_MAP(9615, PM8018_LVS1),
1015 MSM_RPM_STATUS_ID_MAP(9615, NCP_0),
1016 MSM_RPM_STATUS_ID_MAP(9615, NCP_1),
1017 MSM_RPM_STATUS_ID_MAP(9615, CXO_BUFFERS),
1018 MSM_RPM_STATUS_ID_MAP(9615, USB_OTG_SWITCH),
1019 MSM_RPM_STATUS_ID_MAP(9615, HDMI_SWITCH),
1020 },
1021 .target_ctrl_id = {
1022 MSM_RPM_CTRL_MAP(9615, VERSION_MAJOR),
1023 MSM_RPM_CTRL_MAP(9615, VERSION_MINOR),
1024 MSM_RPM_CTRL_MAP(9615, VERSION_BUILD),
1025 MSM_RPM_CTRL_MAP(9615, REQ_CTX_0),
1026 MSM_RPM_CTRL_MAP(9615, REQ_SEL_0),
1027 MSM_RPM_CTRL_MAP(9615, ACK_CTX_0),
1028 MSM_RPM_CTRL_MAP(9615, ACK_SEL_0),
1029 },
1030 .sel_invalidate = MSM_RPM_9615_SEL_INVALIDATE,
1031 .sel_notification = MSM_RPM_9615_SEL_NOTIFICATION,
1032 .sel_last = MSM_RPM_9615_SEL_LAST,
1033 .ver = {3, 0, 0},
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001034};
1035
Praveen Chidambaram78499012011-11-01 17:15:17 -06001036struct platform_device msm9615_rpm_device = {
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001037 .name = "msm_rpm",
1038 .id = -1,
1039};
1040
Praveen Chidambaram78499012011-11-01 17:15:17 -06001041static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] __initdata = {
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -06001042 [4] = MSM_GPIO_TO_INT(30),
1043 [5] = MSM_GPIO_TO_INT(59),
1044 [6] = MSM_GPIO_TO_INT(81),
1045 [7] = MSM_GPIO_TO_INT(87),
1046 [8] = MSM_GPIO_TO_INT(86),
1047 [9] = MSM_GPIO_TO_INT(2),
1048 [10] = MSM_GPIO_TO_INT(6),
1049 [11] = MSM_GPIO_TO_INT(10),
1050 [12] = MSM_GPIO_TO_INT(14),
1051 [13] = MSM_GPIO_TO_INT(18),
1052 [14] = MSM_GPIO_TO_INT(7),
1053 [15] = MSM_GPIO_TO_INT(11),
1054 [16] = MSM_GPIO_TO_INT(15),
1055 [19] = MSM_GPIO_TO_INT(26),
1056 [20] = MSM_GPIO_TO_INT(28),
Ofir Cohendca06cb2012-03-08 16:37:45 +02001057 [22] = USB_HSIC_IRQ,
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -06001058 [23] = MSM_GPIO_TO_INT(19),
1059 [24] = MSM_GPIO_TO_INT(23),
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -06001060 [26] = MSM_GPIO_TO_INT(3),
1061 [27] = MSM_GPIO_TO_INT(68),
1062 [29] = MSM_GPIO_TO_INT(78),
1063 [31] = MSM_GPIO_TO_INT(0),
1064 [32] = MSM_GPIO_TO_INT(4),
1065 [33] = MSM_GPIO_TO_INT(22),
1066 [34] = MSM_GPIO_TO_INT(17),
1067 [37] = MSM_GPIO_TO_INT(20),
1068 [39] = MSM_GPIO_TO_INT(84),
Mahesh Sivasubramanian4ce82182012-01-04 14:34:42 -07001069 [40] = USB1_HS_IRQ,
Maheshkumar Sivasubramanian97450832011-10-31 12:27:25 -06001070 [42] = MSM_GPIO_TO_INT(24),
1071 [43] = MSM_GPIO_TO_INT(79),
1072 [44] = MSM_GPIO_TO_INT(80),
1073 [45] = MSM_GPIO_TO_INT(82),
1074 [46] = MSM_GPIO_TO_INT(85),
1075 [47] = MSM_GPIO_TO_INT(45),
1076 [48] = MSM_GPIO_TO_INT(50),
1077 [49] = MSM_GPIO_TO_INT(51),
1078 [50] = MSM_GPIO_TO_INT(69),
1079 [51] = MSM_GPIO_TO_INT(77),
1080 [52] = MSM_GPIO_TO_INT(1),
1081 [53] = MSM_GPIO_TO_INT(5),
1082 [54] = MSM_GPIO_TO_INT(40),
1083 [55] = MSM_GPIO_TO_INT(27),
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001084};
1085
Praveen Chidambaram78499012011-11-01 17:15:17 -06001086static uint16_t msm_mpm_bypassed_apps_irqs[] __initdata = {
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001087 TLMM_MSM_SUMMARY_IRQ,
1088 RPM_APCC_CPU0_GP_HIGH_IRQ,
1089 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
1090 RPM_APCC_CPU0_GP_LOW_IRQ,
1091 RPM_APCC_CPU0_WAKE_UP_IRQ,
Mahesh Sivasubramaniandbf2bb62011-12-12 16:03:40 -07001092 MSS_TO_APPS_IRQ_0,
1093 MSS_TO_APPS_IRQ_1,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001094 LPASS_SCSS_GP_LOW_IRQ,
1095 LPASS_SCSS_GP_MEDIUM_IRQ,
1096 LPASS_SCSS_GP_HIGH_IRQ,
1097 SPS_MTI_31,
Mahesh Sivasubramaniandbf2bb62011-12-12 16:03:40 -07001098 A2_BAM_IRQ,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001099};
1100
Praveen Chidambaram78499012011-11-01 17:15:17 -06001101struct msm_mpm_device_data msm9615_mpm_dev_data __initdata = {
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001102 .irqs_m2a = msm_mpm_irqs_m2a,
1103 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
1104 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
1105 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
1106 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
1107 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
1108 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
1109 .mpm_apps_ipc_val = BIT(1),
1110 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -06001111};
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001112
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -06001113static uint8_t spm_wfi_cmd_sequence[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -06001114 0x00, 0x03, 0x00, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -06001115};
1116
1117static uint8_t spm_power_collapse_without_rpm[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -06001118 0x34, 0x24, 0x14, 0x04,
1119 0x54, 0x03, 0x54, 0x04,
1120 0x14, 0x24, 0x3e, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -06001121};
1122
1123static uint8_t spm_power_collapse_with_rpm[] __initdata = {
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -06001124 0x34, 0x24, 0x14, 0x04,
1125 0x54, 0x07, 0x54, 0x04,
1126 0x14, 0x24, 0x3e, 0x0f,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -06001127};
1128
1129static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
1130 [0] = {
1131 .mode = MSM_SPM_MODE_CLOCK_GATING,
1132 .notify_rpm = false,
1133 .cmd = spm_wfi_cmd_sequence,
1134 },
1135 [1] = {
1136 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1137 .notify_rpm = false,
1138 .cmd = spm_power_collapse_without_rpm,
1139 },
1140 [2] = {
1141 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
1142 .notify_rpm = true,
1143 .cmd = spm_power_collapse_with_rpm,
1144 },
1145};
1146
1147static struct msm_spm_platform_data msm_spm_data[] __initdata = {
1148 [0] = {
1149 .reg_base_addr = MSM_SAW0_BASE,
1150 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
Maheshkumar Sivasubramanian343c9912011-10-17 11:00:33 -06001151 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1001,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -06001152 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
1153 .modes = msm_spm_seq_list,
1154 },
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001155};
1156
1157static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
1158 {
1159 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
1160 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1161 true,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -06001162 100, 8000, 100000, 1,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001163 },
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001164 {
1165 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
1166 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1167 true,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -06001168 2000, 5000, 60100000, 3000,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001169 },
1170 {
1171 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1172 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
1173 false,
Maheshkumar Sivasubramanian634e4f62011-10-17 15:49:11 -06001174 6300, 5000, 60350000, 3500,
1175 },
1176 {
1177 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1178 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, MAX, ACTIVE),
1179 false,
1180 13300, 2000, 71850000, 6800,
1181 },
1182 {
1183 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
1184 MSM_RPMRS_LIMITS(OFF, HSFS_OPEN, RET_HIGH, RET_LOW),
1185 false,
1186 28300, 0, 76350000, 9800,
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -06001187 },
1188};
1189
Praveen Chidambaram78499012011-11-01 17:15:17 -06001190static struct msm_rpmrs_platform_data msm_rpmrs_data __initdata = {
1191 .levels = &msm_rpmrs_levels[0],
1192 .num_levels = ARRAY_SIZE(msm_rpmrs_levels),
1193 .vdd_mem_levels = {
1194 [MSM_RPMRS_VDD_MEM_RET_LOW] = 750000,
1195 [MSM_RPMRS_VDD_MEM_RET_HIGH] = 750000,
1196 [MSM_RPMRS_VDD_MEM_ACTIVE] = 1050000,
1197 [MSM_RPMRS_VDD_MEM_MAX] = 1150000,
1198 },
1199 .vdd_dig_levels = {
1200 [MSM_RPMRS_VDD_DIG_RET_LOW] = 500000,
1201 [MSM_RPMRS_VDD_DIG_RET_HIGH] = 750000,
1202 [MSM_RPMRS_VDD_DIG_ACTIVE] = 950000,
1203 [MSM_RPMRS_VDD_DIG_MAX] = 1150000,
1204 },
1205 .vdd_mask = 0x7FFFFF,
1206 .rpmrs_target_id = {
1207 [MSM_RPMRS_ID_PXO_CLK] = MSM_RPM_ID_CXO_CLK,
1208 [MSM_RPMRS_ID_L2_CACHE_CTL] = MSM_RPM_ID_LAST,
1209 [MSM_RPMRS_ID_VDD_DIG_0] = MSM_RPM_ID_PM8018_S1_0,
1210 [MSM_RPMRS_ID_VDD_DIG_1] = MSM_RPM_ID_PM8018_S1_1,
1211 [MSM_RPMRS_ID_VDD_MEM_0] = MSM_RPM_ID_PM8018_L9_0,
1212 [MSM_RPMRS_ID_VDD_MEM_1] = MSM_RPM_ID_PM8018_L9_1,
1213 [MSM_RPMRS_ID_RPM_CTL] = MSM_RPM_ID_RPM_CTL,
1214 },
1215};
1216
1217static struct msm_rpmstats_platform_data msm_rpm_stat_pdata = {
1218 .phys_addr_base = 0x0010D204,
1219 .phys_size = SZ_8K,
1220};
1221
1222struct platform_device msm9615_rpm_stat_device = {
1223 .name = "msm_rpm_stat",
1224 .id = -1,
1225 .dev = {
1226 .platform_data = &msm_rpm_stat_pdata,
1227 },
1228};
1229
1230static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
1231 .phys_addr_base = 0x0010AC00,
1232 .reg_offsets = {
1233 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
1234 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
1235 },
1236 .phys_size = SZ_8K,
1237 .log_len = 4096, /* log's buffer length in bytes */
1238 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
1239};
1240
1241struct platform_device msm9615_rpm_log_device = {
1242 .name = "msm_rpm_log",
1243 .id = -1,
1244 .dev = {
1245 .platform_data = &msm_rpm_log_pdata,
1246 },
1247};
1248
Krishna Konda39f5b2c2012-03-14 12:55:22 -07001249uint32_t __init msm9615_rpm_get_swfi_latency(void)
1250{
1251 int i;
1252
1253 for (i = 0; i < ARRAY_SIZE(msm_rpmrs_levels); i++) {
1254 if (msm_rpmrs_levels[i].sleep_mode ==
1255 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT)
1256 return msm_rpmrs_levels[i].latency_us;
1257 }
1258 return 0;
1259}
1260
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001261void __init msm9615_device_init(void)
1262{
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -06001263 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Praveen Chidambaram78499012011-11-01 17:15:17 -06001264 BUG_ON(msm_rpm_init(&msm9615_rpm_data));
1265 BUG_ON(msm_rpmrs_levels_init(&msm_rpmrs_data));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001266}
1267
Jeff Hugo56b933a2011-09-28 14:42:05 -06001268#define MSM_SHARED_RAM_PHYS 0x40000000
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001269void __init msm9615_map_io(void)
1270{
Jeff Hugo56b933a2011-09-28 14:42:05 -06001271 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001272 msm_map_msm9615_io();
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -07001273 l2x0_cache_init();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -07001274 if (socinfo_init() < 0)
1275 pr_err("socinfo_init() failed!\n");
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001276}
1277
1278void __init msm9615_init_irq(void)
1279{
Praveen Chidambaram78499012011-11-01 17:15:17 -06001280 struct msm_mpm_device_data *data = NULL;
1281
1282#ifdef CONFIG_MSM_MPM
1283 data = &msm9615_mpm_dev_data;
1284#endif
1285
1286 msm_mpm_irq_extn_init(data);
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001287 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
1288 (void *)MSM_QGIC_CPU_BASE);
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001289}
Gagan Mac7a827642011-09-22 19:42:21 -06001290
1291struct platform_device msm_bus_9615_sys_fabric = {
1292 .name = "msm_bus_fabric",
1293 .id = MSM_BUS_FAB_SYSTEM,
1294};
1295
1296struct platform_device msm_bus_def_fab = {
1297 .name = "msm_bus_fabric",
1298 .id = MSM_BUS_FAB_DEFAULT,
1299};
Zhang Chang Kenc2f2bcc2012-03-30 18:32:02 -04001300
1301#ifdef CONFIG_FB_MSM_EBI2
1302static void __init msm_register_device(struct platform_device *pdev, void *data)
1303{
1304 int ret;
1305
1306 pdev->dev.platform_data = data;
1307
1308 ret = platform_device_register(pdev);
1309 if (ret)
1310 dev_err(&pdev->dev,
1311 "%s: platform_device_register() failed = %d\n",
1312 __func__, ret);
1313}
1314
1315void __init msm_fb_register_device(char *name, void *data)
1316{
1317 if (!strncmp(name, "ebi2", 4))
1318 msm_register_device(&msm_ebi2_lcdc_device, data);
1319 else
1320 pr_err("%s: unknown device! %s\n", __func__, name);
1321}
1322#endif