blob: 6c826dde28c0efa11811059652bab4036f2f3a31 [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>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070019#include <asm/hardware/gic.h>
Sahitya Tummala38295432011-09-29 10:08:45 +053020#include <asm/mach/flash.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070021#include <mach/board.h>
22#include <mach/msm_iomap.h>
23#include <mach/irqs.h>
24#include <mach/socinfo.h>
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -060025#include <mach/rpm.h>
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -070026#include <asm/hardware/cache-l2x0.h>
Yan He092b7272011-09-21 15:25:03 -070027#include <mach/msm_sps.h>
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070028#include <mach/dma.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070029#include "devices.h"
Matt Wagantall44f672e2011-09-07 20:31:16 -070030#include "acpuclock.h"
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -060031#include "mpm.h"
32#include "spm.h"
33#include "pm.h"
34#include "rpm_resources.h"
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070035
Harini Jayaramaneba52672011-09-08 15:13:00 -060036/* Address of GSBI blocks */
37#define MSM_GSBI1_PHYS 0x16000000
38#define MSM_GSBI2_PHYS 0x16100000
39#define MSM_GSBI3_PHYS 0x16200000
Rohit Vaswani09666872011-08-23 17:41:54 -070040#define MSM_GSBI4_PHYS 0x16300000
Harini Jayaramaneba52672011-09-08 15:13:00 -060041#define MSM_GSBI5_PHYS 0x16400000
42
Rohit Vaswani09666872011-08-23 17:41:54 -070043#define MSM_UART4DM_PHYS (MSM_GSBI4_PHYS + 0x40000)
44
Harini Jayaramaneba52672011-09-08 15:13:00 -060045/* GSBI QUP devices */
46#define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000)
47#define MSM_GSBI2_QUP_PHYS (MSM_GSBI2_PHYS + 0x80000)
48#define MSM_GSBI3_QUP_PHYS (MSM_GSBI3_PHYS + 0x80000)
49#define MSM_GSBI4_QUP_PHYS (MSM_GSBI4_PHYS + 0x80000)
50#define MSM_GSBI5_QUP_PHYS (MSM_GSBI5_PHYS + 0x80000)
51#define MSM_QUP_SIZE SZ_4K
52
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070053/* Address of SSBI CMD */
54#define MSM_PMIC1_SSBI_CMD_PHYS 0x00500000
55#define MSM_PMIC_SSBI_SIZE SZ_4K
56
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070057static struct resource msm_dmov_resource[] = {
58 {
59 .start = ADM_0_SCSS_1_IRQ,
60 .end = (resource_size_t)MSM_DMOV_BASE,
61 .flags = IORESOURCE_IRQ,
62 },
63};
64
65struct platform_device msm9615_device_dmov = {
66 .name = "msm_dmov",
67 .id = -1,
68 .resource = msm_dmov_resource,
69 .num_resources = ARRAY_SIZE(msm_dmov_resource),
70};
71
Rohit Vaswani09666872011-08-23 17:41:54 -070072static struct resource resources_uart_gsbi4[] = {
73 {
74 .start = GSBI4_UARTDM_IRQ,
75 .end = GSBI4_UARTDM_IRQ,
76 .flags = IORESOURCE_IRQ,
77 },
78 {
79 .start = MSM_UART4DM_PHYS,
80 .end = MSM_UART4DM_PHYS + PAGE_SIZE - 1,
81 .name = "uartdm_resource",
82 .flags = IORESOURCE_MEM,
83 },
84 {
85 .start = MSM_GSBI4_PHYS,
86 .end = MSM_GSBI4_PHYS + PAGE_SIZE - 1,
87 .name = "gsbi_resource",
88 .flags = IORESOURCE_MEM,
89 },
90};
91
92struct platform_device msm9615_device_uart_gsbi4 = {
93 .name = "msm_serial_hsl",
94 .id = 0,
95 .num_resources = ARRAY_SIZE(resources_uart_gsbi4),
96 .resource = resources_uart_gsbi4,
97};
98
Harini Jayaramaneba52672011-09-08 15:13:00 -060099static struct resource resources_qup_i2c_gsbi5[] = {
100 {
101 .name = "gsbi_qup_i2c_addr",
102 .start = MSM_GSBI5_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600103 .end = MSM_GSBI5_PHYS + 4 - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600104 .flags = IORESOURCE_MEM,
105 },
106 {
107 .name = "qup_phys_addr",
108 .start = MSM_GSBI5_QUP_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600109 .end = MSM_GSBI5_QUP_PHYS + MSM_QUP_SIZE - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600110 .flags = IORESOURCE_MEM,
111 },
112 {
113 .name = "qup_err_intr",
114 .start = GSBI5_QUP_IRQ,
115 .end = GSBI5_QUP_IRQ,
116 .flags = IORESOURCE_IRQ,
117 },
118};
119
120struct platform_device msm9615_device_qup_i2c_gsbi5 = {
121 .name = "qup_i2c",
122 .id = 0,
123 .num_resources = ARRAY_SIZE(resources_qup_i2c_gsbi5),
124 .resource = resources_qup_i2c_gsbi5,
125};
126
Harini Jayaraman738c9312011-09-08 15:22:38 -0600127static struct resource resources_qup_spi_gsbi3[] = {
128 {
129 .name = "spi_base",
130 .start = MSM_GSBI3_QUP_PHYS,
131 .end = MSM_GSBI3_QUP_PHYS + SZ_4K - 1,
132 .flags = IORESOURCE_MEM,
133 },
134 {
135 .name = "gsbi_base",
136 .start = MSM_GSBI3_PHYS,
137 .end = MSM_GSBI3_PHYS + 4 - 1,
138 .flags = IORESOURCE_MEM,
139 },
140 {
141 .name = "spi_irq_in",
142 .start = GSBI3_QUP_IRQ,
143 .end = GSBI3_QUP_IRQ,
144 .flags = IORESOURCE_IRQ,
145 },
146};
147
148struct platform_device msm9615_device_qup_spi_gsbi3 = {
149 .name = "spi_qsd",
150 .id = 0,
151 .num_resources = ARRAY_SIZE(resources_qup_spi_gsbi3),
152 .resource = resources_qup_spi_gsbi3,
153};
154
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700155static struct resource resources_ssbi_pmic1[] = {
156 {
157 .start = MSM_PMIC1_SSBI_CMD_PHYS,
158 .end = MSM_PMIC1_SSBI_CMD_PHYS + MSM_PMIC_SSBI_SIZE - 1,
159 .flags = IORESOURCE_MEM,
160 },
161};
162
163struct platform_device msm9615_device_ssbi_pmic1 = {
164 .name = "msm_ssbi",
165 .id = 0,
166 .resource = resources_ssbi_pmic1,
167 .num_resources = ARRAY_SIZE(resources_ssbi_pmic1),
168};
169
Yan He092b7272011-09-21 15:25:03 -0700170static struct resource resources_sps[] = {
171 {
172 .name = "pipe_mem",
173 .start = 0x12800000,
174 .end = 0x12800000 + 0x4000 - 1,
175 .flags = IORESOURCE_MEM,
176 },
177 {
178 .name = "bamdma_dma",
179 .start = 0x12240000,
180 .end = 0x12240000 + 0x1000 - 1,
181 .flags = IORESOURCE_MEM,
182 },
183 {
184 .name = "bamdma_bam",
185 .start = 0x12244000,
186 .end = 0x12244000 + 0x4000 - 1,
187 .flags = IORESOURCE_MEM,
188 },
189 {
190 .name = "bamdma_irq",
191 .start = SPS_BAM_DMA_IRQ,
192 .end = SPS_BAM_DMA_IRQ,
193 .flags = IORESOURCE_IRQ,
194 },
195};
196
197struct msm_sps_platform_data msm_sps_pdata = {
198 .bamdma_restricted_pipes = 0x06,
199};
200
201struct platform_device msm_device_sps = {
202 .name = "msm_sps",
203 .id = -1,
204 .num_resources = ARRAY_SIZE(resources_sps),
205 .resource = resources_sps,
206 .dev.platform_data = &msm_sps_pdata,
207};
208
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700209static struct tsens_platform_data msm_tsens_pdata = {
210 .slope = 910,
211 .tsens_factor = 1000,
212 .hw_type = MSM_9615,
213 .tsens_num_sensor = 5,
214};
215
Sahitya Tummala38295432011-09-29 10:08:45 +0530216struct platform_device msm9615_device_tsens = {
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700217 .name = "tsens8960-tm",
218 .id = -1,
Sahitya Tummala38295432011-09-29 10:08:45 +0530219 .dev = {
220 .platform_data = &msm_tsens_pdata,
221 },
222};
223
224#define MSM_NAND_PHYS 0x1B400000
225static struct resource resources_nand[] = {
226 [0] = {
227 .name = "msm_nand_dmac",
228 .start = DMOV_NAND_CHAN,
229 .end = DMOV_NAND_CHAN,
230 .flags = IORESOURCE_DMA,
231 },
232 [1] = {
233 .name = "msm_nand_phys",
234 .start = MSM_NAND_PHYS,
235 .end = MSM_NAND_PHYS + 0x7FF,
236 .flags = IORESOURCE_MEM,
237 },
238};
239
240struct flash_platform_data msm_nand_data = {
241 .parts = NULL,
242 .nr_parts = 0,
243};
244
245struct platform_device msm_device_nand = {
246 .name = "msm_nand",
247 .id = -1,
248 .num_resources = ARRAY_SIZE(resources_nand),
249 .resource = resources_nand,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700250 .dev = {
Sahitya Tummala38295432011-09-29 10:08:45 +0530251 .platform_data = &msm_nand_data,
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700252 },
253};
254
Jeff Hugo56b933a2011-09-28 14:42:05 -0600255struct platform_device msm_device_smd = {
256 .name = "msm_smd",
257 .id = -1,
258};
259
Krishna Kondadd794462011-10-01 00:19:29 -0700260
261#define MSM_SDC1_BASE 0x12180000
262#define MSM_SDC1_DML_BASE (MSM_SDC1_BASE + 0x800)
263#define MSM_SDC1_BAM_BASE (MSM_SDC1_BASE + 0x2000)
Krishna Konda71aef182011-10-01 02:27:51 -0700264#define MSM_SDC2_BASE 0x12140000
265#define MSM_SDC2_DML_BASE (MSM_SDC2_BASE + 0x800)
266#define MSM_SDC2_BAM_BASE (MSM_SDC2_BASE + 0x2000)
Krishna Kondadd794462011-10-01 00:19:29 -0700267
268static struct resource resources_sdc1[] = {
269 {
270 .name = "core_mem",
271 .flags = IORESOURCE_MEM,
272 .start = MSM_SDC1_BASE,
273 .end = MSM_SDC1_DML_BASE - 1,
274 },
275 {
276 .name = "core_irq",
277 .flags = IORESOURCE_IRQ,
278 .start = SDC1_IRQ_0,
279 .end = SDC1_IRQ_0
280 },
281#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
282 {
283 .name = "sdcc_dml_addr",
284 .start = MSM_SDC1_DML_BASE,
285 .end = MSM_SDC1_BAM_BASE - 1,
286 .flags = IORESOURCE_MEM,
287 },
288 {
289 .name = "sdcc_bam_addr",
290 .start = MSM_SDC1_BAM_BASE,
291 .end = MSM_SDC1_BAM_BASE + (2 * SZ_4K) - 1,
292 .flags = IORESOURCE_MEM,
293 },
294 {
295 .name = "sdcc_bam_irq",
296 .start = SDC1_BAM_IRQ,
297 .end = SDC1_BAM_IRQ,
298 .flags = IORESOURCE_IRQ,
299 },
300#endif
301};
302
Krishna Konda71aef182011-10-01 02:27:51 -0700303static struct resource resources_sdc2[] = {
304 {
305 .name = "core_mem",
306 .flags = IORESOURCE_MEM,
307 .start = MSM_SDC2_BASE,
308 .end = MSM_SDC2_DML_BASE - 1,
309 },
310 {
311 .name = "core_irq",
312 .flags = IORESOURCE_IRQ,
313 .start = SDC2_IRQ_0,
314 .end = SDC2_IRQ_0
315 },
316#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
317 {
318 .name = "sdcc_dml_addr",
319 .start = MSM_SDC2_DML_BASE,
320 .end = MSM_SDC2_BAM_BASE - 1,
321 .flags = IORESOURCE_MEM,
322 },
323 {
324 .name = "sdcc_bam_addr",
325 .start = MSM_SDC2_BAM_BASE,
326 .end = MSM_SDC2_BAM_BASE + (2 * SZ_4K) - 1,
327 .flags = IORESOURCE_MEM,
328 },
329 {
330 .name = "sdcc_bam_irq",
331 .start = SDC2_BAM_IRQ,
332 .end = SDC2_BAM_IRQ,
333 .flags = IORESOURCE_IRQ,
334 },
335#endif
336};
337
Krishna Kondadd794462011-10-01 00:19:29 -0700338struct platform_device msm_device_sdc1 = {
339 .name = "msm_sdcc",
340 .id = 1,
341 .num_resources = ARRAY_SIZE(resources_sdc1),
342 .resource = resources_sdc1,
343 .dev = {
344 .coherent_dma_mask = 0xffffffff,
345 },
346};
347
Krishna Konda71aef182011-10-01 02:27:51 -0700348struct platform_device msm_device_sdc2 = {
349 .name = "msm_sdcc",
350 .id = 2,
351 .num_resources = ARRAY_SIZE(resources_sdc2),
352 .resource = resources_sdc2,
353 .dev = {
354 .coherent_dma_mask = 0xffffffff,
355 },
356};
357
Krishna Kondadd794462011-10-01 00:19:29 -0700358static struct platform_device *msm_sdcc_devices[] __initdata = {
359 &msm_device_sdc1,
Krishna Konda71aef182011-10-01 02:27:51 -0700360 &msm_device_sdc2,
Krishna Kondadd794462011-10-01 00:19:29 -0700361};
362
363int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
364{
365 struct platform_device *pdev;
366
367 if (controller < 1 || controller > 2)
368 return -EINVAL;
369
370 pdev = msm_sdcc_devices[controller - 1];
371 pdev->dev.platform_data = plat;
372 return platform_device_register(pdev);
373}
374
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700375#ifdef CONFIG_CACHE_L2X0
376static int __init l2x0_cache_init(void)
377{
378 int aux_ctrl = 0;
379
380 /* Way Size 010(0x2) 32KB */
381 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
382 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
383 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
384
385 /* L2 Latency setting required by hardware. Default is 0x20
386 which is no good.
387 */
388 writel_relaxed(0x220, MSM_L2CC_BASE + L2X0_DATA_LATENCY_CTRL);
389 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
390
391 return 0;
392}
393#else
394static int __init l2x0_cache_init(void){ return 0; }
395#endif
396
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600397struct msm_rpm_map_data rpm_map_data[] __initdata = {
398 MSM_RPM_MAP(TRIGGER_TIMED_TO, TRIGGER_TIMED, 1),
399 MSM_RPM_MAP(TRIGGER_TIMED_SCLK_COUNT, TRIGGER_TIMED, 1),
400
401 MSM_RPM_MAP(RPM_CTL, RPM_CTL, 1),
402
403 MSM_RPM_MAP(CXO_CLK, CXO_CLK, 1),
404 MSM_RPM_MAP(SYSTEM_FABRIC_CLK, SYSTEM_FABRIC_CLK, 1),
405 MSM_RPM_MAP(DAYTONA_FABRIC_CLK, DAYTONA_FABRIC_CLK, 1),
406 MSM_RPM_MAP(SFPB_CLK, SFPB_CLK, 1),
407 MSM_RPM_MAP(CFPB_CLK, CFPB_CLK, 1),
408 MSM_RPM_MAP(EBI1_CLK, EBI1_CLK, 1),
409
410 MSM_RPM_MAP(SYS_FABRIC_CFG_HALT_0, SYS_FABRIC_CFG_HALT, 2),
411 MSM_RPM_MAP(SYS_FABRIC_CFG_CLKMOD_0, SYS_FABRIC_CFG_CLKMOD, 3),
412 MSM_RPM_MAP(SYS_FABRIC_CFG_IOCTL, SYS_FABRIC_CFG_IOCTL, 1),
413 MSM_RPM_MAP(SYSTEM_FABRIC_ARB_0, SYSTEM_FABRIC_ARB, 27),
414
415 MSM_RPM_MAP(PM8018_S1_0, PM8018_S1, 2),
416 MSM_RPM_MAP(PM8018_S2_0, PM8018_S2, 2),
417 MSM_RPM_MAP(PM8018_S3_0, PM8018_S3, 2),
418 MSM_RPM_MAP(PM8018_S4_0, PM8018_S4, 2),
419 MSM_RPM_MAP(PM8018_S5_0, PM8018_S5, 2),
420 MSM_RPM_MAP(PM8018_L1_0, PM8018_L1, 2),
421 MSM_RPM_MAP(PM8018_L2_0, PM8018_L2, 2),
422 MSM_RPM_MAP(PM8018_L3_0, PM8018_L3, 2),
423 MSM_RPM_MAP(PM8018_L4_0, PM8018_L4, 2),
424 MSM_RPM_MAP(PM8018_L5_0, PM8018_L5, 2),
425 MSM_RPM_MAP(PM8018_L6_0, PM8018_L6, 2),
426 MSM_RPM_MAP(PM8018_L7_0, PM8018_L7, 2),
427 MSM_RPM_MAP(PM8018_L8_0, PM8018_L8, 2),
428 MSM_RPM_MAP(PM8018_L9_0, PM8018_L9, 2),
429 MSM_RPM_MAP(PM8018_L10_0, PM8018_L10, 2),
430 MSM_RPM_MAP(PM8018_L11_0, PM8018_L11, 2),
431 MSM_RPM_MAP(PM8018_L12_0, PM8018_L12, 2),
432 MSM_RPM_MAP(PM8018_L13_0, PM8018_L13, 2),
433 MSM_RPM_MAP(PM8018_L14_0, PM8018_L14, 2),
434 MSM_RPM_MAP(PM8018_LVS1, PM8018_LVS1, 1),
435 MSM_RPM_MAP(NCP_0, NCP, 2),
436 MSM_RPM_MAP(CXO_BUFFERS, CXO_BUFFERS, 1),
437 MSM_RPM_MAP(USB_OTG_SWITCH, USB_OTG_SWITCH, 1),
438 MSM_RPM_MAP(HDMI_SWITCH, HDMI_SWITCH, 1),
439};
440unsigned int rpm_map_data_size = ARRAY_SIZE(rpm_map_data);
441
442static struct msm_rpm_platform_data msm_rpm_data = {
443 .reg_base_addrs = {
444 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
445 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
446 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
447 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
448 },
449
450 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
451 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
452 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
453 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
454 .msm_apps_ipc_rpm_val = 4,
455};
456
457struct platform_device msm_rpm_device = {
458 .name = "msm_rpm",
459 .id = -1,
460};
461
462static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] = {
463 [1] = MSM_GPIO_TO_INT(46),
464 [2] = MSM_GPIO_TO_INT(150),
465 [4] = MSM_GPIO_TO_INT(103),
466 [5] = MSM_GPIO_TO_INT(104),
467 [6] = MSM_GPIO_TO_INT(105),
468 [7] = MSM_GPIO_TO_INT(106),
469 [8] = MSM_GPIO_TO_INT(107),
470 [9] = MSM_GPIO_TO_INT(7),
471 [10] = MSM_GPIO_TO_INT(11),
472 [11] = MSM_GPIO_TO_INT(15),
473 [12] = MSM_GPIO_TO_INT(19),
474 [13] = MSM_GPIO_TO_INT(23),
475 [14] = MSM_GPIO_TO_INT(27),
476 [15] = MSM_GPIO_TO_INT(31),
477 [16] = MSM_GPIO_TO_INT(35),
478 [19] = MSM_GPIO_TO_INT(90),
479 [20] = MSM_GPIO_TO_INT(92),
480 [23] = MSM_GPIO_TO_INT(85),
481 [24] = MSM_GPIO_TO_INT(83),
482 [25] = USB1_HS_IRQ,
483 /*[27] = HDMI_IRQ,*/
484 [29] = MSM_GPIO_TO_INT(10),
485 [30] = MSM_GPIO_TO_INT(102),
486 [31] = MSM_GPIO_TO_INT(81),
487 [32] = MSM_GPIO_TO_INT(78),
488 [33] = MSM_GPIO_TO_INT(94),
489 [34] = MSM_GPIO_TO_INT(72),
490 [35] = MSM_GPIO_TO_INT(39),
491 [36] = MSM_GPIO_TO_INT(43),
492 [37] = MSM_GPIO_TO_INT(61),
493 [38] = MSM_GPIO_TO_INT(50),
494 [39] = MSM_GPIO_TO_INT(42),
495 [41] = MSM_GPIO_TO_INT(62),
496 [42] = MSM_GPIO_TO_INT(76),
497 [43] = MSM_GPIO_TO_INT(75),
498 [44] = MSM_GPIO_TO_INT(70),
499 [45] = MSM_GPIO_TO_INT(69),
500 [46] = MSM_GPIO_TO_INT(67),
501 [47] = MSM_GPIO_TO_INT(65),
502 [48] = MSM_GPIO_TO_INT(58),
503 [49] = MSM_GPIO_TO_INT(54),
504 [50] = MSM_GPIO_TO_INT(52),
505 [51] = MSM_GPIO_TO_INT(49),
506 [52] = MSM_GPIO_TO_INT(40),
507 [53] = MSM_GPIO_TO_INT(37),
508 [54] = MSM_GPIO_TO_INT(24),
509 [55] = MSM_GPIO_TO_INT(14),
510};
511
512static uint16_t msm_mpm_bypassed_apps_irqs[] = {
513 TLMM_MSM_SUMMARY_IRQ,
514 RPM_APCC_CPU0_GP_HIGH_IRQ,
515 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
516 RPM_APCC_CPU0_GP_LOW_IRQ,
517 RPM_APCC_CPU0_WAKE_UP_IRQ,
518 LPASS_SCSS_GP_LOW_IRQ,
519 LPASS_SCSS_GP_MEDIUM_IRQ,
520 LPASS_SCSS_GP_HIGH_IRQ,
521 SPS_MTI_31,
522};
523
524struct msm_mpm_device_data msm_mpm_dev_data = {
525 .irqs_m2a = msm_mpm_irqs_m2a,
526 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
527 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
528 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
529 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
530 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
531 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
532 .mpm_apps_ipc_val = BIT(1),
533 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
534
535};
536
537static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
538 {
539 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
540 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
541 true,
542 1, 8000, 100000, 1,
543 },
544
545 {
546 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
547 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
548 true,
549 1500, 5000, 60100000, 3000,
550 },
551 {
552 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
553 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
554 false,
555 2800, 5000, 60350000, 3500,
556 },
557};
558
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700559void __init msm9615_device_init(void)
560{
Vikram Mulukutla489e39e2011-08-31 18:04:05 -0700561 msm_clock_init(&msm9615_clock_init_data);
Matt Wagantall44f672e2011-09-07 20:31:16 -0700562 acpuclk_init(&acpuclk_9615_soc_data);
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600563 BUG_ON(msm_rpm_init(&msm_rpm_data));
564 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
565 ARRAY_SIZE(msm_rpmrs_levels)));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700566}
567
Jeff Hugo56b933a2011-09-28 14:42:05 -0600568#define MSM_SHARED_RAM_PHYS 0x40000000
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700569void __init msm9615_map_io(void)
570{
Jeff Hugo56b933a2011-09-28 14:42:05 -0600571 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700572 msm_map_msm9615_io();
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700573 l2x0_cache_init();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700574 if (socinfo_init() < 0)
575 pr_err("socinfo_init() failed!\n");
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700576}
577
578void __init msm9615_init_irq(void)
579{
580 unsigned int i;
Rohit Vaswanib2e42e12011-10-07 21:25:53 -0700581
582 msm_mpm_irq_extn_init();
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700583 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
584 (void *)MSM_QGIC_CPU_BASE);
585
586 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
587 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
588
589 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
590 mb();
591
592 /*
593 * FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
594 * as they are configured as level, which does not play nice with
595 * handle_percpu_irq.
596 */
597 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
598 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
599 irq_set_handler(i, handle_percpu_irq);
600 }
601}