blob: 4aff4246f726174393ecd8498c59173f8c95710d [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 Wagantall6dcfa922012-06-07 20:13:51 -0700358struct platform_device msm8930_device_acpuclk = {
359 .name = "acpuclk-8930",
360 .id = -1,
361};
362
Matt Wagantall1f65d9d2012-04-25 14:24:20 -0700363static struct fs_driver_data gfx3d_fs_data = {
364 .clks = (struct fs_clk_data[]){
365 { .name = "core_clk", .reset_rate = 27000000 },
366 { .name = "iface_clk" },
367 { .name = "bus_clk" },
368 { 0 }
369 },
370 .bus_port0 = MSM_BUS_MASTER_GRAPHICS_3D,
371};
372
373static struct fs_driver_data ijpeg_fs_data = {
374 .clks = (struct fs_clk_data[]){
375 { .name = "core_clk" },
376 { .name = "iface_clk" },
377 { .name = "bus_clk" },
378 { 0 }
379 },
380 .bus_port0 = MSM_BUS_MASTER_JPEG_ENC,
381};
382
383static struct fs_driver_data mdp_fs_data = {
384 .clks = (struct fs_clk_data[]){
385 { .name = "core_clk" },
386 { .name = "iface_clk" },
387 { .name = "bus_clk" },
388 { .name = "vsync_clk" },
389 { .name = "lut_clk" },
390 { .name = "tv_src_clk" },
391 { .name = "tv_clk" },
392 { 0 }
393 },
394 .bus_port0 = MSM_BUS_MASTER_MDP_PORT0,
395 .bus_port1 = MSM_BUS_MASTER_MDP_PORT1,
396};
397
398static struct fs_driver_data rot_fs_data = {
399 .clks = (struct fs_clk_data[]){
400 { .name = "core_clk" },
401 { .name = "iface_clk" },
402 { .name = "bus_clk" },
403 { 0 }
404 },
405 .bus_port0 = MSM_BUS_MASTER_ROTATOR,
406};
407
408static struct fs_driver_data ved_fs_data = {
409 .clks = (struct fs_clk_data[]){
410 { .name = "core_clk" },
411 { .name = "iface_clk" },
412 { .name = "bus_clk" },
413 { 0 }
414 },
415 .bus_port0 = MSM_BUS_MASTER_HD_CODEC_PORT0,
416 .bus_port1 = MSM_BUS_MASTER_HD_CODEC_PORT1,
417};
418
419static struct fs_driver_data vfe_fs_data = {
420 .clks = (struct fs_clk_data[]){
421 { .name = "core_clk" },
422 { .name = "iface_clk" },
423 { .name = "bus_clk" },
424 { 0 }
425 },
426 .bus_port0 = MSM_BUS_MASTER_VFE,
427};
428
429static struct fs_driver_data vpe_fs_data = {
430 .clks = (struct fs_clk_data[]){
431 { .name = "core_clk" },
432 { .name = "iface_clk" },
433 { .name = "bus_clk" },
434 { 0 }
435 },
436 .bus_port0 = MSM_BUS_MASTER_VPE,
437};
438
439struct platform_device *msm8930_footswitch[] __initdata = {
Matt Wagantalld4aab1e2012-05-03 20:26:56 -0700440 FS_8X60(FS_MDP, "vdd", "mdp.0", &mdp_fs_data),
Matt Wagantall316f2fc2012-05-03 20:41:42 -0700441 FS_8X60(FS_ROT, "vdd", "msm_rotator.0", &rot_fs_data),
Matt Wagantalle4454b82012-05-03 20:48:01 -0700442 FS_8X60(FS_IJPEG, "vdd", "msm_gemini.0", &ijpeg_fs_data),
Kiran Kumar H Nfa18a032012-06-25 14:34:18 -0700443 FS_8X60(FS_VFE, "vdd", "msm_vfe.0", &vfe_fs_data),
444 FS_8X60(FS_VPE, "vdd", "msm_vpe.0", &vpe_fs_data),
Matt Wagantalld6fbf232012-05-03 20:09:28 -0700445 FS_8X60(FS_GFX3D, "vdd", "kgsl-3d0.0", &gfx3d_fs_data),
Matt Wagantall5e46aac2012-05-03 20:20:18 -0700446 FS_8X60(FS_VED, "vdd", "msm_vidc.0", &ved_fs_data),
Matt Wagantall1f65d9d2012-04-25 14:24:20 -0700447};
448unsigned msm8930_num_footswitch __initdata = ARRAY_SIZE(msm8930_footswitch);
449
Arun Menonaabf2632012-02-24 15:30:47 -0800450/* MSM Video core device */
451#ifdef CONFIG_MSM_BUS_SCALING
452static struct msm_bus_vectors vidc_init_vectors[] = {
453 {
454 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
455 .dst = MSM_BUS_SLAVE_EBI_CH0,
456 .ab = 0,
457 .ib = 0,
458 },
459 {
460 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
461 .dst = MSM_BUS_SLAVE_EBI_CH0,
462 .ab = 0,
463 .ib = 0,
464 },
465 {
466 .src = MSM_BUS_MASTER_AMPSS_M0,
467 .dst = MSM_BUS_SLAVE_EBI_CH0,
468 .ab = 0,
469 .ib = 0,
470 },
471 {
472 .src = MSM_BUS_MASTER_AMPSS_M0,
473 .dst = MSM_BUS_SLAVE_EBI_CH0,
474 .ab = 0,
475 .ib = 0,
476 },
477};
478static struct msm_bus_vectors vidc_venc_vga_vectors[] = {
479 {
480 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
481 .dst = MSM_BUS_SLAVE_EBI_CH0,
482 .ab = 54525952,
483 .ib = 436207616,
484 },
485 {
486 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
487 .dst = MSM_BUS_SLAVE_EBI_CH0,
488 .ab = 72351744,
489 .ib = 289406976,
490 },
491 {
492 .src = MSM_BUS_MASTER_AMPSS_M0,
493 .dst = MSM_BUS_SLAVE_EBI_CH0,
494 .ab = 500000,
495 .ib = 1000000,
496 },
497 {
498 .src = MSM_BUS_MASTER_AMPSS_M0,
499 .dst = MSM_BUS_SLAVE_EBI_CH0,
500 .ab = 500000,
501 .ib = 1000000,
502 },
503};
504static struct msm_bus_vectors vidc_vdec_vga_vectors[] = {
505 {
506 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
507 .dst = MSM_BUS_SLAVE_EBI_CH0,
508 .ab = 40894464,
509 .ib = 327155712,
510 },
511 {
512 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
513 .dst = MSM_BUS_SLAVE_EBI_CH0,
514 .ab = 48234496,
515 .ib = 192937984,
516 },
517 {
518 .src = MSM_BUS_MASTER_AMPSS_M0,
519 .dst = MSM_BUS_SLAVE_EBI_CH0,
520 .ab = 500000,
521 .ib = 2000000,
522 },
523 {
524 .src = MSM_BUS_MASTER_AMPSS_M0,
525 .dst = MSM_BUS_SLAVE_EBI_CH0,
526 .ab = 500000,
527 .ib = 2000000,
528 },
529};
530static struct msm_bus_vectors vidc_venc_720p_vectors[] = {
531 {
532 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
533 .dst = MSM_BUS_SLAVE_EBI_CH0,
534 .ab = 163577856,
535 .ib = 1308622848,
536 },
537 {
538 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
539 .dst = MSM_BUS_SLAVE_EBI_CH0,
540 .ab = 219152384,
541 .ib = 876609536,
542 },
543 {
544 .src = MSM_BUS_MASTER_AMPSS_M0,
545 .dst = MSM_BUS_SLAVE_EBI_CH0,
546 .ab = 1750000,
547 .ib = 3500000,
548 },
549 {
550 .src = MSM_BUS_MASTER_AMPSS_M0,
551 .dst = MSM_BUS_SLAVE_EBI_CH0,
552 .ab = 1750000,
553 .ib = 3500000,
554 },
555};
556static struct msm_bus_vectors vidc_vdec_720p_vectors[] = {
557 {
558 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
559 .dst = MSM_BUS_SLAVE_EBI_CH0,
560 .ab = 121634816,
561 .ib = 973078528,
562 },
563 {
564 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
565 .dst = MSM_BUS_SLAVE_EBI_CH0,
566 .ab = 155189248,
567 .ib = 620756992,
568 },
569 {
570 .src = MSM_BUS_MASTER_AMPSS_M0,
571 .dst = MSM_BUS_SLAVE_EBI_CH0,
572 .ab = 1750000,
573 .ib = 7000000,
574 },
575 {
576 .src = MSM_BUS_MASTER_AMPSS_M0,
577 .dst = MSM_BUS_SLAVE_EBI_CH0,
578 .ab = 1750000,
579 .ib = 7000000,
580 },
581};
582static struct msm_bus_vectors vidc_venc_1080p_vectors[] = {
583 {
584 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
585 .dst = MSM_BUS_SLAVE_EBI_CH0,
586 .ab = 372244480,
587 .ib = 2560000000U,
588 },
589 {
590 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
591 .dst = MSM_BUS_SLAVE_EBI_CH0,
592 .ab = 501219328,
593 .ib = 2560000000U,
594 },
595 {
596 .src = MSM_BUS_MASTER_AMPSS_M0,
597 .dst = MSM_BUS_SLAVE_EBI_CH0,
598 .ab = 2500000,
599 .ib = 5000000,
600 },
601 {
602 .src = MSM_BUS_MASTER_AMPSS_M0,
603 .dst = MSM_BUS_SLAVE_EBI_CH0,
604 .ab = 2500000,
605 .ib = 5000000,
606 },
607};
608static struct msm_bus_vectors vidc_vdec_1080p_vectors[] = {
609 {
610 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
611 .dst = MSM_BUS_SLAVE_EBI_CH0,
612 .ab = 222298112,
613 .ib = 2560000000U,
614 },
615 {
616 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
617 .dst = MSM_BUS_SLAVE_EBI_CH0,
618 .ab = 330301440,
619 .ib = 2560000000U,
620 },
621 {
622 .src = MSM_BUS_MASTER_AMPSS_M0,
623 .dst = MSM_BUS_SLAVE_EBI_CH0,
624 .ab = 2500000,
625 .ib = 700000000,
626 },
627 {
628 .src = MSM_BUS_MASTER_AMPSS_M0,
629 .dst = MSM_BUS_SLAVE_EBI_CH0,
630 .ab = 2500000,
631 .ib = 10000000,
632 },
633};
634
635static struct msm_bus_paths vidc_bus_client_config[] = {
636 {
637 ARRAY_SIZE(vidc_init_vectors),
638 vidc_init_vectors,
639 },
640 {
641 ARRAY_SIZE(vidc_venc_vga_vectors),
642 vidc_venc_vga_vectors,
643 },
644 {
645 ARRAY_SIZE(vidc_vdec_vga_vectors),
646 vidc_vdec_vga_vectors,
647 },
648 {
649 ARRAY_SIZE(vidc_venc_720p_vectors),
650 vidc_venc_720p_vectors,
651 },
652 {
653 ARRAY_SIZE(vidc_vdec_720p_vectors),
654 vidc_vdec_720p_vectors,
655 },
656 {
657 ARRAY_SIZE(vidc_venc_1080p_vectors),
658 vidc_venc_1080p_vectors,
659 },
660 {
661 ARRAY_SIZE(vidc_vdec_1080p_vectors),
662 vidc_vdec_1080p_vectors,
663 },
664};
665
666static struct msm_bus_scale_pdata vidc_bus_client_data = {
667 vidc_bus_client_config,
668 ARRAY_SIZE(vidc_bus_client_config),
669 .name = "vidc",
670};
671#endif
672
673#define MSM_VIDC_BASE_PHYS 0x04400000
674#define MSM_VIDC_BASE_SIZE 0x00100000
675
676static struct resource apq8930_device_vidc_resources[] = {
677 {
678 .start = MSM_VIDC_BASE_PHYS,
679 .end = MSM_VIDC_BASE_PHYS + MSM_VIDC_BASE_SIZE - 1,
680 .flags = IORESOURCE_MEM,
681 },
682 {
683 .start = VCODEC_IRQ,
684 .end = VCODEC_IRQ,
685 .flags = IORESOURCE_IRQ,
686 },
687};
688
689struct msm_vidc_platform_data apq8930_vidc_platform_data = {
690#ifdef CONFIG_MSM_BUS_SCALING
691 .vidc_bus_client_pdata = &vidc_bus_client_data,
692#endif
693#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
694 .memtype = ION_CP_MM_HEAP_ID,
695 .enable_ion = 1,
Deepak Kotur8097f782012-05-14 14:13:06 -0700696 .cp_enabled = 1,
Arun Menonaabf2632012-02-24 15:30:47 -0800697#else
698 .memtype = MEMTYPE_EBI1,
699 .enable_ion = 0,
700#endif
Anil Gahlotd0ce26d2012-05-08 17:58:46 -0700701 .disable_dmx = 1,
Arun Menonaabf2632012-02-24 15:30:47 -0800702 .disable_fullhd = 0,
Riaz Rahaman84f8c682012-05-30 13:32:10 +0530703 .fw_addr = 0x9fe00000,
Arun Menonaabf2632012-02-24 15:30:47 -0800704};
705
706struct platform_device apq8930_msm_device_vidc = {
707 .name = "msm_vidc",
708 .id = 0,
709 .num_resources = ARRAY_SIZE(apq8930_device_vidc_resources),
710 .resource = apq8930_device_vidc_resources,
711 .dev = {
712 .platform_data = &apq8930_vidc_platform_data,
713 },
714};
715
716struct platform_device *vidc_device[] __initdata = {
717 &apq8930_msm_device_vidc
718};
719
720void __init msm8930_add_vidc_device(void)
721{
722 if (cpu_is_msm8627()) {
723 struct msm_vidc_platform_data *pdata;
724 pdata = (struct msm_vidc_platform_data *)
725 apq8930_msm_device_vidc.dev.platform_data;
726 pdata->disable_fullhd = 1;
727 }
728 platform_add_devices(vidc_device, ARRAY_SIZE(vidc_device));
729}
Laura Abbott0577d7b2012-04-17 11:14:30 -0700730
731struct msm_iommu_domain_name msm8930_iommu_ctx_names[] = {
732 /* Camera */
733 {
734 .name = "vpe_src",
735 .domain = CAMERA_DOMAIN,
736 },
737 /* Camera */
738 {
739 .name = "vpe_dst",
740 .domain = CAMERA_DOMAIN,
741 },
742 /* Camera */
743 {
744 .name = "vfe_imgwr",
745 .domain = CAMERA_DOMAIN,
746 },
747 /* Camera */
748 {
749 .name = "vfe_misc",
750 .domain = CAMERA_DOMAIN,
751 },
752 /* Camera */
753 {
754 .name = "ijpeg_src",
755 .domain = CAMERA_DOMAIN,
756 },
757 /* Camera */
758 {
759 .name = "ijpeg_dst",
760 .domain = CAMERA_DOMAIN,
761 },
762 /* Camera */
763 {
764 .name = "jpegd_src",
765 .domain = CAMERA_DOMAIN,
766 },
767 /* Camera */
768 {
769 .name = "jpegd_dst",
770 .domain = CAMERA_DOMAIN,
771 },
772 /* Rotator */
773 {
774 .name = "rot_src",
Olav Hauganef95ae32012-05-15 09:50:30 -0700775 .domain = ROTATOR_SRC_DOMAIN,
Laura Abbott0577d7b2012-04-17 11:14:30 -0700776 },
777 /* Rotator */
778 {
779 .name = "rot_dst",
Olav Hauganef95ae32012-05-15 09:50:30 -0700780 .domain = ROTATOR_SRC_DOMAIN,
Laura Abbott0577d7b2012-04-17 11:14:30 -0700781 },
782 /* Video */
783 {
784 .name = "vcodec_a_mm1",
785 .domain = VIDEO_DOMAIN,
786 },
787 /* Video */
788 {
789 .name = "vcodec_b_mm2",
790 .domain = VIDEO_DOMAIN,
791 },
792 /* Video */
793 {
794 .name = "vcodec_a_stream",
795 .domain = VIDEO_DOMAIN,
796 },
797};
798
799static struct mem_pool msm8930_video_pools[] = {
800 /*
801 * Video hardware has the following requirements:
802 * 1. All video addresses used by the video hardware must be at a higher
803 * address than video firmware address.
804 * 2. Video hardware can only access a range of 256MB from the base of
805 * the video firmware.
806 */
807 [VIDEO_FIRMWARE_POOL] =
808 /* Low addresses, intended for video firmware */
809 {
810 .paddr = SZ_128K,
811 .size = SZ_16M - SZ_128K,
812 },
813 [VIDEO_MAIN_POOL] =
814 /* Main video pool */
815 {
816 .paddr = SZ_16M,
817 .size = SZ_256M - SZ_16M,
818 },
819 [GEN_POOL] =
820 /* Remaining address space up to 2G */
821 {
822 .paddr = SZ_256M,
823 .size = SZ_2G - SZ_256M,
824 },
825};
826
827static struct mem_pool msm8930_camera_pools[] = {
828 [GEN_POOL] =
829 /* One address space for camera */
830 {
831 .paddr = SZ_128K,
832 .size = SZ_2G - SZ_128K,
833 },
834};
835
Olav Hauganef95ae32012-05-15 09:50:30 -0700836static struct mem_pool msm8930_display_read_pools[] = {
Laura Abbott0577d7b2012-04-17 11:14:30 -0700837 [GEN_POOL] =
Olav Hauganef95ae32012-05-15 09:50:30 -0700838 /* One address space for display reads */
Laura Abbott0577d7b2012-04-17 11:14:30 -0700839 {
840 .paddr = SZ_128K,
841 .size = SZ_2G - SZ_128K,
842 },
843};
844
Olav Hauganef95ae32012-05-15 09:50:30 -0700845static struct mem_pool msm8930_rotator_src_pools[] = {
Laura Abbott0577d7b2012-04-17 11:14:30 -0700846 [GEN_POOL] =
Olav Hauganef95ae32012-05-15 09:50:30 -0700847 /* One address space for rotator src */
Laura Abbott0577d7b2012-04-17 11:14:30 -0700848 {
849 .paddr = SZ_128K,
850 .size = SZ_2G - SZ_128K,
851 },
852};
853
854static struct msm_iommu_domain msm8930_iommu_domains[] = {
855 [VIDEO_DOMAIN] = {
856 .iova_pools = msm8930_video_pools,
857 .npools = ARRAY_SIZE(msm8930_video_pools),
858 },
859 [CAMERA_DOMAIN] = {
860 .iova_pools = msm8930_camera_pools,
861 .npools = ARRAY_SIZE(msm8930_camera_pools),
862 },
Olav Hauganef95ae32012-05-15 09:50:30 -0700863 [DISPLAY_READ_DOMAIN] = {
864 .iova_pools = msm8930_display_read_pools,
865 .npools = ARRAY_SIZE(msm8930_display_read_pools),
Laura Abbott0577d7b2012-04-17 11:14:30 -0700866 },
Olav Hauganef95ae32012-05-15 09:50:30 -0700867 [ROTATOR_SRC_DOMAIN] = {
868 .iova_pools = msm8930_rotator_src_pools,
869 .npools = ARRAY_SIZE(msm8930_rotator_src_pools),
Laura Abbott0577d7b2012-04-17 11:14:30 -0700870 },
871};
872
873struct iommu_domains_pdata msm8930_iommu_domain_pdata = {
874 .domains = msm8930_iommu_domains,
875 .ndomains = ARRAY_SIZE(msm8930_iommu_domains),
876 .domain_names = msm8930_iommu_ctx_names,
877 .nnames = ARRAY_SIZE(msm8930_iommu_ctx_names),
878 .domain_alloc_flags = 0,
879};
880
881struct platform_device msm8930_iommu_domain_device = {
882 .name = "iommu_domains",
883 .id = -1,
884 .dev = {
885 .platform_data = &msm8930_iommu_domain_pdata,
Laura Abbott532b2df2012-04-12 10:53:48 -0700886 }
887};
888
889struct msm_rtb_platform_data msm8930_rtb_pdata = {
890 .size = SZ_1M,
891};
892
893static int __init msm_rtb_set_buffer_size(char *p)
894{
895 int s;
896
897 s = memparse(p, NULL);
898 msm8930_rtb_pdata.size = ALIGN(s, SZ_4K);
899 return 0;
900}
901early_param("msm_rtb_size", msm_rtb_set_buffer_size);
902
903
904struct platform_device msm8930_rtb_device = {
905 .name = "msm_rtb",
906 .id = -1,
907 .dev = {
908 .platform_data = &msm8930_rtb_pdata,
Laura Abbott0577d7b2012-04-17 11:14:30 -0700909 },
910};
Laura Abbottf3173042012-05-29 15:23:18 -0700911
912#define MSM8930_L1_SIZE SZ_1M
913/*
914 * The actual L2 size is smaller but we need a larger buffer
915 * size to store other dump information
916 */
917#define MSM8930_L2_SIZE SZ_4M
918
919struct msm_cache_dump_platform_data msm8930_cache_dump_pdata = {
920 .l2_size = MSM8930_L2_SIZE,
921 .l1_size = MSM8930_L1_SIZE,
922};
923
924struct platform_device msm8930_cache_dump_device = {
925 .name = "msm_cache_dump",
926 .id = -1,
927 .dev = {
928 .platform_data = &msm8930_cache_dump_pdata,
929 },
930};