blob: 2e586c7e2d0208205cef1977470e3a01a614e089 [file] [log] [blame]
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -07001/* Copyright (c) 2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#include <linux/kernel.h>
15#include <linux/platform_device.h>
16#include <linux/irq.h>
17#include <linux/io.h>
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -070018#include <linux/msm_tsens.h>
Amit Blay5e4ec192011-10-20 09:16:54 +020019#include <linux/dma-mapping.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070020#include <asm/hardware/gic.h>
Sahitya Tummala38295432011-09-29 10:08:45 +053021#include <asm/mach/flash.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070022#include <mach/board.h>
23#include <mach/msm_iomap.h>
Amit Blay5e4ec192011-10-20 09:16:54 +020024#include <mach/msm_hsusb.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070025#include <mach/irqs.h>
26#include <mach/socinfo.h>
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -060027#include <mach/rpm.h>
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -070028#include <asm/hardware/cache-l2x0.h>
Yan He092b7272011-09-21 15:25:03 -070029#include <mach/msm_sps.h>
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070030#include <mach/dma.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070031#include "devices.h"
Matt Wagantall44f672e2011-09-07 20:31:16 -070032#include "acpuclock.h"
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -060033#include "mpm.h"
34#include "spm.h"
35#include "pm.h"
36#include "rpm_resources.h"
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070037
Harini Jayaramaneba52672011-09-08 15:13:00 -060038/* Address of GSBI blocks */
39#define MSM_GSBI1_PHYS 0x16000000
40#define MSM_GSBI2_PHYS 0x16100000
41#define MSM_GSBI3_PHYS 0x16200000
Rohit Vaswani09666872011-08-23 17:41:54 -070042#define MSM_GSBI4_PHYS 0x16300000
Harini Jayaramaneba52672011-09-08 15:13:00 -060043#define MSM_GSBI5_PHYS 0x16400000
44
Rohit Vaswani09666872011-08-23 17:41:54 -070045#define MSM_UART4DM_PHYS (MSM_GSBI4_PHYS + 0x40000)
46
Harini Jayaramaneba52672011-09-08 15:13:00 -060047/* GSBI QUP devices */
48#define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000)
49#define MSM_GSBI2_QUP_PHYS (MSM_GSBI2_PHYS + 0x80000)
50#define MSM_GSBI3_QUP_PHYS (MSM_GSBI3_PHYS + 0x80000)
51#define MSM_GSBI4_QUP_PHYS (MSM_GSBI4_PHYS + 0x80000)
52#define MSM_GSBI5_QUP_PHYS (MSM_GSBI5_PHYS + 0x80000)
53#define MSM_QUP_SIZE SZ_4K
54
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070055/* Address of SSBI CMD */
56#define MSM_PMIC1_SSBI_CMD_PHYS 0x00500000
57#define MSM_PMIC_SSBI_SIZE SZ_4K
58
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070059static struct resource msm_dmov_resource[] = {
60 {
61 .start = ADM_0_SCSS_1_IRQ,
62 .end = (resource_size_t)MSM_DMOV_BASE,
63 .flags = IORESOURCE_IRQ,
64 },
65};
66
67struct platform_device msm9615_device_dmov = {
68 .name = "msm_dmov",
69 .id = -1,
70 .resource = msm_dmov_resource,
71 .num_resources = ARRAY_SIZE(msm_dmov_resource),
72};
73
Amit Blay5e4ec192011-10-20 09:16:54 +020074static struct resource resources_otg[] = {
75 {
76 .start = MSM9615_HSUSB_PHYS,
77 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_SIZE - 1,
78 .flags = IORESOURCE_MEM,
79 },
80 {
81 .start = USB1_HS_IRQ,
82 .end = USB1_HS_IRQ,
83 .flags = IORESOURCE_IRQ,
84 },
85};
86
87struct platform_device msm_device_otg = {
88 .name = "msm_otg",
89 .id = -1,
90 .num_resources = ARRAY_SIZE(resources_otg),
91 .resource = resources_otg,
92 .dev = {
93 .coherent_dma_mask = DMA_BIT_MASK(32),
94 },
95};
96
97static struct resource resources_hsusb[] = {
98 {
99 .start = MSM9615_HSUSB_PHYS,
100 .end = MSM9615_HSUSB_PHYS + MSM9615_HSUSB_SIZE - 1,
101 .flags = IORESOURCE_MEM,
102 },
103 {
104 .start = USB1_HS_IRQ,
105 .end = USB1_HS_IRQ,
106 .flags = IORESOURCE_IRQ,
107 },
108};
109
110struct platform_device msm_device_gadget_peripheral = {
111 .name = "msm_hsusb",
112 .id = -1,
113 .num_resources = ARRAY_SIZE(resources_hsusb),
114 .resource = resources_hsusb,
115 .dev = {
116 .coherent_dma_mask = DMA_BIT_MASK(32),
117 },
118};
119
Rohit Vaswani09666872011-08-23 17:41:54 -0700120static struct resource resources_uart_gsbi4[] = {
121 {
122 .start = GSBI4_UARTDM_IRQ,
123 .end = GSBI4_UARTDM_IRQ,
124 .flags = IORESOURCE_IRQ,
125 },
126 {
127 .start = MSM_UART4DM_PHYS,
128 .end = MSM_UART4DM_PHYS + PAGE_SIZE - 1,
129 .name = "uartdm_resource",
130 .flags = IORESOURCE_MEM,
131 },
132 {
133 .start = MSM_GSBI4_PHYS,
134 .end = MSM_GSBI4_PHYS + PAGE_SIZE - 1,
135 .name = "gsbi_resource",
136 .flags = IORESOURCE_MEM,
137 },
138};
139
140struct platform_device msm9615_device_uart_gsbi4 = {
141 .name = "msm_serial_hsl",
142 .id = 0,
143 .num_resources = ARRAY_SIZE(resources_uart_gsbi4),
144 .resource = resources_uart_gsbi4,
145};
146
Harini Jayaramaneba52672011-09-08 15:13:00 -0600147static struct resource resources_qup_i2c_gsbi5[] = {
148 {
149 .name = "gsbi_qup_i2c_addr",
150 .start = MSM_GSBI5_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600151 .end = MSM_GSBI5_PHYS + 4 - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600152 .flags = IORESOURCE_MEM,
153 },
154 {
155 .name = "qup_phys_addr",
156 .start = MSM_GSBI5_QUP_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600157 .end = MSM_GSBI5_QUP_PHYS + MSM_QUP_SIZE - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600158 .flags = IORESOURCE_MEM,
159 },
160 {
161 .name = "qup_err_intr",
162 .start = GSBI5_QUP_IRQ,
163 .end = GSBI5_QUP_IRQ,
164 .flags = IORESOURCE_IRQ,
165 },
166};
167
168struct platform_device msm9615_device_qup_i2c_gsbi5 = {
169 .name = "qup_i2c",
170 .id = 0,
171 .num_resources = ARRAY_SIZE(resources_qup_i2c_gsbi5),
172 .resource = resources_qup_i2c_gsbi5,
173};
174
Harini Jayaraman738c9312011-09-08 15:22:38 -0600175static struct resource resources_qup_spi_gsbi3[] = {
176 {
177 .name = "spi_base",
178 .start = MSM_GSBI3_QUP_PHYS,
179 .end = MSM_GSBI3_QUP_PHYS + SZ_4K - 1,
180 .flags = IORESOURCE_MEM,
181 },
182 {
183 .name = "gsbi_base",
184 .start = MSM_GSBI3_PHYS,
185 .end = MSM_GSBI3_PHYS + 4 - 1,
186 .flags = IORESOURCE_MEM,
187 },
188 {
189 .name = "spi_irq_in",
190 .start = GSBI3_QUP_IRQ,
191 .end = GSBI3_QUP_IRQ,
192 .flags = IORESOURCE_IRQ,
193 },
194};
195
196struct platform_device msm9615_device_qup_spi_gsbi3 = {
197 .name = "spi_qsd",
198 .id = 0,
199 .num_resources = ARRAY_SIZE(resources_qup_spi_gsbi3),
200 .resource = resources_qup_spi_gsbi3,
201};
202
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700203static struct resource resources_ssbi_pmic1[] = {
204 {
205 .start = MSM_PMIC1_SSBI_CMD_PHYS,
206 .end = MSM_PMIC1_SSBI_CMD_PHYS + MSM_PMIC_SSBI_SIZE - 1,
207 .flags = IORESOURCE_MEM,
208 },
209};
210
211struct platform_device msm9615_device_ssbi_pmic1 = {
212 .name = "msm_ssbi",
213 .id = 0,
214 .resource = resources_ssbi_pmic1,
215 .num_resources = ARRAY_SIZE(resources_ssbi_pmic1),
216};
217
Yan He092b7272011-09-21 15:25:03 -0700218static struct resource resources_sps[] = {
219 {
220 .name = "pipe_mem",
221 .start = 0x12800000,
222 .end = 0x12800000 + 0x4000 - 1,
223 .flags = IORESOURCE_MEM,
224 },
225 {
226 .name = "bamdma_dma",
227 .start = 0x12240000,
228 .end = 0x12240000 + 0x1000 - 1,
229 .flags = IORESOURCE_MEM,
230 },
231 {
232 .name = "bamdma_bam",
233 .start = 0x12244000,
234 .end = 0x12244000 + 0x4000 - 1,
235 .flags = IORESOURCE_MEM,
236 },
237 {
238 .name = "bamdma_irq",
239 .start = SPS_BAM_DMA_IRQ,
240 .end = SPS_BAM_DMA_IRQ,
241 .flags = IORESOURCE_IRQ,
242 },
243};
244
245struct msm_sps_platform_data msm_sps_pdata = {
246 .bamdma_restricted_pipes = 0x06,
247};
248
249struct platform_device msm_device_sps = {
250 .name = "msm_sps",
251 .id = -1,
252 .num_resources = ARRAY_SIZE(resources_sps),
253 .resource = resources_sps,
254 .dev.platform_data = &msm_sps_pdata,
255};
256
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700257static struct tsens_platform_data msm_tsens_pdata = {
258 .slope = 910,
259 .tsens_factor = 1000,
260 .hw_type = MSM_9615,
261 .tsens_num_sensor = 5,
262};
263
Sahitya Tummala38295432011-09-29 10:08:45 +0530264struct platform_device msm9615_device_tsens = {
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700265 .name = "tsens8960-tm",
266 .id = -1,
Sahitya Tummala38295432011-09-29 10:08:45 +0530267 .dev = {
268 .platform_data = &msm_tsens_pdata,
269 },
270};
271
272#define MSM_NAND_PHYS 0x1B400000
273static struct resource resources_nand[] = {
274 [0] = {
275 .name = "msm_nand_dmac",
276 .start = DMOV_NAND_CHAN,
277 .end = DMOV_NAND_CHAN,
278 .flags = IORESOURCE_DMA,
279 },
280 [1] = {
281 .name = "msm_nand_phys",
282 .start = MSM_NAND_PHYS,
283 .end = MSM_NAND_PHYS + 0x7FF,
284 .flags = IORESOURCE_MEM,
285 },
286};
287
288struct flash_platform_data msm_nand_data = {
289 .parts = NULL,
290 .nr_parts = 0,
291};
292
293struct platform_device msm_device_nand = {
294 .name = "msm_nand",
295 .id = -1,
296 .num_resources = ARRAY_SIZE(resources_nand),
297 .resource = resources_nand,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700298 .dev = {
Sahitya Tummala38295432011-09-29 10:08:45 +0530299 .platform_data = &msm_nand_data,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700300 },
301};
302
Jeff Hugo56b933a2011-09-28 14:42:05 -0600303struct platform_device msm_device_smd = {
304 .name = "msm_smd",
305 .id = -1,
306};
307
Ramesh Masavarapu5ad37392011-10-10 10:44:10 -0700308#ifdef CONFIG_HW_RANDOM_MSM
309/* PRNG device */
310#define MSM_PRNG_PHYS 0x1A500000
311static struct resource rng_resources = {
312 .flags = IORESOURCE_MEM,
313 .start = MSM_PRNG_PHYS,
314 .end = MSM_PRNG_PHYS + SZ_512 - 1,
315};
316
317struct platform_device msm_device_rng = {
318 .name = "msm_rng",
319 .id = 0,
320 .num_resources = 1,
321 .resource = &rng_resources,
322};
323#endif
Krishna Kondadd794462011-10-01 00:19:29 -0700324
325#define MSM_SDC1_BASE 0x12180000
326#define MSM_SDC1_DML_BASE (MSM_SDC1_BASE + 0x800)
327#define MSM_SDC1_BAM_BASE (MSM_SDC1_BASE + 0x2000)
Krishna Konda71aef182011-10-01 02:27:51 -0700328#define MSM_SDC2_BASE 0x12140000
329#define MSM_SDC2_DML_BASE (MSM_SDC2_BASE + 0x800)
330#define MSM_SDC2_BAM_BASE (MSM_SDC2_BASE + 0x2000)
Krishna Kondadd794462011-10-01 00:19:29 -0700331
332static struct resource resources_sdc1[] = {
333 {
334 .name = "core_mem",
335 .flags = IORESOURCE_MEM,
336 .start = MSM_SDC1_BASE,
337 .end = MSM_SDC1_DML_BASE - 1,
338 },
339 {
340 .name = "core_irq",
341 .flags = IORESOURCE_IRQ,
342 .start = SDC1_IRQ_0,
343 .end = SDC1_IRQ_0
344 },
345#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
346 {
347 .name = "sdcc_dml_addr",
348 .start = MSM_SDC1_DML_BASE,
349 .end = MSM_SDC1_BAM_BASE - 1,
350 .flags = IORESOURCE_MEM,
351 },
352 {
353 .name = "sdcc_bam_addr",
354 .start = MSM_SDC1_BAM_BASE,
355 .end = MSM_SDC1_BAM_BASE + (2 * SZ_4K) - 1,
356 .flags = IORESOURCE_MEM,
357 },
358 {
359 .name = "sdcc_bam_irq",
360 .start = SDC1_BAM_IRQ,
361 .end = SDC1_BAM_IRQ,
362 .flags = IORESOURCE_IRQ,
363 },
364#endif
365};
366
Krishna Konda71aef182011-10-01 02:27:51 -0700367static struct resource resources_sdc2[] = {
368 {
369 .name = "core_mem",
370 .flags = IORESOURCE_MEM,
371 .start = MSM_SDC2_BASE,
372 .end = MSM_SDC2_DML_BASE - 1,
373 },
374 {
375 .name = "core_irq",
376 .flags = IORESOURCE_IRQ,
377 .start = SDC2_IRQ_0,
378 .end = SDC2_IRQ_0
379 },
380#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
381 {
382 .name = "sdcc_dml_addr",
383 .start = MSM_SDC2_DML_BASE,
384 .end = MSM_SDC2_BAM_BASE - 1,
385 .flags = IORESOURCE_MEM,
386 },
387 {
388 .name = "sdcc_bam_addr",
389 .start = MSM_SDC2_BAM_BASE,
390 .end = MSM_SDC2_BAM_BASE + (2 * SZ_4K) - 1,
391 .flags = IORESOURCE_MEM,
392 },
393 {
394 .name = "sdcc_bam_irq",
395 .start = SDC2_BAM_IRQ,
396 .end = SDC2_BAM_IRQ,
397 .flags = IORESOURCE_IRQ,
398 },
399#endif
400};
401
Krishna Kondadd794462011-10-01 00:19:29 -0700402struct platform_device msm_device_sdc1 = {
403 .name = "msm_sdcc",
404 .id = 1,
405 .num_resources = ARRAY_SIZE(resources_sdc1),
406 .resource = resources_sdc1,
407 .dev = {
408 .coherent_dma_mask = 0xffffffff,
409 },
410};
411
Krishna Konda71aef182011-10-01 02:27:51 -0700412struct platform_device msm_device_sdc2 = {
413 .name = "msm_sdcc",
414 .id = 2,
415 .num_resources = ARRAY_SIZE(resources_sdc2),
416 .resource = resources_sdc2,
417 .dev = {
418 .coherent_dma_mask = 0xffffffff,
419 },
420};
421
Krishna Kondadd794462011-10-01 00:19:29 -0700422static struct platform_device *msm_sdcc_devices[] __initdata = {
423 &msm_device_sdc1,
Krishna Konda71aef182011-10-01 02:27:51 -0700424 &msm_device_sdc2,
Krishna Kondadd794462011-10-01 00:19:29 -0700425};
426
427int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
428{
429 struct platform_device *pdev;
430
431 if (controller < 1 || controller > 2)
432 return -EINVAL;
433
434 pdev = msm_sdcc_devices[controller - 1];
435 pdev->dev.platform_data = plat;
436 return platform_device_register(pdev);
437}
438
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700439#ifdef CONFIG_CACHE_L2X0
440static int __init l2x0_cache_init(void)
441{
442 int aux_ctrl = 0;
443
444 /* Way Size 010(0x2) 32KB */
445 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
446 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
447 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
448
449 /* L2 Latency setting required by hardware. Default is 0x20
450 which is no good.
451 */
452 writel_relaxed(0x220, MSM_L2CC_BASE + L2X0_DATA_LATENCY_CTRL);
453 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
454
455 return 0;
456}
457#else
458static int __init l2x0_cache_init(void){ return 0; }
459#endif
460
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600461struct msm_rpm_map_data rpm_map_data[] __initdata = {
462 MSM_RPM_MAP(TRIGGER_TIMED_TO, TRIGGER_TIMED, 1),
463 MSM_RPM_MAP(TRIGGER_TIMED_SCLK_COUNT, TRIGGER_TIMED, 1),
464
465 MSM_RPM_MAP(RPM_CTL, RPM_CTL, 1),
466
467 MSM_RPM_MAP(CXO_CLK, CXO_CLK, 1),
468 MSM_RPM_MAP(SYSTEM_FABRIC_CLK, SYSTEM_FABRIC_CLK, 1),
469 MSM_RPM_MAP(DAYTONA_FABRIC_CLK, DAYTONA_FABRIC_CLK, 1),
470 MSM_RPM_MAP(SFPB_CLK, SFPB_CLK, 1),
471 MSM_RPM_MAP(CFPB_CLK, CFPB_CLK, 1),
472 MSM_RPM_MAP(EBI1_CLK, EBI1_CLK, 1),
473
474 MSM_RPM_MAP(SYS_FABRIC_CFG_HALT_0, SYS_FABRIC_CFG_HALT, 2),
475 MSM_RPM_MAP(SYS_FABRIC_CFG_CLKMOD_0, SYS_FABRIC_CFG_CLKMOD, 3),
476 MSM_RPM_MAP(SYS_FABRIC_CFG_IOCTL, SYS_FABRIC_CFG_IOCTL, 1),
477 MSM_RPM_MAP(SYSTEM_FABRIC_ARB_0, SYSTEM_FABRIC_ARB, 27),
478
479 MSM_RPM_MAP(PM8018_S1_0, PM8018_S1, 2),
480 MSM_RPM_MAP(PM8018_S2_0, PM8018_S2, 2),
481 MSM_RPM_MAP(PM8018_S3_0, PM8018_S3, 2),
482 MSM_RPM_MAP(PM8018_S4_0, PM8018_S4, 2),
483 MSM_RPM_MAP(PM8018_S5_0, PM8018_S5, 2),
484 MSM_RPM_MAP(PM8018_L1_0, PM8018_L1, 2),
485 MSM_RPM_MAP(PM8018_L2_0, PM8018_L2, 2),
486 MSM_RPM_MAP(PM8018_L3_0, PM8018_L3, 2),
487 MSM_RPM_MAP(PM8018_L4_0, PM8018_L4, 2),
488 MSM_RPM_MAP(PM8018_L5_0, PM8018_L5, 2),
489 MSM_RPM_MAP(PM8018_L6_0, PM8018_L6, 2),
490 MSM_RPM_MAP(PM8018_L7_0, PM8018_L7, 2),
491 MSM_RPM_MAP(PM8018_L8_0, PM8018_L8, 2),
492 MSM_RPM_MAP(PM8018_L9_0, PM8018_L9, 2),
493 MSM_RPM_MAP(PM8018_L10_0, PM8018_L10, 2),
494 MSM_RPM_MAP(PM8018_L11_0, PM8018_L11, 2),
495 MSM_RPM_MAP(PM8018_L12_0, PM8018_L12, 2),
496 MSM_RPM_MAP(PM8018_L13_0, PM8018_L13, 2),
497 MSM_RPM_MAP(PM8018_L14_0, PM8018_L14, 2),
498 MSM_RPM_MAP(PM8018_LVS1, PM8018_LVS1, 1),
499 MSM_RPM_MAP(NCP_0, NCP, 2),
500 MSM_RPM_MAP(CXO_BUFFERS, CXO_BUFFERS, 1),
501 MSM_RPM_MAP(USB_OTG_SWITCH, USB_OTG_SWITCH, 1),
502 MSM_RPM_MAP(HDMI_SWITCH, HDMI_SWITCH, 1),
503};
504unsigned int rpm_map_data_size = ARRAY_SIZE(rpm_map_data);
505
506static struct msm_rpm_platform_data msm_rpm_data = {
507 .reg_base_addrs = {
508 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
509 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
510 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
511 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
512 },
513
514 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
515 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
516 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
517 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
518 .msm_apps_ipc_rpm_val = 4,
519};
520
521struct platform_device msm_rpm_device = {
522 .name = "msm_rpm",
523 .id = -1,
524};
525
526static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] = {
527 [1] = MSM_GPIO_TO_INT(46),
528 [2] = MSM_GPIO_TO_INT(150),
529 [4] = MSM_GPIO_TO_INT(103),
530 [5] = MSM_GPIO_TO_INT(104),
531 [6] = MSM_GPIO_TO_INT(105),
532 [7] = MSM_GPIO_TO_INT(106),
533 [8] = MSM_GPIO_TO_INT(107),
534 [9] = MSM_GPIO_TO_INT(7),
535 [10] = MSM_GPIO_TO_INT(11),
536 [11] = MSM_GPIO_TO_INT(15),
537 [12] = MSM_GPIO_TO_INT(19),
538 [13] = MSM_GPIO_TO_INT(23),
539 [14] = MSM_GPIO_TO_INT(27),
540 [15] = MSM_GPIO_TO_INT(31),
541 [16] = MSM_GPIO_TO_INT(35),
542 [19] = MSM_GPIO_TO_INT(90),
543 [20] = MSM_GPIO_TO_INT(92),
544 [23] = MSM_GPIO_TO_INT(85),
545 [24] = MSM_GPIO_TO_INT(83),
546 [25] = USB1_HS_IRQ,
547 /*[27] = HDMI_IRQ,*/
548 [29] = MSM_GPIO_TO_INT(10),
549 [30] = MSM_GPIO_TO_INT(102),
550 [31] = MSM_GPIO_TO_INT(81),
551 [32] = MSM_GPIO_TO_INT(78),
552 [33] = MSM_GPIO_TO_INT(94),
553 [34] = MSM_GPIO_TO_INT(72),
554 [35] = MSM_GPIO_TO_INT(39),
555 [36] = MSM_GPIO_TO_INT(43),
556 [37] = MSM_GPIO_TO_INT(61),
557 [38] = MSM_GPIO_TO_INT(50),
558 [39] = MSM_GPIO_TO_INT(42),
559 [41] = MSM_GPIO_TO_INT(62),
560 [42] = MSM_GPIO_TO_INT(76),
561 [43] = MSM_GPIO_TO_INT(75),
562 [44] = MSM_GPIO_TO_INT(70),
563 [45] = MSM_GPIO_TO_INT(69),
564 [46] = MSM_GPIO_TO_INT(67),
565 [47] = MSM_GPIO_TO_INT(65),
566 [48] = MSM_GPIO_TO_INT(58),
567 [49] = MSM_GPIO_TO_INT(54),
568 [50] = MSM_GPIO_TO_INT(52),
569 [51] = MSM_GPIO_TO_INT(49),
570 [52] = MSM_GPIO_TO_INT(40),
571 [53] = MSM_GPIO_TO_INT(37),
572 [54] = MSM_GPIO_TO_INT(24),
573 [55] = MSM_GPIO_TO_INT(14),
574};
575
576static uint16_t msm_mpm_bypassed_apps_irqs[] = {
577 TLMM_MSM_SUMMARY_IRQ,
578 RPM_APCC_CPU0_GP_HIGH_IRQ,
579 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
580 RPM_APCC_CPU0_GP_LOW_IRQ,
581 RPM_APCC_CPU0_WAKE_UP_IRQ,
582 LPASS_SCSS_GP_LOW_IRQ,
583 LPASS_SCSS_GP_MEDIUM_IRQ,
584 LPASS_SCSS_GP_HIGH_IRQ,
585 SPS_MTI_31,
586};
587
588struct msm_mpm_device_data msm_mpm_dev_data = {
589 .irqs_m2a = msm_mpm_irqs_m2a,
590 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
591 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
592 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
593 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
594 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
595 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
596 .mpm_apps_ipc_val = BIT(1),
597 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600598};
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600599
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600600static uint8_t spm_wfi_cmd_sequence[] __initdata = {
601 0x00, 0x03, 0x0B, 0x00,
602 0x0f,
603};
604
605static uint8_t spm_power_collapse_without_rpm[] __initdata = {
606 0x30, 0x20, 0x10, 0x00,
607 0x50, 0x03, 0x50, 0x00,
608 0x10, 0x20, 0x30, 0x0f,
609};
610
611static uint8_t spm_power_collapse_with_rpm[] __initdata = {
612 0x30, 0x20, 0x10, 0x00,
613 0x50, 0x07, 0x50, 0x00,
614 0x10, 0x20, 0x30, 0x0f,
615};
616
617static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
618 [0] = {
619 .mode = MSM_SPM_MODE_CLOCK_GATING,
620 .notify_rpm = false,
621 .cmd = spm_wfi_cmd_sequence,
622 },
623 [1] = {
624 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
625 .notify_rpm = false,
626 .cmd = spm_power_collapse_without_rpm,
627 },
628 [2] = {
629 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
630 .notify_rpm = true,
631 .cmd = spm_power_collapse_with_rpm,
632 },
633};
634
635static struct msm_spm_platform_data msm_spm_data[] __initdata = {
636 [0] = {
637 .reg_base_addr = MSM_SAW0_BASE,
638 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
639 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
640 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
641 .modes = msm_spm_seq_list,
642 },
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600643};
644
645static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
646 {
647 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
648 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
649 true,
650 1, 8000, 100000, 1,
651 },
652
653 {
654 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
655 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
656 true,
657 1500, 5000, 60100000, 3000,
658 },
659 {
660 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
661 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
662 false,
663 2800, 5000, 60350000, 3500,
664 },
665};
666
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700667void __init msm9615_device_init(void)
668{
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600669 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Vikram Mulukutla489e39e2011-08-31 18:04:05 -0700670 msm_clock_init(&msm9615_clock_init_data);
Matt Wagantall44f672e2011-09-07 20:31:16 -0700671 acpuclk_init(&acpuclk_9615_soc_data);
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600672 BUG_ON(msm_rpm_init(&msm_rpm_data));
673 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
674 ARRAY_SIZE(msm_rpmrs_levels)));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700675}
676
Jeff Hugo56b933a2011-09-28 14:42:05 -0600677#define MSM_SHARED_RAM_PHYS 0x40000000
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700678void __init msm9615_map_io(void)
679{
Jeff Hugo56b933a2011-09-28 14:42:05 -0600680 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700681 msm_map_msm9615_io();
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700682 l2x0_cache_init();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700683 if (socinfo_init() < 0)
684 pr_err("socinfo_init() failed!\n");
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700685}
686
687void __init msm9615_init_irq(void)
688{
689 unsigned int i;
Rohit Vaswanib2e42e12011-10-07 21:25:53 -0700690
691 msm_mpm_irq_extn_init();
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700692 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
693 (void *)MSM_QGIC_CPU_BASE);
694
695 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
696 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
697
698 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
699 mb();
700
701 /*
702 * FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
703 * as they are configured as level, which does not play nice with
704 * handle_percpu_irq.
705 */
706 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
707 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
708 irq_set_handler(i, handle_percpu_irq);
709 }
710}