blob: df84527d10db050f890e3e033d25a05df8c2ea63 [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
Ramesh Masavarapu5ad37392011-10-10 10:44:10 -0700260#ifdef CONFIG_HW_RANDOM_MSM
261/* PRNG device */
262#define MSM_PRNG_PHYS 0x1A500000
263static struct resource rng_resources = {
264 .flags = IORESOURCE_MEM,
265 .start = MSM_PRNG_PHYS,
266 .end = MSM_PRNG_PHYS + SZ_512 - 1,
267};
268
269struct platform_device msm_device_rng = {
270 .name = "msm_rng",
271 .id = 0,
272 .num_resources = 1,
273 .resource = &rng_resources,
274};
275#endif
Krishna Kondadd794462011-10-01 00:19:29 -0700276
277#define MSM_SDC1_BASE 0x12180000
278#define MSM_SDC1_DML_BASE (MSM_SDC1_BASE + 0x800)
279#define MSM_SDC1_BAM_BASE (MSM_SDC1_BASE + 0x2000)
Krishna Konda71aef182011-10-01 02:27:51 -0700280#define MSM_SDC2_BASE 0x12140000
281#define MSM_SDC2_DML_BASE (MSM_SDC2_BASE + 0x800)
282#define MSM_SDC2_BAM_BASE (MSM_SDC2_BASE + 0x2000)
Krishna Kondadd794462011-10-01 00:19:29 -0700283
284static struct resource resources_sdc1[] = {
285 {
286 .name = "core_mem",
287 .flags = IORESOURCE_MEM,
288 .start = MSM_SDC1_BASE,
289 .end = MSM_SDC1_DML_BASE - 1,
290 },
291 {
292 .name = "core_irq",
293 .flags = IORESOURCE_IRQ,
294 .start = SDC1_IRQ_0,
295 .end = SDC1_IRQ_0
296 },
297#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
298 {
299 .name = "sdcc_dml_addr",
300 .start = MSM_SDC1_DML_BASE,
301 .end = MSM_SDC1_BAM_BASE - 1,
302 .flags = IORESOURCE_MEM,
303 },
304 {
305 .name = "sdcc_bam_addr",
306 .start = MSM_SDC1_BAM_BASE,
307 .end = MSM_SDC1_BAM_BASE + (2 * SZ_4K) - 1,
308 .flags = IORESOURCE_MEM,
309 },
310 {
311 .name = "sdcc_bam_irq",
312 .start = SDC1_BAM_IRQ,
313 .end = SDC1_BAM_IRQ,
314 .flags = IORESOURCE_IRQ,
315 },
316#endif
317};
318
Krishna Konda71aef182011-10-01 02:27:51 -0700319static struct resource resources_sdc2[] = {
320 {
321 .name = "core_mem",
322 .flags = IORESOURCE_MEM,
323 .start = MSM_SDC2_BASE,
324 .end = MSM_SDC2_DML_BASE - 1,
325 },
326 {
327 .name = "core_irq",
328 .flags = IORESOURCE_IRQ,
329 .start = SDC2_IRQ_0,
330 .end = SDC2_IRQ_0
331 },
332#ifdef CONFIG_MMC_MSM_SPS_SUPPORT
333 {
334 .name = "sdcc_dml_addr",
335 .start = MSM_SDC2_DML_BASE,
336 .end = MSM_SDC2_BAM_BASE - 1,
337 .flags = IORESOURCE_MEM,
338 },
339 {
340 .name = "sdcc_bam_addr",
341 .start = MSM_SDC2_BAM_BASE,
342 .end = MSM_SDC2_BAM_BASE + (2 * SZ_4K) - 1,
343 .flags = IORESOURCE_MEM,
344 },
345 {
346 .name = "sdcc_bam_irq",
347 .start = SDC2_BAM_IRQ,
348 .end = SDC2_BAM_IRQ,
349 .flags = IORESOURCE_IRQ,
350 },
351#endif
352};
353
Krishna Kondadd794462011-10-01 00:19:29 -0700354struct platform_device msm_device_sdc1 = {
355 .name = "msm_sdcc",
356 .id = 1,
357 .num_resources = ARRAY_SIZE(resources_sdc1),
358 .resource = resources_sdc1,
359 .dev = {
360 .coherent_dma_mask = 0xffffffff,
361 },
362};
363
Krishna Konda71aef182011-10-01 02:27:51 -0700364struct platform_device msm_device_sdc2 = {
365 .name = "msm_sdcc",
366 .id = 2,
367 .num_resources = ARRAY_SIZE(resources_sdc2),
368 .resource = resources_sdc2,
369 .dev = {
370 .coherent_dma_mask = 0xffffffff,
371 },
372};
373
Krishna Kondadd794462011-10-01 00:19:29 -0700374static struct platform_device *msm_sdcc_devices[] __initdata = {
375 &msm_device_sdc1,
Krishna Konda71aef182011-10-01 02:27:51 -0700376 &msm_device_sdc2,
Krishna Kondadd794462011-10-01 00:19:29 -0700377};
378
379int __init msm_add_sdcc(unsigned int controller, struct mmc_platform_data *plat)
380{
381 struct platform_device *pdev;
382
383 if (controller < 1 || controller > 2)
384 return -EINVAL;
385
386 pdev = msm_sdcc_devices[controller - 1];
387 pdev->dev.platform_data = plat;
388 return platform_device_register(pdev);
389}
390
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700391#ifdef CONFIG_CACHE_L2X0
392static int __init l2x0_cache_init(void)
393{
394 int aux_ctrl = 0;
395
396 /* Way Size 010(0x2) 32KB */
397 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
398 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
399 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
400
401 /* L2 Latency setting required by hardware. Default is 0x20
402 which is no good.
403 */
404 writel_relaxed(0x220, MSM_L2CC_BASE + L2X0_DATA_LATENCY_CTRL);
405 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
406
407 return 0;
408}
409#else
410static int __init l2x0_cache_init(void){ return 0; }
411#endif
412
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600413struct msm_rpm_map_data rpm_map_data[] __initdata = {
414 MSM_RPM_MAP(TRIGGER_TIMED_TO, TRIGGER_TIMED, 1),
415 MSM_RPM_MAP(TRIGGER_TIMED_SCLK_COUNT, TRIGGER_TIMED, 1),
416
417 MSM_RPM_MAP(RPM_CTL, RPM_CTL, 1),
418
419 MSM_RPM_MAP(CXO_CLK, CXO_CLK, 1),
420 MSM_RPM_MAP(SYSTEM_FABRIC_CLK, SYSTEM_FABRIC_CLK, 1),
421 MSM_RPM_MAP(DAYTONA_FABRIC_CLK, DAYTONA_FABRIC_CLK, 1),
422 MSM_RPM_MAP(SFPB_CLK, SFPB_CLK, 1),
423 MSM_RPM_MAP(CFPB_CLK, CFPB_CLK, 1),
424 MSM_RPM_MAP(EBI1_CLK, EBI1_CLK, 1),
425
426 MSM_RPM_MAP(SYS_FABRIC_CFG_HALT_0, SYS_FABRIC_CFG_HALT, 2),
427 MSM_RPM_MAP(SYS_FABRIC_CFG_CLKMOD_0, SYS_FABRIC_CFG_CLKMOD, 3),
428 MSM_RPM_MAP(SYS_FABRIC_CFG_IOCTL, SYS_FABRIC_CFG_IOCTL, 1),
429 MSM_RPM_MAP(SYSTEM_FABRIC_ARB_0, SYSTEM_FABRIC_ARB, 27),
430
431 MSM_RPM_MAP(PM8018_S1_0, PM8018_S1, 2),
432 MSM_RPM_MAP(PM8018_S2_0, PM8018_S2, 2),
433 MSM_RPM_MAP(PM8018_S3_0, PM8018_S3, 2),
434 MSM_RPM_MAP(PM8018_S4_0, PM8018_S4, 2),
435 MSM_RPM_MAP(PM8018_S5_0, PM8018_S5, 2),
436 MSM_RPM_MAP(PM8018_L1_0, PM8018_L1, 2),
437 MSM_RPM_MAP(PM8018_L2_0, PM8018_L2, 2),
438 MSM_RPM_MAP(PM8018_L3_0, PM8018_L3, 2),
439 MSM_RPM_MAP(PM8018_L4_0, PM8018_L4, 2),
440 MSM_RPM_MAP(PM8018_L5_0, PM8018_L5, 2),
441 MSM_RPM_MAP(PM8018_L6_0, PM8018_L6, 2),
442 MSM_RPM_MAP(PM8018_L7_0, PM8018_L7, 2),
443 MSM_RPM_MAP(PM8018_L8_0, PM8018_L8, 2),
444 MSM_RPM_MAP(PM8018_L9_0, PM8018_L9, 2),
445 MSM_RPM_MAP(PM8018_L10_0, PM8018_L10, 2),
446 MSM_RPM_MAP(PM8018_L11_0, PM8018_L11, 2),
447 MSM_RPM_MAP(PM8018_L12_0, PM8018_L12, 2),
448 MSM_RPM_MAP(PM8018_L13_0, PM8018_L13, 2),
449 MSM_RPM_MAP(PM8018_L14_0, PM8018_L14, 2),
450 MSM_RPM_MAP(PM8018_LVS1, PM8018_LVS1, 1),
451 MSM_RPM_MAP(NCP_0, NCP, 2),
452 MSM_RPM_MAP(CXO_BUFFERS, CXO_BUFFERS, 1),
453 MSM_RPM_MAP(USB_OTG_SWITCH, USB_OTG_SWITCH, 1),
454 MSM_RPM_MAP(HDMI_SWITCH, HDMI_SWITCH, 1),
455};
456unsigned int rpm_map_data_size = ARRAY_SIZE(rpm_map_data);
457
458static struct msm_rpm_platform_data msm_rpm_data = {
459 .reg_base_addrs = {
460 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
461 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
462 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
463 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
464 },
465
466 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
467 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
468 .irq_vmpm = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
469 .msm_apps_ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
470 .msm_apps_ipc_rpm_val = 4,
471};
472
473struct platform_device msm_rpm_device = {
474 .name = "msm_rpm",
475 .id = -1,
476};
477
478static uint16_t msm_mpm_irqs_m2a[MSM_MPM_NR_MPM_IRQS] = {
479 [1] = MSM_GPIO_TO_INT(46),
480 [2] = MSM_GPIO_TO_INT(150),
481 [4] = MSM_GPIO_TO_INT(103),
482 [5] = MSM_GPIO_TO_INT(104),
483 [6] = MSM_GPIO_TO_INT(105),
484 [7] = MSM_GPIO_TO_INT(106),
485 [8] = MSM_GPIO_TO_INT(107),
486 [9] = MSM_GPIO_TO_INT(7),
487 [10] = MSM_GPIO_TO_INT(11),
488 [11] = MSM_GPIO_TO_INT(15),
489 [12] = MSM_GPIO_TO_INT(19),
490 [13] = MSM_GPIO_TO_INT(23),
491 [14] = MSM_GPIO_TO_INT(27),
492 [15] = MSM_GPIO_TO_INT(31),
493 [16] = MSM_GPIO_TO_INT(35),
494 [19] = MSM_GPIO_TO_INT(90),
495 [20] = MSM_GPIO_TO_INT(92),
496 [23] = MSM_GPIO_TO_INT(85),
497 [24] = MSM_GPIO_TO_INT(83),
498 [25] = USB1_HS_IRQ,
499 /*[27] = HDMI_IRQ,*/
500 [29] = MSM_GPIO_TO_INT(10),
501 [30] = MSM_GPIO_TO_INT(102),
502 [31] = MSM_GPIO_TO_INT(81),
503 [32] = MSM_GPIO_TO_INT(78),
504 [33] = MSM_GPIO_TO_INT(94),
505 [34] = MSM_GPIO_TO_INT(72),
506 [35] = MSM_GPIO_TO_INT(39),
507 [36] = MSM_GPIO_TO_INT(43),
508 [37] = MSM_GPIO_TO_INT(61),
509 [38] = MSM_GPIO_TO_INT(50),
510 [39] = MSM_GPIO_TO_INT(42),
511 [41] = MSM_GPIO_TO_INT(62),
512 [42] = MSM_GPIO_TO_INT(76),
513 [43] = MSM_GPIO_TO_INT(75),
514 [44] = MSM_GPIO_TO_INT(70),
515 [45] = MSM_GPIO_TO_INT(69),
516 [46] = MSM_GPIO_TO_INT(67),
517 [47] = MSM_GPIO_TO_INT(65),
518 [48] = MSM_GPIO_TO_INT(58),
519 [49] = MSM_GPIO_TO_INT(54),
520 [50] = MSM_GPIO_TO_INT(52),
521 [51] = MSM_GPIO_TO_INT(49),
522 [52] = MSM_GPIO_TO_INT(40),
523 [53] = MSM_GPIO_TO_INT(37),
524 [54] = MSM_GPIO_TO_INT(24),
525 [55] = MSM_GPIO_TO_INT(14),
526};
527
528static uint16_t msm_mpm_bypassed_apps_irqs[] = {
529 TLMM_MSM_SUMMARY_IRQ,
530 RPM_APCC_CPU0_GP_HIGH_IRQ,
531 RPM_APCC_CPU0_GP_MEDIUM_IRQ,
532 RPM_APCC_CPU0_GP_LOW_IRQ,
533 RPM_APCC_CPU0_WAKE_UP_IRQ,
534 LPASS_SCSS_GP_LOW_IRQ,
535 LPASS_SCSS_GP_MEDIUM_IRQ,
536 LPASS_SCSS_GP_HIGH_IRQ,
537 SPS_MTI_31,
538};
539
540struct msm_mpm_device_data msm_mpm_dev_data = {
541 .irqs_m2a = msm_mpm_irqs_m2a,
542 .irqs_m2a_size = ARRAY_SIZE(msm_mpm_irqs_m2a),
543 .bypassed_apps_irqs = msm_mpm_bypassed_apps_irqs,
544 .bypassed_apps_irqs_size = ARRAY_SIZE(msm_mpm_bypassed_apps_irqs),
545 .mpm_request_reg_base = MSM_RPM_BASE + 0x9d8,
546 .mpm_status_reg_base = MSM_RPM_BASE + 0xdf8,
547 .mpm_apps_ipc_reg = MSM_APCS_GCC_BASE + 0x008,
548 .mpm_apps_ipc_val = BIT(1),
549 .mpm_ipc_irq = RPM_APCC_CPU0_GP_MEDIUM_IRQ,
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600550};
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600551
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600552static uint8_t spm_wfi_cmd_sequence[] __initdata = {
553 0x00, 0x03, 0x0B, 0x00,
554 0x0f,
555};
556
557static uint8_t spm_power_collapse_without_rpm[] __initdata = {
558 0x30, 0x20, 0x10, 0x00,
559 0x50, 0x03, 0x50, 0x00,
560 0x10, 0x20, 0x30, 0x0f,
561};
562
563static uint8_t spm_power_collapse_with_rpm[] __initdata = {
564 0x30, 0x20, 0x10, 0x00,
565 0x50, 0x07, 0x50, 0x00,
566 0x10, 0x20, 0x30, 0x0f,
567};
568
569static struct msm_spm_seq_entry msm_spm_seq_list[] __initdata = {
570 [0] = {
571 .mode = MSM_SPM_MODE_CLOCK_GATING,
572 .notify_rpm = false,
573 .cmd = spm_wfi_cmd_sequence,
574 },
575 [1] = {
576 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
577 .notify_rpm = false,
578 .cmd = spm_power_collapse_without_rpm,
579 },
580 [2] = {
581 .mode = MSM_SPM_MODE_POWER_COLLAPSE,
582 .notify_rpm = true,
583 .cmd = spm_power_collapse_with_rpm,
584 },
585};
586
587static struct msm_spm_platform_data msm_spm_data[] __initdata = {
588 [0] = {
589 .reg_base_addr = MSM_SAW0_BASE,
590 .reg_init_values[MSM_SPM_REG_SAW2_SPM_CTL] = 0x01,
591 .reg_init_values[MSM_SPM_REG_SAW2_CFG] = 0x1F,
592 .num_modes = ARRAY_SIZE(msm_spm_seq_list),
593 .modes = msm_spm_seq_list,
594 },
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600595};
596
597static struct msm_rpmrs_level msm_rpmrs_levels[] __initdata = {
598 {
599 MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT,
600 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
601 true,
602 1, 8000, 100000, 1,
603 },
604
605 {
606 MSM_PM_SLEEP_MODE_POWER_COLLAPSE_STANDALONE,
607 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
608 true,
609 1500, 5000, 60100000, 3000,
610 },
611 {
612 MSM_PM_SLEEP_MODE_POWER_COLLAPSE,
613 MSM_RPMRS_LIMITS(ON, ACTIVE, MAX, ACTIVE),
614 false,
615 2800, 5000, 60350000, 3500,
616 },
617};
618
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700619void __init msm9615_device_init(void)
620{
Maheshkumar Sivasubramanianf07bd0b2011-09-06 17:33:17 -0600621 msm_spm_init(msm_spm_data, ARRAY_SIZE(msm_spm_data));
Vikram Mulukutla489e39e2011-08-31 18:04:05 -0700622 msm_clock_init(&msm9615_clock_init_data);
Matt Wagantall44f672e2011-09-07 20:31:16 -0700623 acpuclk_init(&acpuclk_9615_soc_data);
Praveen Chidambaramab3b1c42011-08-25 08:44:05 -0600624 BUG_ON(msm_rpm_init(&msm_rpm_data));
625 BUG_ON(msm_rpmrs_levels_init(msm_rpmrs_levels,
626 ARRAY_SIZE(msm_rpmrs_levels)));
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700627}
628
Jeff Hugo56b933a2011-09-28 14:42:05 -0600629#define MSM_SHARED_RAM_PHYS 0x40000000
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700630void __init msm9615_map_io(void)
631{
Jeff Hugo56b933a2011-09-28 14:42:05 -0600632 msm_shared_ram_phys = MSM_SHARED_RAM_PHYS;
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700633 msm_map_msm9615_io();
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700634 l2x0_cache_init();
Jeff Ohlstein3a77f9f2011-09-06 14:50:20 -0700635 if (socinfo_init() < 0)
636 pr_err("socinfo_init() failed!\n");
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700637}
638
639void __init msm9615_init_irq(void)
640{
641 unsigned int i;
Rohit Vaswanib2e42e12011-10-07 21:25:53 -0700642
643 msm_mpm_irq_extn_init();
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700644 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
645 (void *)MSM_QGIC_CPU_BASE);
646
647 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
648 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
649
650 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
651 mb();
652
653 /*
654 * FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
655 * as they are configured as level, which does not play nice with
656 * handle_percpu_irq.
657 */
658 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
659 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
660 irq_set_handler(i, handle_percpu_irq);
661 }
662}