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