blob: aba467beac3b22dd3632a88e74744917d9d4eee9 [file] [log] [blame]
Praveen Chidambaram78499012011-11-01 17:15:17 -06001/* Copyright (c) 2012, 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>
Steve Mucklef132c6c2012-06-06 18:30:57 -070016#include <asm/io.h>
Arun Menonaabf2632012-02-24 15:30:47 -080017#include <linux/ion.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060018#include <mach/msm_iomap.h>
19#include <mach/irqs-8930.h>
20#include <mach/rpm.h>
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -070021#include <mach/msm_dcvs.h>
Arun Menonaabf2632012-02-24 15:30:47 -080022#include <mach/msm_bus.h>
Gagan Maccd5b3272012-02-09 18:13:10 -070023#include <mach/msm_bus_board.h>
Arun Menonaabf2632012-02-24 15:30:47 -080024#include <mach/board.h>
25#include <mach/socinfo.h>
Laura Abbott0577d7b2012-04-17 11:14:30 -070026#include <mach/iommu_domains.h>
Laura Abbott532b2df2012-04-12 10:53:48 -070027#include <mach/msm_rtb.h>
Laura Abbottf3173042012-05-29 15:23:18 -070028#include <mach/msm_cache_dump.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060029
30#include "devices.h"
31#include "rpm_log.h"
32#include "rpm_stats.h"
Matt Wagantall1f65d9d2012-04-25 14:24:20 -070033#include "footswitch.h"
Praveen Chidambaram78499012011-11-01 17:15:17 -060034
35#ifdef CONFIG_MSM_MPM
Subhash Jadavani909e04f2012-04-12 10:52:50 +053036#include <mach/mpm.h>
Praveen Chidambaram78499012011-11-01 17:15:17 -060037#endif
38
39struct msm_rpm_platform_data msm8930_rpm_data __initdata = {
40 .reg_base_addrs = {
41 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
42 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
43 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
44 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
45 },
46 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
Stephen Boydf61255e2012-02-24 14:31:09 -080047 .irq_err = RPM_APCC_CPU0_GP_LOW_IRQ,
Praveen Chidambarame396ce62012-03-30 11:15:57 -060048 .irq_wakeup = RPM_APCC_CPU0_WAKE_UP_IRQ,
Praveen Chidambaram78499012011-11-01 17:15:17 -060049 .ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
50 .ipc_rpm_val = 4,
51 .target_id = {
52 MSM_RPM_MAP(8930, NOTIFICATION_CONFIGURED_0, NOTIFICATION, 4),
53 MSM_RPM_MAP(8930, NOTIFICATION_REGISTERED_0, NOTIFICATION, 4),
54 MSM_RPM_MAP(8930, INVALIDATE_0, INVALIDATE, 8),
Mahesh Sivasubramanianef2a0fa2012-01-24 15:57:01 -070055 MSM_RPM_MAP(8960, TRIGGER_TIMED_TO, TRIGGER_TIMED, 1),
56 MSM_RPM_MAP(8960, TRIGGER_TIMED_SCLK_COUNT, TRIGGER_TIMED, 1),
Praveen Chidambaram78499012011-11-01 17:15:17 -060057 MSM_RPM_MAP(8930, RPM_CTL, RPM_CTL, 1),
58 MSM_RPM_MAP(8930, CXO_CLK, CXO_CLK, 1),
59 MSM_RPM_MAP(8930, PXO_CLK, PXO_CLK, 1),
60 MSM_RPM_MAP(8930, APPS_FABRIC_CLK, APPS_FABRIC_CLK, 1),
61 MSM_RPM_MAP(8930, SYSTEM_FABRIC_CLK, SYSTEM_FABRIC_CLK, 1),
62 MSM_RPM_MAP(8930, MM_FABRIC_CLK, MM_FABRIC_CLK, 1),
63 MSM_RPM_MAP(8930, DAYTONA_FABRIC_CLK, DAYTONA_FABRIC_CLK, 1),
64 MSM_RPM_MAP(8930, SFPB_CLK, SFPB_CLK, 1),
65 MSM_RPM_MAP(8930, CFPB_CLK, CFPB_CLK, 1),
66 MSM_RPM_MAP(8930, MMFPB_CLK, MMFPB_CLK, 1),
67 MSM_RPM_MAP(8930, EBI1_CLK, EBI1_CLK, 1),
68 MSM_RPM_MAP(8930, APPS_FABRIC_CFG_HALT_0,
69 APPS_FABRIC_CFG_HALT, 2),
70 MSM_RPM_MAP(8930, APPS_FABRIC_CFG_CLKMOD_0,
71 APPS_FABRIC_CFG_CLKMOD, 3),
72 MSM_RPM_MAP(8930, APPS_FABRIC_CFG_IOCTL,
73 APPS_FABRIC_CFG_IOCTL, 1),
Mahesh Sivasubramanian2d2c70592012-03-20 17:07:24 -060074 MSM_RPM_MAP(8930, APPS_FABRIC_ARB_0, APPS_FABRIC_ARB, 6),
Praveen Chidambaram78499012011-11-01 17:15:17 -060075 MSM_RPM_MAP(8930, SYS_FABRIC_CFG_HALT_0,
76 SYS_FABRIC_CFG_HALT, 2),
77 MSM_RPM_MAP(8930, SYS_FABRIC_CFG_CLKMOD_0,
78 SYS_FABRIC_CFG_CLKMOD, 3),
79 MSM_RPM_MAP(8930, SYS_FABRIC_CFG_IOCTL,
80 SYS_FABRIC_CFG_IOCTL, 1),
81 MSM_RPM_MAP(8930, SYSTEM_FABRIC_ARB_0,
Mahesh Sivasubramanian2d2c70592012-03-20 17:07:24 -060082 SYSTEM_FABRIC_ARB, 20),
Praveen Chidambaram78499012011-11-01 17:15:17 -060083 MSM_RPM_MAP(8930, MMSS_FABRIC_CFG_HALT_0,
84 MMSS_FABRIC_CFG_HALT, 2),
85 MSM_RPM_MAP(8930, MMSS_FABRIC_CFG_CLKMOD_0,
86 MMSS_FABRIC_CFG_CLKMOD, 3),
87 MSM_RPM_MAP(8930, MMSS_FABRIC_CFG_IOCTL,
88 MMSS_FABRIC_CFG_IOCTL, 1),
Mahesh Sivasubramanian2d2c70592012-03-20 17:07:24 -060089 MSM_RPM_MAP(8930, MM_FABRIC_ARB_0, MM_FABRIC_ARB, 11),
Praveen Chidambaram78499012011-11-01 17:15:17 -060090 MSM_RPM_MAP(8930, PM8038_S1_0, PM8038_S1, 2),
91 MSM_RPM_MAP(8930, PM8038_S2_0, PM8038_S2, 2),
92 MSM_RPM_MAP(8930, PM8038_S3_0, PM8038_S3, 2),
93 MSM_RPM_MAP(8930, PM8038_S4_0, PM8038_S4, 2),
94 MSM_RPM_MAP(8930, PM8038_S5_0, PM8038_S5, 2),
95 MSM_RPM_MAP(8930, PM8038_S6_0, PM8038_S6, 2),
96 MSM_RPM_MAP(8930, PM8038_L1_0, PM8038_L1, 2),
97 MSM_RPM_MAP(8930, PM8038_L2_0, PM8038_L2, 2),
98 MSM_RPM_MAP(8930, PM8038_L3_0, PM8038_L3, 2),
99 MSM_RPM_MAP(8930, PM8038_L4_0, PM8038_L4, 2),
100 MSM_RPM_MAP(8930, PM8038_L5_0, PM8038_L5, 2),
101 MSM_RPM_MAP(8930, PM8038_L6_0, PM8038_L6, 2),
102 MSM_RPM_MAP(8930, PM8038_L7_0, PM8038_L7, 2),
103 MSM_RPM_MAP(8930, PM8038_L8_0, PM8038_L8, 2),
104 MSM_RPM_MAP(8930, PM8038_L9_0, PM8038_L9, 2),
105 MSM_RPM_MAP(8930, PM8038_L10_0, PM8038_L10, 2),
106 MSM_RPM_MAP(8930, PM8038_L11_0, PM8038_L11, 2),
107 MSM_RPM_MAP(8930, PM8038_L12_0, PM8038_L12, 2),
108 MSM_RPM_MAP(8930, PM8038_L13_0, PM8038_L13, 2),
109 MSM_RPM_MAP(8930, PM8038_L14_0, PM8038_L14, 2),
110 MSM_RPM_MAP(8930, PM8038_L15_0, PM8038_L15, 2),
111 MSM_RPM_MAP(8930, PM8038_L16_0, PM8038_L16, 2),
112 MSM_RPM_MAP(8930, PM8038_L17_0, PM8038_L17, 2),
113 MSM_RPM_MAP(8930, PM8038_L18_0, PM8038_L18, 2),
114 MSM_RPM_MAP(8930, PM8038_L19_0, PM8038_L19, 2),
115 MSM_RPM_MAP(8930, PM8038_L20_0, PM8038_L20, 2),
116 MSM_RPM_MAP(8930, PM8038_L21_0, PM8038_L21, 2),
117 MSM_RPM_MAP(8930, PM8038_L22_0, PM8038_L22, 2),
118 MSM_RPM_MAP(8930, PM8038_L23_0, PM8038_L23, 2),
119 MSM_RPM_MAP(8930, PM8038_L24_0, PM8038_L24, 2),
120 MSM_RPM_MAP(8930, PM8038_L25_0, PM8038_L25, 2),
121 MSM_RPM_MAP(8930, PM8038_L26_0, PM8038_L26, 2),
122 MSM_RPM_MAP(8930, PM8038_L27_0, PM8038_L27, 2),
123 MSM_RPM_MAP(8930, PM8038_CLK1_0, PM8038_CLK1, 2),
124 MSM_RPM_MAP(8930, PM8038_CLK2_0, PM8038_CLK2, 2),
125 MSM_RPM_MAP(8930, PM8038_LVS1, PM8038_LVS1, 1),
126 MSM_RPM_MAP(8930, PM8038_LVS2, PM8038_LVS2, 1),
127 MSM_RPM_MAP(8930, NCP_0, NCP, 2),
128 MSM_RPM_MAP(8930, CXO_BUFFERS, CXO_BUFFERS, 1),
129 MSM_RPM_MAP(8930, USB_OTG_SWITCH, USB_OTG_SWITCH, 1),
130 MSM_RPM_MAP(8930, HDMI_SWITCH, HDMI_SWITCH, 1),
131 MSM_RPM_MAP(8930, QDSS_CLK, QDSS_CLK, 1),
Mahesh Sivasubramanian9e52ce42012-02-01 16:00:19 -0700132 MSM_RPM_MAP(8930, VOLTAGE_CORNER, VOLTAGE_CORNER, 1),
Praveen Chidambaram78499012011-11-01 17:15:17 -0600133 },
134 .target_status = {
135 MSM_RPM_STATUS_ID_MAP(8930, VERSION_MAJOR),
136 MSM_RPM_STATUS_ID_MAP(8930, VERSION_MINOR),
137 MSM_RPM_STATUS_ID_MAP(8930, VERSION_BUILD),
138 MSM_RPM_STATUS_ID_MAP(8930, SUPPORTED_RESOURCES_0),
139 MSM_RPM_STATUS_ID_MAP(8930, SUPPORTED_RESOURCES_1),
140 MSM_RPM_STATUS_ID_MAP(8930, SUPPORTED_RESOURCES_2),
141 MSM_RPM_STATUS_ID_MAP(8930, RESERVED_SUPPORTED_RESOURCES_0),
142 MSM_RPM_STATUS_ID_MAP(8930, SEQUENCE),
143 MSM_RPM_STATUS_ID_MAP(8930, RPM_CTL),
144 MSM_RPM_STATUS_ID_MAP(8930, CXO_CLK),
145 MSM_RPM_STATUS_ID_MAP(8930, PXO_CLK),
146 MSM_RPM_STATUS_ID_MAP(8930, APPS_FABRIC_CLK),
147 MSM_RPM_STATUS_ID_MAP(8930, SYSTEM_FABRIC_CLK),
148 MSM_RPM_STATUS_ID_MAP(8930, MM_FABRIC_CLK),
149 MSM_RPM_STATUS_ID_MAP(8930, DAYTONA_FABRIC_CLK),
150 MSM_RPM_STATUS_ID_MAP(8930, SFPB_CLK),
151 MSM_RPM_STATUS_ID_MAP(8930, CFPB_CLK),
152 MSM_RPM_STATUS_ID_MAP(8930, MMFPB_CLK),
153 MSM_RPM_STATUS_ID_MAP(8930, EBI1_CLK),
154 MSM_RPM_STATUS_ID_MAP(8930, APPS_FABRIC_CFG_HALT),
155 MSM_RPM_STATUS_ID_MAP(8930, APPS_FABRIC_CFG_CLKMOD),
156 MSM_RPM_STATUS_ID_MAP(8930, APPS_FABRIC_CFG_IOCTL),
157 MSM_RPM_STATUS_ID_MAP(8930, APPS_FABRIC_ARB),
158 MSM_RPM_STATUS_ID_MAP(8930, SYS_FABRIC_CFG_HALT),
159 MSM_RPM_STATUS_ID_MAP(8930, SYS_FABRIC_CFG_CLKMOD),
160 MSM_RPM_STATUS_ID_MAP(8930, SYS_FABRIC_CFG_IOCTL),
161 MSM_RPM_STATUS_ID_MAP(8930, SYSTEM_FABRIC_ARB),
162 MSM_RPM_STATUS_ID_MAP(8930, MMSS_FABRIC_CFG_HALT),
163 MSM_RPM_STATUS_ID_MAP(8930, MMSS_FABRIC_CFG_CLKMOD),
164 MSM_RPM_STATUS_ID_MAP(8930, MMSS_FABRIC_CFG_IOCTL),
165 MSM_RPM_STATUS_ID_MAP(8930, MM_FABRIC_ARB),
166 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S1_0),
167 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S1_1),
168 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S2_0),
169 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S2_1),
170 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S3_0),
171 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S3_1),
172 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S4_0),
173 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S4_1),
174 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L1_0),
175 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L1_1),
176 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L2_0),
177 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L2_1),
178 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L3_0),
179 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L3_1),
180 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L4_0),
181 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L4_1),
182 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L5_0),
183 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L5_1),
184 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L6_0),
185 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L6_1),
186 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L7_0),
187 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L7_1),
188 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L8_0),
189 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L8_1),
190 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L9_0),
191 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L9_1),
192 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L10_0),
193 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L10_1),
194 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L11_0),
195 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L11_1),
196 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L12_0),
197 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L12_1),
198 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L13_0),
199 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L13_1),
200 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L14_0),
201 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L14_1),
202 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L15_0),
203 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L15_1),
204 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L16_0),
205 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L16_1),
206 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L17_0),
207 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L17_1),
208 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L18_0),
209 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L18_1),
210 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L19_0),
211 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L19_1),
212 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L20_0),
213 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L20_1),
214 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L21_0),
215 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L21_1),
216 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L22_0),
217 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L22_1),
218 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L23_0),
219 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L23_1),
220 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L24_0),
221 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L24_1),
222 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L25_0),
223 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L25_1),
224 MSM_RPM_STATUS_ID_MAP(8930, PM8038_CLK1_0),
225 MSM_RPM_STATUS_ID_MAP(8930, PM8038_CLK1_1),
226 MSM_RPM_STATUS_ID_MAP(8930, PM8038_CLK2_0),
227 MSM_RPM_STATUS_ID_MAP(8930, PM8038_CLK2_1),
228 MSM_RPM_STATUS_ID_MAP(8930, PM8038_LVS1),
229 MSM_RPM_STATUS_ID_MAP(8930, PM8038_LVS2),
230 MSM_RPM_STATUS_ID_MAP(8930, NCP_0),
231 MSM_RPM_STATUS_ID_MAP(8930, NCP_1),
232 MSM_RPM_STATUS_ID_MAP(8930, CXO_BUFFERS),
233 MSM_RPM_STATUS_ID_MAP(8930, USB_OTG_SWITCH),
234 MSM_RPM_STATUS_ID_MAP(8930, HDMI_SWITCH),
Mahesh Sivasubramanianef2a0fa2012-01-24 15:57:01 -0700235 MSM_RPM_STATUS_ID_MAP(8930, QDSS_CLK),
Mahesh Sivasubramanian9e52ce42012-02-01 16:00:19 -0700236 MSM_RPM_STATUS_ID_MAP(8930, VOLTAGE_CORNER),
Praveen Chidambaram78499012011-11-01 17:15:17 -0600237 },
238 .target_ctrl_id = {
239 MSM_RPM_CTRL_MAP(8930, VERSION_MAJOR),
240 MSM_RPM_CTRL_MAP(8930, VERSION_MINOR),
241 MSM_RPM_CTRL_MAP(8930, VERSION_BUILD),
242 MSM_RPM_CTRL_MAP(8930, REQ_CTX_0),
243 MSM_RPM_CTRL_MAP(8930, REQ_SEL_0),
244 MSM_RPM_CTRL_MAP(8930, ACK_CTX_0),
245 MSM_RPM_CTRL_MAP(8930, ACK_SEL_0),
246 },
247 .sel_invalidate = MSM_RPM_8930_SEL_INVALIDATE,
248 .sel_notification = MSM_RPM_8930_SEL_NOTIFICATION,
249 .sel_last = MSM_RPM_8930_SEL_LAST,
250 .ver = {3, 0, 0},
251};
252
253struct platform_device msm8930_rpm_device = {
254 .name = "msm_rpm",
255 .id = -1,
256};
257
258static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
259 .phys_addr_base = 0x0010C000,
260 .reg_offsets = {
261 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
262 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
263 },
264 .phys_size = SZ_8K,
265 .log_len = 4096, /* log's buffer length in bytes */
266 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
267};
268
269struct platform_device msm8930_rpm_log_device = {
270 .name = "msm_rpm_log",
271 .id = -1,
272 .dev = {
273 .platform_data = &msm_rpm_log_pdata,
274 },
275};
276
277static struct msm_rpmstats_platform_data msm_rpm_stat_pdata = {
278 .phys_addr_base = 0x0010D204,
279 .phys_size = SZ_8K,
280};
281
282struct platform_device msm8930_rpm_stat_device = {
283 .name = "msm_rpm_stat",
284 .id = -1,
285 .dev = {
286 .platform_data = &msm_rpm_stat_pdata,
287 },
288};
289
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -0700290static int msm8930_LPM_latency = 1000; /* >100 usec for WFI */
291
292struct platform_device msm8930_cpu_idle_device = {
293 .name = "msm_cpu_idle",
294 .id = -1,
295 .dev = {
296 .platform_data = &msm8930_LPM_latency,
297 },
298};
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -0700299
300static struct msm_dcvs_freq_entry msm8930_freq[] = {
301 { 384000, 166981, 345600},
302 { 702000, 213049, 632502},
303 {1026000, 285712, 925613},
304 {1242000, 383945, 1176550},
305 {1458000, 419729, 1465478},
306 {1512000, 434116, 1546674},
307
308};
309
310static struct msm_dcvs_core_info msm8930_core_info = {
311 .freq_tbl = &msm8930_freq[0],
312 .core_param = {
313 .max_time_us = 100000,
314 .num_freq = ARRAY_SIZE(msm8930_freq),
315 },
316 .algo_param = {
317 .slack_time_us = 58000,
318 .scale_slack_time = 0,
319 .scale_slack_time_pct = 0,
320 .disable_pc_threshold = 1458000,
321 .em_window_size = 100000,
322 .em_max_util_pct = 97,
323 .ss_window_size = 1000000,
324 .ss_util_pct = 95,
325 .ss_iobusy_conv = 100,
326 },
327};
328
329struct platform_device msm8930_msm_gov_device = {
330 .name = "msm_dcvs_gov",
331 .id = -1,
332 .dev = {
333 .platform_data = &msm8930_core_info,
334 },
335};
Gagan Maccd5b3272012-02-09 18:13:10 -0700336
337struct platform_device msm_bus_8930_sys_fabric = {
338 .name = "msm_bus_fabric",
339 .id = MSM_BUS_FAB_SYSTEM,
340};
341struct platform_device msm_bus_8930_apps_fabric = {
342 .name = "msm_bus_fabric",
343 .id = MSM_BUS_FAB_APPSS,
344};
345struct platform_device msm_bus_8930_mm_fabric = {
346 .name = "msm_bus_fabric",
347 .id = MSM_BUS_FAB_MMSS,
348};
349struct platform_device msm_bus_8930_sys_fpb = {
350 .name = "msm_bus_fabric",
351 .id = MSM_BUS_FAB_SYSTEM_FPB,
352};
353struct platform_device msm_bus_8930_cpss_fpb = {
354 .name = "msm_bus_fabric",
355 .id = MSM_BUS_FAB_CPSS_FPB,
356};
357
Matt Wagantall1f65d9d2012-04-25 14:24:20 -0700358static struct fs_driver_data gfx3d_fs_data = {
359 .clks = (struct fs_clk_data[]){
360 { .name = "core_clk", .reset_rate = 27000000 },
361 { .name = "iface_clk" },
362 { .name = "bus_clk" },
363 { 0 }
364 },
365 .bus_port0 = MSM_BUS_MASTER_GRAPHICS_3D,
366};
367
368static struct fs_driver_data ijpeg_fs_data = {
369 .clks = (struct fs_clk_data[]){
370 { .name = "core_clk" },
371 { .name = "iface_clk" },
372 { .name = "bus_clk" },
373 { 0 }
374 },
375 .bus_port0 = MSM_BUS_MASTER_JPEG_ENC,
376};
377
378static struct fs_driver_data mdp_fs_data = {
379 .clks = (struct fs_clk_data[]){
380 { .name = "core_clk" },
381 { .name = "iface_clk" },
382 { .name = "bus_clk" },
383 { .name = "vsync_clk" },
384 { .name = "lut_clk" },
385 { .name = "tv_src_clk" },
386 { .name = "tv_clk" },
387 { 0 }
388 },
389 .bus_port0 = MSM_BUS_MASTER_MDP_PORT0,
390 .bus_port1 = MSM_BUS_MASTER_MDP_PORT1,
391};
392
393static struct fs_driver_data rot_fs_data = {
394 .clks = (struct fs_clk_data[]){
395 { .name = "core_clk" },
396 { .name = "iface_clk" },
397 { .name = "bus_clk" },
398 { 0 }
399 },
400 .bus_port0 = MSM_BUS_MASTER_ROTATOR,
401};
402
403static struct fs_driver_data ved_fs_data = {
404 .clks = (struct fs_clk_data[]){
405 { .name = "core_clk" },
406 { .name = "iface_clk" },
407 { .name = "bus_clk" },
408 { 0 }
409 },
410 .bus_port0 = MSM_BUS_MASTER_HD_CODEC_PORT0,
411 .bus_port1 = MSM_BUS_MASTER_HD_CODEC_PORT1,
412};
413
414static struct fs_driver_data vfe_fs_data = {
415 .clks = (struct fs_clk_data[]){
416 { .name = "core_clk" },
417 { .name = "iface_clk" },
418 { .name = "bus_clk" },
419 { 0 }
420 },
421 .bus_port0 = MSM_BUS_MASTER_VFE,
422};
423
424static struct fs_driver_data vpe_fs_data = {
425 .clks = (struct fs_clk_data[]){
426 { .name = "core_clk" },
427 { .name = "iface_clk" },
428 { .name = "bus_clk" },
429 { 0 }
430 },
431 .bus_port0 = MSM_BUS_MASTER_VPE,
432};
433
434struct platform_device *msm8930_footswitch[] __initdata = {
Matt Wagantalld4aab1e2012-05-03 20:26:56 -0700435 FS_8X60(FS_MDP, "vdd", "mdp.0", &mdp_fs_data),
Matt Wagantall316f2fc2012-05-03 20:41:42 -0700436 FS_8X60(FS_ROT, "vdd", "msm_rotator.0", &rot_fs_data),
Matt Wagantalle4454b82012-05-03 20:48:01 -0700437 FS_8X60(FS_IJPEG, "vdd", "msm_gemini.0", &ijpeg_fs_data),
Matt Wagantall5c922112012-05-03 19:25:28 -0700438 FS_8X60(FS_VFE, "fs_vfe", NULL, &vfe_fs_data),
439 FS_8X60(FS_VPE, "fs_vpe", NULL, &vpe_fs_data),
Matt Wagantalld6fbf232012-05-03 20:09:28 -0700440 FS_8X60(FS_GFX3D, "vdd", "kgsl-3d0.0", &gfx3d_fs_data),
Matt Wagantall5e46aac2012-05-03 20:20:18 -0700441 FS_8X60(FS_VED, "vdd", "msm_vidc.0", &ved_fs_data),
Matt Wagantall1f65d9d2012-04-25 14:24:20 -0700442};
443unsigned msm8930_num_footswitch __initdata = ARRAY_SIZE(msm8930_footswitch);
444
Arun Menonaabf2632012-02-24 15:30:47 -0800445/* MSM Video core device */
446#ifdef CONFIG_MSM_BUS_SCALING
447static struct msm_bus_vectors vidc_init_vectors[] = {
448 {
449 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
450 .dst = MSM_BUS_SLAVE_EBI_CH0,
451 .ab = 0,
452 .ib = 0,
453 },
454 {
455 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
456 .dst = MSM_BUS_SLAVE_EBI_CH0,
457 .ab = 0,
458 .ib = 0,
459 },
460 {
461 .src = MSM_BUS_MASTER_AMPSS_M0,
462 .dst = MSM_BUS_SLAVE_EBI_CH0,
463 .ab = 0,
464 .ib = 0,
465 },
466 {
467 .src = MSM_BUS_MASTER_AMPSS_M0,
468 .dst = MSM_BUS_SLAVE_EBI_CH0,
469 .ab = 0,
470 .ib = 0,
471 },
472};
473static struct msm_bus_vectors vidc_venc_vga_vectors[] = {
474 {
475 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
476 .dst = MSM_BUS_SLAVE_EBI_CH0,
477 .ab = 54525952,
478 .ib = 436207616,
479 },
480 {
481 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
482 .dst = MSM_BUS_SLAVE_EBI_CH0,
483 .ab = 72351744,
484 .ib = 289406976,
485 },
486 {
487 .src = MSM_BUS_MASTER_AMPSS_M0,
488 .dst = MSM_BUS_SLAVE_EBI_CH0,
489 .ab = 500000,
490 .ib = 1000000,
491 },
492 {
493 .src = MSM_BUS_MASTER_AMPSS_M0,
494 .dst = MSM_BUS_SLAVE_EBI_CH0,
495 .ab = 500000,
496 .ib = 1000000,
497 },
498};
499static struct msm_bus_vectors vidc_vdec_vga_vectors[] = {
500 {
501 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
502 .dst = MSM_BUS_SLAVE_EBI_CH0,
503 .ab = 40894464,
504 .ib = 327155712,
505 },
506 {
507 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
508 .dst = MSM_BUS_SLAVE_EBI_CH0,
509 .ab = 48234496,
510 .ib = 192937984,
511 },
512 {
513 .src = MSM_BUS_MASTER_AMPSS_M0,
514 .dst = MSM_BUS_SLAVE_EBI_CH0,
515 .ab = 500000,
516 .ib = 2000000,
517 },
518 {
519 .src = MSM_BUS_MASTER_AMPSS_M0,
520 .dst = MSM_BUS_SLAVE_EBI_CH0,
521 .ab = 500000,
522 .ib = 2000000,
523 },
524};
525static struct msm_bus_vectors vidc_venc_720p_vectors[] = {
526 {
527 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
528 .dst = MSM_BUS_SLAVE_EBI_CH0,
529 .ab = 163577856,
530 .ib = 1308622848,
531 },
532 {
533 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
534 .dst = MSM_BUS_SLAVE_EBI_CH0,
535 .ab = 219152384,
536 .ib = 876609536,
537 },
538 {
539 .src = MSM_BUS_MASTER_AMPSS_M0,
540 .dst = MSM_BUS_SLAVE_EBI_CH0,
541 .ab = 1750000,
542 .ib = 3500000,
543 },
544 {
545 .src = MSM_BUS_MASTER_AMPSS_M0,
546 .dst = MSM_BUS_SLAVE_EBI_CH0,
547 .ab = 1750000,
548 .ib = 3500000,
549 },
550};
551static struct msm_bus_vectors vidc_vdec_720p_vectors[] = {
552 {
553 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
554 .dst = MSM_BUS_SLAVE_EBI_CH0,
555 .ab = 121634816,
556 .ib = 973078528,
557 },
558 {
559 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
560 .dst = MSM_BUS_SLAVE_EBI_CH0,
561 .ab = 155189248,
562 .ib = 620756992,
563 },
564 {
565 .src = MSM_BUS_MASTER_AMPSS_M0,
566 .dst = MSM_BUS_SLAVE_EBI_CH0,
567 .ab = 1750000,
568 .ib = 7000000,
569 },
570 {
571 .src = MSM_BUS_MASTER_AMPSS_M0,
572 .dst = MSM_BUS_SLAVE_EBI_CH0,
573 .ab = 1750000,
574 .ib = 7000000,
575 },
576};
577static struct msm_bus_vectors vidc_venc_1080p_vectors[] = {
578 {
579 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
580 .dst = MSM_BUS_SLAVE_EBI_CH0,
581 .ab = 372244480,
582 .ib = 2560000000U,
583 },
584 {
585 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
586 .dst = MSM_BUS_SLAVE_EBI_CH0,
587 .ab = 501219328,
588 .ib = 2560000000U,
589 },
590 {
591 .src = MSM_BUS_MASTER_AMPSS_M0,
592 .dst = MSM_BUS_SLAVE_EBI_CH0,
593 .ab = 2500000,
594 .ib = 5000000,
595 },
596 {
597 .src = MSM_BUS_MASTER_AMPSS_M0,
598 .dst = MSM_BUS_SLAVE_EBI_CH0,
599 .ab = 2500000,
600 .ib = 5000000,
601 },
602};
603static struct msm_bus_vectors vidc_vdec_1080p_vectors[] = {
604 {
605 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
606 .dst = MSM_BUS_SLAVE_EBI_CH0,
607 .ab = 222298112,
608 .ib = 2560000000U,
609 },
610 {
611 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
612 .dst = MSM_BUS_SLAVE_EBI_CH0,
613 .ab = 330301440,
614 .ib = 2560000000U,
615 },
616 {
617 .src = MSM_BUS_MASTER_AMPSS_M0,
618 .dst = MSM_BUS_SLAVE_EBI_CH0,
619 .ab = 2500000,
620 .ib = 700000000,
621 },
622 {
623 .src = MSM_BUS_MASTER_AMPSS_M0,
624 .dst = MSM_BUS_SLAVE_EBI_CH0,
625 .ab = 2500000,
626 .ib = 10000000,
627 },
628};
629
630static struct msm_bus_paths vidc_bus_client_config[] = {
631 {
632 ARRAY_SIZE(vidc_init_vectors),
633 vidc_init_vectors,
634 },
635 {
636 ARRAY_SIZE(vidc_venc_vga_vectors),
637 vidc_venc_vga_vectors,
638 },
639 {
640 ARRAY_SIZE(vidc_vdec_vga_vectors),
641 vidc_vdec_vga_vectors,
642 },
643 {
644 ARRAY_SIZE(vidc_venc_720p_vectors),
645 vidc_venc_720p_vectors,
646 },
647 {
648 ARRAY_SIZE(vidc_vdec_720p_vectors),
649 vidc_vdec_720p_vectors,
650 },
651 {
652 ARRAY_SIZE(vidc_venc_1080p_vectors),
653 vidc_venc_1080p_vectors,
654 },
655 {
656 ARRAY_SIZE(vidc_vdec_1080p_vectors),
657 vidc_vdec_1080p_vectors,
658 },
659};
660
661static struct msm_bus_scale_pdata vidc_bus_client_data = {
662 vidc_bus_client_config,
663 ARRAY_SIZE(vidc_bus_client_config),
664 .name = "vidc",
665};
666#endif
667
668#define MSM_VIDC_BASE_PHYS 0x04400000
669#define MSM_VIDC_BASE_SIZE 0x00100000
670
671static struct resource apq8930_device_vidc_resources[] = {
672 {
673 .start = MSM_VIDC_BASE_PHYS,
674 .end = MSM_VIDC_BASE_PHYS + MSM_VIDC_BASE_SIZE - 1,
675 .flags = IORESOURCE_MEM,
676 },
677 {
678 .start = VCODEC_IRQ,
679 .end = VCODEC_IRQ,
680 .flags = IORESOURCE_IRQ,
681 },
682};
683
684struct msm_vidc_platform_data apq8930_vidc_platform_data = {
685#ifdef CONFIG_MSM_BUS_SCALING
686 .vidc_bus_client_pdata = &vidc_bus_client_data,
687#endif
688#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
689 .memtype = ION_CP_MM_HEAP_ID,
690 .enable_ion = 1,
Deepak Kotur8097f782012-05-14 14:13:06 -0700691 .cp_enabled = 1,
Arun Menonaabf2632012-02-24 15:30:47 -0800692#else
693 .memtype = MEMTYPE_EBI1,
694 .enable_ion = 0,
695#endif
Anil Gahlotd0ce26d2012-05-08 17:58:46 -0700696 .disable_dmx = 1,
Arun Menonaabf2632012-02-24 15:30:47 -0800697 .disable_fullhd = 0,
Riaz Rahaman84f8c682012-05-30 13:32:10 +0530698 .fw_addr = 0x9fe00000,
Arun Menonaabf2632012-02-24 15:30:47 -0800699};
700
701struct platform_device apq8930_msm_device_vidc = {
702 .name = "msm_vidc",
703 .id = 0,
704 .num_resources = ARRAY_SIZE(apq8930_device_vidc_resources),
705 .resource = apq8930_device_vidc_resources,
706 .dev = {
707 .platform_data = &apq8930_vidc_platform_data,
708 },
709};
710
711struct platform_device *vidc_device[] __initdata = {
712 &apq8930_msm_device_vidc
713};
714
715void __init msm8930_add_vidc_device(void)
716{
717 if (cpu_is_msm8627()) {
718 struct msm_vidc_platform_data *pdata;
719 pdata = (struct msm_vidc_platform_data *)
720 apq8930_msm_device_vidc.dev.platform_data;
721 pdata->disable_fullhd = 1;
722 }
723 platform_add_devices(vidc_device, ARRAY_SIZE(vidc_device));
724}
Laura Abbott0577d7b2012-04-17 11:14:30 -0700725
726struct msm_iommu_domain_name msm8930_iommu_ctx_names[] = {
727 /* Camera */
728 {
729 .name = "vpe_src",
730 .domain = CAMERA_DOMAIN,
731 },
732 /* Camera */
733 {
734 .name = "vpe_dst",
735 .domain = CAMERA_DOMAIN,
736 },
737 /* Camera */
738 {
739 .name = "vfe_imgwr",
740 .domain = CAMERA_DOMAIN,
741 },
742 /* Camera */
743 {
744 .name = "vfe_misc",
745 .domain = CAMERA_DOMAIN,
746 },
747 /* Camera */
748 {
749 .name = "ijpeg_src",
750 .domain = CAMERA_DOMAIN,
751 },
752 /* Camera */
753 {
754 .name = "ijpeg_dst",
755 .domain = CAMERA_DOMAIN,
756 },
757 /* Camera */
758 {
759 .name = "jpegd_src",
760 .domain = CAMERA_DOMAIN,
761 },
762 /* Camera */
763 {
764 .name = "jpegd_dst",
765 .domain = CAMERA_DOMAIN,
766 },
767 /* Rotator */
768 {
769 .name = "rot_src",
Mayank Chopra9c4743f2012-06-27 15:31:43 +0530770 .domain = ROTATOR_DOMAIN,
Laura Abbott0577d7b2012-04-17 11:14:30 -0700771 },
772 /* Rotator */
773 {
774 .name = "rot_dst",
Mayank Chopra9c4743f2012-06-27 15:31:43 +0530775 .domain = ROTATOR_DOMAIN,
Laura Abbott0577d7b2012-04-17 11:14:30 -0700776 },
777 /* Video */
778 {
779 .name = "vcodec_a_mm1",
780 .domain = VIDEO_DOMAIN,
781 },
782 /* Video */
783 {
784 .name = "vcodec_b_mm2",
785 .domain = VIDEO_DOMAIN,
786 },
787 /* Video */
788 {
789 .name = "vcodec_a_stream",
790 .domain = VIDEO_DOMAIN,
791 },
792};
793
794static struct mem_pool msm8930_video_pools[] = {
795 /*
796 * Video hardware has the following requirements:
797 * 1. All video addresses used by the video hardware must be at a higher
798 * address than video firmware address.
799 * 2. Video hardware can only access a range of 256MB from the base of
800 * the video firmware.
801 */
802 [VIDEO_FIRMWARE_POOL] =
803 /* Low addresses, intended for video firmware */
804 {
805 .paddr = SZ_128K,
806 .size = SZ_16M - SZ_128K,
807 },
808 [VIDEO_MAIN_POOL] =
809 /* Main video pool */
810 {
811 .paddr = SZ_16M,
812 .size = SZ_256M - SZ_16M,
813 },
814 [GEN_POOL] =
815 /* Remaining address space up to 2G */
816 {
817 .paddr = SZ_256M,
818 .size = SZ_2G - SZ_256M,
819 },
820};
821
822static struct mem_pool msm8930_camera_pools[] = {
823 [GEN_POOL] =
824 /* One address space for camera */
825 {
826 .paddr = SZ_128K,
827 .size = SZ_2G - SZ_128K,
828 },
829};
830
Mayank Chopra9c4743f2012-06-27 15:31:43 +0530831static struct mem_pool msm8930_display_pools[] = {
Laura Abbott0577d7b2012-04-17 11:14:30 -0700832 [GEN_POOL] =
Mayank Chopra9c4743f2012-06-27 15:31:43 +0530833 /* One address space for display */
Laura Abbott0577d7b2012-04-17 11:14:30 -0700834 {
835 .paddr = SZ_128K,
836 .size = SZ_2G - SZ_128K,
837 },
838};
839
Mayank Chopra9c4743f2012-06-27 15:31:43 +0530840static struct mem_pool msm8930_rotator_pools[] = {
Laura Abbott0577d7b2012-04-17 11:14:30 -0700841 [GEN_POOL] =
Mayank Chopra9c4743f2012-06-27 15:31:43 +0530842 /* One address space for rotator */
Laura Abbott0577d7b2012-04-17 11:14:30 -0700843 {
844 .paddr = SZ_128K,
845 .size = SZ_2G - SZ_128K,
846 },
847};
848
849static struct msm_iommu_domain msm8930_iommu_domains[] = {
850 [VIDEO_DOMAIN] = {
851 .iova_pools = msm8930_video_pools,
852 .npools = ARRAY_SIZE(msm8930_video_pools),
853 },
854 [CAMERA_DOMAIN] = {
855 .iova_pools = msm8930_camera_pools,
856 .npools = ARRAY_SIZE(msm8930_camera_pools),
857 },
Mayank Chopra9c4743f2012-06-27 15:31:43 +0530858 [DISPLAY_DOMAIN] = {
859 .iova_pools = msm8930_display_pools,
860 .npools = ARRAY_SIZE(msm8930_display_pools),
Laura Abbott0577d7b2012-04-17 11:14:30 -0700861 },
Mayank Chopra9c4743f2012-06-27 15:31:43 +0530862 [ROTATOR_DOMAIN] = {
863 .iova_pools = msm8930_rotator_pools,
864 .npools = ARRAY_SIZE(msm8930_rotator_pools),
Laura Abbott0577d7b2012-04-17 11:14:30 -0700865 },
866};
867
868struct iommu_domains_pdata msm8930_iommu_domain_pdata = {
869 .domains = msm8930_iommu_domains,
870 .ndomains = ARRAY_SIZE(msm8930_iommu_domains),
871 .domain_names = msm8930_iommu_ctx_names,
872 .nnames = ARRAY_SIZE(msm8930_iommu_ctx_names),
873 .domain_alloc_flags = 0,
874};
875
876struct platform_device msm8930_iommu_domain_device = {
877 .name = "iommu_domains",
878 .id = -1,
879 .dev = {
880 .platform_data = &msm8930_iommu_domain_pdata,
Laura Abbott532b2df2012-04-12 10:53:48 -0700881 }
882};
883
884struct msm_rtb_platform_data msm8930_rtb_pdata = {
885 .size = SZ_1M,
886};
887
888static int __init msm_rtb_set_buffer_size(char *p)
889{
890 int s;
891
892 s = memparse(p, NULL);
893 msm8930_rtb_pdata.size = ALIGN(s, SZ_4K);
894 return 0;
895}
896early_param("msm_rtb_size", msm_rtb_set_buffer_size);
897
898
899struct platform_device msm8930_rtb_device = {
900 .name = "msm_rtb",
901 .id = -1,
902 .dev = {
903 .platform_data = &msm8930_rtb_pdata,
Laura Abbott0577d7b2012-04-17 11:14:30 -0700904 },
905};
Laura Abbottf3173042012-05-29 15:23:18 -0700906
907#define MSM8930_L1_SIZE SZ_1M
908/*
909 * The actual L2 size is smaller but we need a larger buffer
910 * size to store other dump information
911 */
912#define MSM8930_L2_SIZE SZ_4M
913
914struct msm_cache_dump_platform_data msm8930_cache_dump_pdata = {
915 .l2_size = MSM8930_L2_SIZE,
916 .l1_size = MSM8930_L1_SIZE,
917};
918
919struct platform_device msm8930_cache_dump_device = {
920 .name = "msm_cache_dump",
921 .id = -1,
922 .dev = {
923 .platform_data = &msm8930_cache_dump_pdata,
924 },
925};