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