blob: 4972585d599aed3576f9ae12657e7f96a32a51ec [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>
20#include <mach/board.h>
21#include <mach/msm_iomap.h>
22#include <mach/irqs.h>
23#include <mach/socinfo.h>
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -070024#include <asm/hardware/cache-l2x0.h>
Yan He092b7272011-09-21 15:25:03 -070025#include <mach/msm_sps.h>
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070026#include <mach/dma.h>
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070027#include "devices.h"
Matt Wagantall44f672e2011-09-07 20:31:16 -070028#include "acpuclock.h"
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -070029
Harini Jayaramaneba52672011-09-08 15:13:00 -060030/* Address of GSBI blocks */
31#define MSM_GSBI1_PHYS 0x16000000
32#define MSM_GSBI2_PHYS 0x16100000
33#define MSM_GSBI3_PHYS 0x16200000
Rohit Vaswani09666872011-08-23 17:41:54 -070034#define MSM_GSBI4_PHYS 0x16300000
Harini Jayaramaneba52672011-09-08 15:13:00 -060035#define MSM_GSBI5_PHYS 0x16400000
36
Rohit Vaswani09666872011-08-23 17:41:54 -070037#define MSM_UART4DM_PHYS (MSM_GSBI4_PHYS + 0x40000)
38
Harini Jayaramaneba52672011-09-08 15:13:00 -060039/* GSBI QUP devices */
40#define MSM_GSBI1_QUP_PHYS (MSM_GSBI1_PHYS + 0x80000)
41#define MSM_GSBI2_QUP_PHYS (MSM_GSBI2_PHYS + 0x80000)
42#define MSM_GSBI3_QUP_PHYS (MSM_GSBI3_PHYS + 0x80000)
43#define MSM_GSBI4_QUP_PHYS (MSM_GSBI4_PHYS + 0x80000)
44#define MSM_GSBI5_QUP_PHYS (MSM_GSBI5_PHYS + 0x80000)
45#define MSM_QUP_SIZE SZ_4K
46
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -070047/* Address of SSBI CMD */
48#define MSM_PMIC1_SSBI_CMD_PHYS 0x00500000
49#define MSM_PMIC_SSBI_SIZE SZ_4K
50
Jeff Ohlsteind19bf442011-09-09 12:48:18 -070051static struct resource msm_dmov_resource[] = {
52 {
53 .start = ADM_0_SCSS_1_IRQ,
54 .end = (resource_size_t)MSM_DMOV_BASE,
55 .flags = IORESOURCE_IRQ,
56 },
57};
58
59struct platform_device msm9615_device_dmov = {
60 .name = "msm_dmov",
61 .id = -1,
62 .resource = msm_dmov_resource,
63 .num_resources = ARRAY_SIZE(msm_dmov_resource),
64};
65
Rohit Vaswani09666872011-08-23 17:41:54 -070066static struct resource resources_uart_gsbi4[] = {
67 {
68 .start = GSBI4_UARTDM_IRQ,
69 .end = GSBI4_UARTDM_IRQ,
70 .flags = IORESOURCE_IRQ,
71 },
72 {
73 .start = MSM_UART4DM_PHYS,
74 .end = MSM_UART4DM_PHYS + PAGE_SIZE - 1,
75 .name = "uartdm_resource",
76 .flags = IORESOURCE_MEM,
77 },
78 {
79 .start = MSM_GSBI4_PHYS,
80 .end = MSM_GSBI4_PHYS + PAGE_SIZE - 1,
81 .name = "gsbi_resource",
82 .flags = IORESOURCE_MEM,
83 },
84};
85
86struct platform_device msm9615_device_uart_gsbi4 = {
87 .name = "msm_serial_hsl",
88 .id = 0,
89 .num_resources = ARRAY_SIZE(resources_uart_gsbi4),
90 .resource = resources_uart_gsbi4,
91};
92
Harini Jayaramaneba52672011-09-08 15:13:00 -060093static struct resource resources_qup_i2c_gsbi5[] = {
94 {
95 .name = "gsbi_qup_i2c_addr",
96 .start = MSM_GSBI5_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -060097 .end = MSM_GSBI5_PHYS + 4 - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -060098 .flags = IORESOURCE_MEM,
99 },
100 {
101 .name = "qup_phys_addr",
102 .start = MSM_GSBI5_QUP_PHYS,
Harini Jayaraman7a60bc12011-09-15 14:58:54 -0600103 .end = MSM_GSBI5_QUP_PHYS + MSM_QUP_SIZE - 1,
Harini Jayaramaneba52672011-09-08 15:13:00 -0600104 .flags = IORESOURCE_MEM,
105 },
106 {
107 .name = "qup_err_intr",
108 .start = GSBI5_QUP_IRQ,
109 .end = GSBI5_QUP_IRQ,
110 .flags = IORESOURCE_IRQ,
111 },
112};
113
114struct platform_device msm9615_device_qup_i2c_gsbi5 = {
115 .name = "qup_i2c",
116 .id = 0,
117 .num_resources = ARRAY_SIZE(resources_qup_i2c_gsbi5),
118 .resource = resources_qup_i2c_gsbi5,
119};
120
Harini Jayaraman738c9312011-09-08 15:22:38 -0600121static struct resource resources_qup_spi_gsbi3[] = {
122 {
123 .name = "spi_base",
124 .start = MSM_GSBI3_QUP_PHYS,
125 .end = MSM_GSBI3_QUP_PHYS + SZ_4K - 1,
126 .flags = IORESOURCE_MEM,
127 },
128 {
129 .name = "gsbi_base",
130 .start = MSM_GSBI3_PHYS,
131 .end = MSM_GSBI3_PHYS + 4 - 1,
132 .flags = IORESOURCE_MEM,
133 },
134 {
135 .name = "spi_irq_in",
136 .start = GSBI3_QUP_IRQ,
137 .end = GSBI3_QUP_IRQ,
138 .flags = IORESOURCE_IRQ,
139 },
140};
141
142struct platform_device msm9615_device_qup_spi_gsbi3 = {
143 .name = "spi_qsd",
144 .id = 0,
145 .num_resources = ARRAY_SIZE(resources_qup_spi_gsbi3),
146 .resource = resources_qup_spi_gsbi3,
147};
148
Kenneth Heitkeaf3d3cf2011-09-08 11:45:31 -0700149static struct resource resources_ssbi_pmic1[] = {
150 {
151 .start = MSM_PMIC1_SSBI_CMD_PHYS,
152 .end = MSM_PMIC1_SSBI_CMD_PHYS + MSM_PMIC_SSBI_SIZE - 1,
153 .flags = IORESOURCE_MEM,
154 },
155};
156
157struct platform_device msm9615_device_ssbi_pmic1 = {
158 .name = "msm_ssbi",
159 .id = 0,
160 .resource = resources_ssbi_pmic1,
161 .num_resources = ARRAY_SIZE(resources_ssbi_pmic1),
162};
163
Yan He092b7272011-09-21 15:25:03 -0700164static struct resource resources_sps[] = {
165 {
166 .name = "pipe_mem",
167 .start = 0x12800000,
168 .end = 0x12800000 + 0x4000 - 1,
169 .flags = IORESOURCE_MEM,
170 },
171 {
172 .name = "bamdma_dma",
173 .start = 0x12240000,
174 .end = 0x12240000 + 0x1000 - 1,
175 .flags = IORESOURCE_MEM,
176 },
177 {
178 .name = "bamdma_bam",
179 .start = 0x12244000,
180 .end = 0x12244000 + 0x4000 - 1,
181 .flags = IORESOURCE_MEM,
182 },
183 {
184 .name = "bamdma_irq",
185 .start = SPS_BAM_DMA_IRQ,
186 .end = SPS_BAM_DMA_IRQ,
187 .flags = IORESOURCE_IRQ,
188 },
189};
190
191struct msm_sps_platform_data msm_sps_pdata = {
192 .bamdma_restricted_pipes = 0x06,
193};
194
195struct platform_device msm_device_sps = {
196 .name = "msm_sps",
197 .id = -1,
198 .num_resources = ARRAY_SIZE(resources_sps),
199 .resource = resources_sps,
200 .dev.platform_data = &msm_sps_pdata,
201};
202
Siddartha Mohanadoss5d49cec2011-09-21 10:26:15 -0700203static struct tsens_platform_data msm_tsens_pdata = {
204 .slope = 910,
205 .tsens_factor = 1000,
206 .hw_type = MSM_9615,
207 .tsens_num_sensor = 5,
208};
209
210struct platform_device msm9615_device_tsens = {
211 .name = "tsens8960-tm",
212 .id = -1,
213 .dev = {
214 .platform_data = &msm_tsens_pdata,
215 },
216};
217
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700218#ifdef CONFIG_CACHE_L2X0
219static int __init l2x0_cache_init(void)
220{
221 int aux_ctrl = 0;
222
223 /* Way Size 010(0x2) 32KB */
224 aux_ctrl = (0x1 << L2X0_AUX_CTRL_SHARE_OVERRIDE_SHIFT) | \
225 (0x2 << L2X0_AUX_CTRL_WAY_SIZE_SHIFT) | \
226 (0x1 << L2X0_AUX_CTRL_EVNT_MON_BUS_EN_SHIFT);
227
228 /* L2 Latency setting required by hardware. Default is 0x20
229 which is no good.
230 */
231 writel_relaxed(0x220, MSM_L2CC_BASE + L2X0_DATA_LATENCY_CTRL);
232 l2x0_init(MSM_L2CC_BASE, aux_ctrl, L2X0_AUX_CTRL_MASK);
233
234 return 0;
235}
236#else
237static int __init l2x0_cache_init(void){ return 0; }
238#endif
239
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700240void __init msm9615_device_init(void)
241{
242 if (socinfo_init() < 0)
243 pr_err("socinfo_init() failed!\n");
244
Vikram Mulukutla489e39e2011-08-31 18:04:05 -0700245 msm_clock_init(&msm9615_clock_init_data);
Matt Wagantall44f672e2011-09-07 20:31:16 -0700246 acpuclk_init(&acpuclk_9615_soc_data);
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700247}
248
249void __init msm9615_map_io(void)
250{
251 msm_map_msm9615_io();
Rohit Vaswanif0ce9ae2011-08-23 22:18:38 -0700252 l2x0_cache_init();
Rohit Vaswaniced9b3b2011-08-23 17:21:49 -0700253}
254
255void __init msm9615_init_irq(void)
256{
257 unsigned int i;
258 gic_init(0, GIC_PPI_START, MSM_QGIC_DIST_BASE,
259 (void *)MSM_QGIC_CPU_BASE);
260
261 /* Edge trigger PPIs except AVS_SVICINT and AVS_SVICINTSWDONE */
262 writel_relaxed(0xFFFFD7FF, MSM_QGIC_DIST_BASE + GIC_DIST_CONFIG + 4);
263
264 writel_relaxed(0x0000FFFF, MSM_QGIC_DIST_BASE + GIC_DIST_ENABLE_SET);
265 mb();
266
267 /*
268 * FIXME: Not installing AVS_SVICINT and AVS_SVICINTSWDONE yet
269 * as they are configured as level, which does not play nice with
270 * handle_percpu_irq.
271 */
272 for (i = GIC_PPI_START; i < GIC_SPI_START; i++) {
273 if (i != AVS_SVICINT && i != AVS_SVICINTSWDONE)
274 irq_set_handler(i, handle_percpu_irq);
275 }
276}