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