blob: 9de2213c9d12e5d92923b1753d8296cbfecf7324 [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),
Mahesh Sivasubramanian3ddf27b2012-05-22 12:09:56 -0600129 MSM_RPM_MAP(8930, DDR_DMM_0, DDR_DMM, 2),
Praveen Chidambaram78499012011-11-01 17:15:17 -0600130 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 Sivasubramanian3ddf27b2012-05-22 12:09:56 -0600234 MSM_RPM_STATUS_ID_MAP(8930, DDR_DMM_0),
235 MSM_RPM_STATUS_ID_MAP(8930, DDR_DMM_1),
Mahesh Sivasubramanianef2a0fa2012-01-24 15:57:01 -0700236 MSM_RPM_STATUS_ID_MAP(8930, QDSS_CLK),
Mahesh Sivasubramanian9e52ce42012-02-01 16:00:19 -0700237 MSM_RPM_STATUS_ID_MAP(8930, VOLTAGE_CORNER),
Praveen Chidambaram78499012011-11-01 17:15:17 -0600238 },
239 .target_ctrl_id = {
240 MSM_RPM_CTRL_MAP(8930, VERSION_MAJOR),
241 MSM_RPM_CTRL_MAP(8930, VERSION_MINOR),
242 MSM_RPM_CTRL_MAP(8930, VERSION_BUILD),
243 MSM_RPM_CTRL_MAP(8930, REQ_CTX_0),
244 MSM_RPM_CTRL_MAP(8930, REQ_SEL_0),
245 MSM_RPM_CTRL_MAP(8930, ACK_CTX_0),
246 MSM_RPM_CTRL_MAP(8930, ACK_SEL_0),
247 },
248 .sel_invalidate = MSM_RPM_8930_SEL_INVALIDATE,
249 .sel_notification = MSM_RPM_8930_SEL_NOTIFICATION,
250 .sel_last = MSM_RPM_8930_SEL_LAST,
251 .ver = {3, 0, 0},
252};
253
254struct platform_device msm8930_rpm_device = {
255 .name = "msm_rpm",
256 .id = -1,
257};
258
259static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
260 .phys_addr_base = 0x0010C000,
261 .reg_offsets = {
262 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
263 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
264 },
265 .phys_size = SZ_8K,
266 .log_len = 4096, /* log's buffer length in bytes */
267 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
268};
269
270struct platform_device msm8930_rpm_log_device = {
271 .name = "msm_rpm_log",
272 .id = -1,
273 .dev = {
274 .platform_data = &msm_rpm_log_pdata,
275 },
276};
277
278static struct msm_rpmstats_platform_data msm_rpm_stat_pdata = {
279 .phys_addr_base = 0x0010D204,
280 .phys_size = SZ_8K,
281};
282
283struct platform_device msm8930_rpm_stat_device = {
284 .name = "msm_rpm_stat",
285 .id = -1,
286 .dev = {
287 .platform_data = &msm_rpm_stat_pdata,
288 },
289};
290
Praveen Chidambaram8ea3dcd2011-12-07 14:46:31 -0700291static int msm8930_LPM_latency = 1000; /* >100 usec for WFI */
292
293struct platform_device msm8930_cpu_idle_device = {
294 .name = "msm_cpu_idle",
295 .id = -1,
296 .dev = {
297 .platform_data = &msm8930_LPM_latency,
298 },
299};
Praveen Chidambaram5c8adf22012-02-23 18:44:37 -0700300
301static struct msm_dcvs_freq_entry msm8930_freq[] = {
302 { 384000, 166981, 345600},
303 { 702000, 213049, 632502},
304 {1026000, 285712, 925613},
305 {1242000, 383945, 1176550},
306 {1458000, 419729, 1465478},
307 {1512000, 434116, 1546674},
308
309};
310
311static struct msm_dcvs_core_info msm8930_core_info = {
312 .freq_tbl = &msm8930_freq[0],
313 .core_param = {
314 .max_time_us = 100000,
315 .num_freq = ARRAY_SIZE(msm8930_freq),
316 },
317 .algo_param = {
318 .slack_time_us = 58000,
319 .scale_slack_time = 0,
320 .scale_slack_time_pct = 0,
321 .disable_pc_threshold = 1458000,
322 .em_window_size = 100000,
323 .em_max_util_pct = 97,
324 .ss_window_size = 1000000,
325 .ss_util_pct = 95,
326 .ss_iobusy_conv = 100,
327 },
328};
329
330struct platform_device msm8930_msm_gov_device = {
331 .name = "msm_dcvs_gov",
332 .id = -1,
333 .dev = {
334 .platform_data = &msm8930_core_info,
335 },
336};
Gagan Maccd5b3272012-02-09 18:13:10 -0700337
338struct platform_device msm_bus_8930_sys_fabric = {
339 .name = "msm_bus_fabric",
340 .id = MSM_BUS_FAB_SYSTEM,
341};
342struct platform_device msm_bus_8930_apps_fabric = {
343 .name = "msm_bus_fabric",
344 .id = MSM_BUS_FAB_APPSS,
345};
346struct platform_device msm_bus_8930_mm_fabric = {
347 .name = "msm_bus_fabric",
348 .id = MSM_BUS_FAB_MMSS,
349};
350struct platform_device msm_bus_8930_sys_fpb = {
351 .name = "msm_bus_fabric",
352 .id = MSM_BUS_FAB_SYSTEM_FPB,
353};
354struct platform_device msm_bus_8930_cpss_fpb = {
355 .name = "msm_bus_fabric",
356 .id = MSM_BUS_FAB_CPSS_FPB,
357};
358
Matt Wagantall1f65d9d2012-04-25 14:24:20 -0700359static struct fs_driver_data gfx3d_fs_data = {
360 .clks = (struct fs_clk_data[]){
361 { .name = "core_clk", .reset_rate = 27000000 },
362 { .name = "iface_clk" },
363 { .name = "bus_clk" },
364 { 0 }
365 },
366 .bus_port0 = MSM_BUS_MASTER_GRAPHICS_3D,
367};
368
369static struct fs_driver_data ijpeg_fs_data = {
370 .clks = (struct fs_clk_data[]){
371 { .name = "core_clk" },
372 { .name = "iface_clk" },
373 { .name = "bus_clk" },
374 { 0 }
375 },
376 .bus_port0 = MSM_BUS_MASTER_JPEG_ENC,
377};
378
379static struct fs_driver_data mdp_fs_data = {
380 .clks = (struct fs_clk_data[]){
381 { .name = "core_clk" },
382 { .name = "iface_clk" },
383 { .name = "bus_clk" },
384 { .name = "vsync_clk" },
385 { .name = "lut_clk" },
386 { .name = "tv_src_clk" },
387 { .name = "tv_clk" },
388 { 0 }
389 },
390 .bus_port0 = MSM_BUS_MASTER_MDP_PORT0,
391 .bus_port1 = MSM_BUS_MASTER_MDP_PORT1,
392};
393
394static struct fs_driver_data rot_fs_data = {
395 .clks = (struct fs_clk_data[]){
396 { .name = "core_clk" },
397 { .name = "iface_clk" },
398 { .name = "bus_clk" },
399 { 0 }
400 },
401 .bus_port0 = MSM_BUS_MASTER_ROTATOR,
402};
403
404static struct fs_driver_data ved_fs_data = {
405 .clks = (struct fs_clk_data[]){
406 { .name = "core_clk" },
407 { .name = "iface_clk" },
408 { .name = "bus_clk" },
409 { 0 }
410 },
411 .bus_port0 = MSM_BUS_MASTER_HD_CODEC_PORT0,
412 .bus_port1 = MSM_BUS_MASTER_HD_CODEC_PORT1,
413};
414
415static struct fs_driver_data vfe_fs_data = {
416 .clks = (struct fs_clk_data[]){
417 { .name = "core_clk" },
418 { .name = "iface_clk" },
419 { .name = "bus_clk" },
420 { 0 }
421 },
422 .bus_port0 = MSM_BUS_MASTER_VFE,
423};
424
425static struct fs_driver_data vpe_fs_data = {
426 .clks = (struct fs_clk_data[]){
427 { .name = "core_clk" },
428 { .name = "iface_clk" },
429 { .name = "bus_clk" },
430 { 0 }
431 },
432 .bus_port0 = MSM_BUS_MASTER_VPE,
433};
434
435struct platform_device *msm8930_footswitch[] __initdata = {
Matt Wagantalld4aab1e2012-05-03 20:26:56 -0700436 FS_8X60(FS_MDP, "vdd", "mdp.0", &mdp_fs_data),
Matt Wagantall316f2fc2012-05-03 20:41:42 -0700437 FS_8X60(FS_ROT, "vdd", "msm_rotator.0", &rot_fs_data),
Matt Wagantalle4454b82012-05-03 20:48:01 -0700438 FS_8X60(FS_IJPEG, "vdd", "msm_gemini.0", &ijpeg_fs_data),
Matt Wagantall5c922112012-05-03 19:25:28 -0700439 FS_8X60(FS_VFE, "fs_vfe", NULL, &vfe_fs_data),
440 FS_8X60(FS_VPE, "fs_vpe", NULL, &vpe_fs_data),
Matt Wagantalld6fbf232012-05-03 20:09:28 -0700441 FS_8X60(FS_GFX3D, "vdd", "kgsl-3d0.0", &gfx3d_fs_data),
Matt Wagantall5e46aac2012-05-03 20:20:18 -0700442 FS_8X60(FS_VED, "vdd", "msm_vidc.0", &ved_fs_data),
Matt Wagantall1f65d9d2012-04-25 14:24:20 -0700443};
444unsigned msm8930_num_footswitch __initdata = ARRAY_SIZE(msm8930_footswitch);
445
Arun Menonaabf2632012-02-24 15:30:47 -0800446/* MSM Video core device */
447#ifdef CONFIG_MSM_BUS_SCALING
448static struct msm_bus_vectors vidc_init_vectors[] = {
449 {
450 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
451 .dst = MSM_BUS_SLAVE_EBI_CH0,
452 .ab = 0,
453 .ib = 0,
454 },
455 {
456 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
457 .dst = MSM_BUS_SLAVE_EBI_CH0,
458 .ab = 0,
459 .ib = 0,
460 },
461 {
462 .src = MSM_BUS_MASTER_AMPSS_M0,
463 .dst = MSM_BUS_SLAVE_EBI_CH0,
464 .ab = 0,
465 .ib = 0,
466 },
467 {
468 .src = MSM_BUS_MASTER_AMPSS_M0,
469 .dst = MSM_BUS_SLAVE_EBI_CH0,
470 .ab = 0,
471 .ib = 0,
472 },
473};
474static struct msm_bus_vectors vidc_venc_vga_vectors[] = {
475 {
476 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
477 .dst = MSM_BUS_SLAVE_EBI_CH0,
478 .ab = 54525952,
479 .ib = 436207616,
480 },
481 {
482 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
483 .dst = MSM_BUS_SLAVE_EBI_CH0,
484 .ab = 72351744,
485 .ib = 289406976,
486 },
487 {
488 .src = MSM_BUS_MASTER_AMPSS_M0,
489 .dst = MSM_BUS_SLAVE_EBI_CH0,
490 .ab = 500000,
491 .ib = 1000000,
492 },
493 {
494 .src = MSM_BUS_MASTER_AMPSS_M0,
495 .dst = MSM_BUS_SLAVE_EBI_CH0,
496 .ab = 500000,
497 .ib = 1000000,
498 },
499};
500static struct msm_bus_vectors vidc_vdec_vga_vectors[] = {
501 {
502 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
503 .dst = MSM_BUS_SLAVE_EBI_CH0,
504 .ab = 40894464,
505 .ib = 327155712,
506 },
507 {
508 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
509 .dst = MSM_BUS_SLAVE_EBI_CH0,
510 .ab = 48234496,
511 .ib = 192937984,
512 },
513 {
514 .src = MSM_BUS_MASTER_AMPSS_M0,
515 .dst = MSM_BUS_SLAVE_EBI_CH0,
516 .ab = 500000,
517 .ib = 2000000,
518 },
519 {
520 .src = MSM_BUS_MASTER_AMPSS_M0,
521 .dst = MSM_BUS_SLAVE_EBI_CH0,
522 .ab = 500000,
523 .ib = 2000000,
524 },
525};
526static struct msm_bus_vectors vidc_venc_720p_vectors[] = {
527 {
528 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
529 .dst = MSM_BUS_SLAVE_EBI_CH0,
530 .ab = 163577856,
531 .ib = 1308622848,
532 },
533 {
534 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
535 .dst = MSM_BUS_SLAVE_EBI_CH0,
536 .ab = 219152384,
537 .ib = 876609536,
538 },
539 {
540 .src = MSM_BUS_MASTER_AMPSS_M0,
541 .dst = MSM_BUS_SLAVE_EBI_CH0,
542 .ab = 1750000,
543 .ib = 3500000,
544 },
545 {
546 .src = MSM_BUS_MASTER_AMPSS_M0,
547 .dst = MSM_BUS_SLAVE_EBI_CH0,
548 .ab = 1750000,
549 .ib = 3500000,
550 },
551};
552static struct msm_bus_vectors vidc_vdec_720p_vectors[] = {
553 {
554 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
555 .dst = MSM_BUS_SLAVE_EBI_CH0,
556 .ab = 121634816,
557 .ib = 973078528,
558 },
559 {
560 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
561 .dst = MSM_BUS_SLAVE_EBI_CH0,
562 .ab = 155189248,
563 .ib = 620756992,
564 },
565 {
566 .src = MSM_BUS_MASTER_AMPSS_M0,
567 .dst = MSM_BUS_SLAVE_EBI_CH0,
568 .ab = 1750000,
569 .ib = 7000000,
570 },
571 {
572 .src = MSM_BUS_MASTER_AMPSS_M0,
573 .dst = MSM_BUS_SLAVE_EBI_CH0,
574 .ab = 1750000,
575 .ib = 7000000,
576 },
577};
578static struct msm_bus_vectors vidc_venc_1080p_vectors[] = {
579 {
580 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
581 .dst = MSM_BUS_SLAVE_EBI_CH0,
582 .ab = 372244480,
583 .ib = 2560000000U,
584 },
585 {
586 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
587 .dst = MSM_BUS_SLAVE_EBI_CH0,
588 .ab = 501219328,
589 .ib = 2560000000U,
590 },
591 {
592 .src = MSM_BUS_MASTER_AMPSS_M0,
593 .dst = MSM_BUS_SLAVE_EBI_CH0,
594 .ab = 2500000,
595 .ib = 5000000,
596 },
597 {
598 .src = MSM_BUS_MASTER_AMPSS_M0,
599 .dst = MSM_BUS_SLAVE_EBI_CH0,
600 .ab = 2500000,
601 .ib = 5000000,
602 },
603};
604static struct msm_bus_vectors vidc_vdec_1080p_vectors[] = {
605 {
606 .src = MSM_BUS_MASTER_HD_CODEC_PORT0,
607 .dst = MSM_BUS_SLAVE_EBI_CH0,
608 .ab = 222298112,
609 .ib = 2560000000U,
610 },
611 {
612 .src = MSM_BUS_MASTER_HD_CODEC_PORT1,
613 .dst = MSM_BUS_SLAVE_EBI_CH0,
614 .ab = 330301440,
615 .ib = 2560000000U,
616 },
617 {
618 .src = MSM_BUS_MASTER_AMPSS_M0,
619 .dst = MSM_BUS_SLAVE_EBI_CH0,
620 .ab = 2500000,
621 .ib = 700000000,
622 },
623 {
624 .src = MSM_BUS_MASTER_AMPSS_M0,
625 .dst = MSM_BUS_SLAVE_EBI_CH0,
626 .ab = 2500000,
627 .ib = 10000000,
628 },
629};
630
631static struct msm_bus_paths vidc_bus_client_config[] = {
632 {
633 ARRAY_SIZE(vidc_init_vectors),
634 vidc_init_vectors,
635 },
636 {
637 ARRAY_SIZE(vidc_venc_vga_vectors),
638 vidc_venc_vga_vectors,
639 },
640 {
641 ARRAY_SIZE(vidc_vdec_vga_vectors),
642 vidc_vdec_vga_vectors,
643 },
644 {
645 ARRAY_SIZE(vidc_venc_720p_vectors),
646 vidc_venc_720p_vectors,
647 },
648 {
649 ARRAY_SIZE(vidc_vdec_720p_vectors),
650 vidc_vdec_720p_vectors,
651 },
652 {
653 ARRAY_SIZE(vidc_venc_1080p_vectors),
654 vidc_venc_1080p_vectors,
655 },
656 {
657 ARRAY_SIZE(vidc_vdec_1080p_vectors),
658 vidc_vdec_1080p_vectors,
659 },
660};
661
662static struct msm_bus_scale_pdata vidc_bus_client_data = {
663 vidc_bus_client_config,
664 ARRAY_SIZE(vidc_bus_client_config),
665 .name = "vidc",
666};
667#endif
668
669#define MSM_VIDC_BASE_PHYS 0x04400000
670#define MSM_VIDC_BASE_SIZE 0x00100000
671
672static struct resource apq8930_device_vidc_resources[] = {
673 {
674 .start = MSM_VIDC_BASE_PHYS,
675 .end = MSM_VIDC_BASE_PHYS + MSM_VIDC_BASE_SIZE - 1,
676 .flags = IORESOURCE_MEM,
677 },
678 {
679 .start = VCODEC_IRQ,
680 .end = VCODEC_IRQ,
681 .flags = IORESOURCE_IRQ,
682 },
683};
684
685struct msm_vidc_platform_data apq8930_vidc_platform_data = {
686#ifdef CONFIG_MSM_BUS_SCALING
687 .vidc_bus_client_pdata = &vidc_bus_client_data,
688#endif
689#ifdef CONFIG_MSM_MULTIMEDIA_USE_ION
690 .memtype = ION_CP_MM_HEAP_ID,
691 .enable_ion = 1,
Deepak Kotur8097f782012-05-14 14:13:06 -0700692 .cp_enabled = 1,
Arun Menonaabf2632012-02-24 15:30:47 -0800693#else
694 .memtype = MEMTYPE_EBI1,
695 .enable_ion = 0,
696#endif
Anil Gahlotd0ce26d2012-05-08 17:58:46 -0700697 .disable_dmx = 1,
Arun Menonaabf2632012-02-24 15:30:47 -0800698 .disable_fullhd = 0,
699};
700
701struct platform_device apq8930_msm_device_vidc = {
702 .name = "msm_vidc",
703 .id = 0,
704 .num_resources = ARRAY_SIZE(apq8930_device_vidc_resources),
705 .resource = apq8930_device_vidc_resources,
706 .dev = {
707 .platform_data = &apq8930_vidc_platform_data,
708 },
709};
710
711struct platform_device *vidc_device[] __initdata = {
712 &apq8930_msm_device_vidc
713};
714
715void __init msm8930_add_vidc_device(void)
716{
717 if (cpu_is_msm8627()) {
718 struct msm_vidc_platform_data *pdata;
719 pdata = (struct msm_vidc_platform_data *)
720 apq8930_msm_device_vidc.dev.platform_data;
721 pdata->disable_fullhd = 1;
722 }
723 platform_add_devices(vidc_device, ARRAY_SIZE(vidc_device));
724}
Laura Abbott0577d7b2012-04-17 11:14:30 -0700725
726struct msm_iommu_domain_name msm8930_iommu_ctx_names[] = {
727 /* Camera */
728 {
729 .name = "vpe_src",
730 .domain = CAMERA_DOMAIN,
731 },
732 /* Camera */
733 {
734 .name = "vpe_dst",
735 .domain = CAMERA_DOMAIN,
736 },
737 /* Camera */
738 {
739 .name = "vfe_imgwr",
740 .domain = CAMERA_DOMAIN,
741 },
742 /* Camera */
743 {
744 .name = "vfe_misc",
745 .domain = CAMERA_DOMAIN,
746 },
747 /* Camera */
748 {
749 .name = "ijpeg_src",
750 .domain = CAMERA_DOMAIN,
751 },
752 /* Camera */
753 {
754 .name = "ijpeg_dst",
755 .domain = CAMERA_DOMAIN,
756 },
757 /* Camera */
758 {
759 .name = "jpegd_src",
760 .domain = CAMERA_DOMAIN,
761 },
762 /* Camera */
763 {
764 .name = "jpegd_dst",
765 .domain = CAMERA_DOMAIN,
766 },
767 /* Rotator */
768 {
769 .name = "rot_src",
770 .domain = ROTATOR_DOMAIN,
771 },
772 /* Rotator */
773 {
774 .name = "rot_dst",
775 .domain = ROTATOR_DOMAIN,
776 },
777 /* Video */
778 {
779 .name = "vcodec_a_mm1",
780 .domain = VIDEO_DOMAIN,
781 },
782 /* Video */
783 {
784 .name = "vcodec_b_mm2",
785 .domain = VIDEO_DOMAIN,
786 },
787 /* Video */
788 {
789 .name = "vcodec_a_stream",
790 .domain = VIDEO_DOMAIN,
791 },
792};
793
794static struct mem_pool msm8930_video_pools[] = {
795 /*
796 * Video hardware has the following requirements:
797 * 1. All video addresses used by the video hardware must be at a higher
798 * address than video firmware address.
799 * 2. Video hardware can only access a range of 256MB from the base of
800 * the video firmware.
801 */
802 [VIDEO_FIRMWARE_POOL] =
803 /* Low addresses, intended for video firmware */
804 {
805 .paddr = SZ_128K,
806 .size = SZ_16M - SZ_128K,
807 },
808 [VIDEO_MAIN_POOL] =
809 /* Main video pool */
810 {
811 .paddr = SZ_16M,
812 .size = SZ_256M - SZ_16M,
813 },
814 [GEN_POOL] =
815 /* Remaining address space up to 2G */
816 {
817 .paddr = SZ_256M,
818 .size = SZ_2G - SZ_256M,
819 },
820};
821
822static struct mem_pool msm8930_camera_pools[] = {
823 [GEN_POOL] =
824 /* One address space for camera */
825 {
826 .paddr = SZ_128K,
827 .size = SZ_2G - SZ_128K,
828 },
829};
830
831static struct mem_pool msm8930_display_pools[] = {
832 [GEN_POOL] =
833 /* One address space for display */
834 {
835 .paddr = SZ_128K,
836 .size = SZ_2G - SZ_128K,
837 },
838};
839
840static struct mem_pool msm8930_rotator_pools[] = {
841 [GEN_POOL] =
842 /* One address space for rotator */
843 {
844 .paddr = SZ_128K,
845 .size = SZ_2G - SZ_128K,
846 },
847};
848
849static struct msm_iommu_domain msm8930_iommu_domains[] = {
850 [VIDEO_DOMAIN] = {
851 .iova_pools = msm8930_video_pools,
852 .npools = ARRAY_SIZE(msm8930_video_pools),
853 },
854 [CAMERA_DOMAIN] = {
855 .iova_pools = msm8930_camera_pools,
856 .npools = ARRAY_SIZE(msm8930_camera_pools),
857 },
858 [DISPLAY_DOMAIN] = {
859 .iova_pools = msm8930_display_pools,
860 .npools = ARRAY_SIZE(msm8930_display_pools),
861 },
862 [ROTATOR_DOMAIN] = {
863 .iova_pools = msm8930_rotator_pools,
864 .npools = ARRAY_SIZE(msm8930_rotator_pools),
865 },
866};
867
868struct iommu_domains_pdata msm8930_iommu_domain_pdata = {
869 .domains = msm8930_iommu_domains,
870 .ndomains = ARRAY_SIZE(msm8930_iommu_domains),
871 .domain_names = msm8930_iommu_ctx_names,
872 .nnames = ARRAY_SIZE(msm8930_iommu_ctx_names),
873 .domain_alloc_flags = 0,
874};
875
876struct platform_device msm8930_iommu_domain_device = {
877 .name = "iommu_domains",
878 .id = -1,
879 .dev = {
880 .platform_data = &msm8930_iommu_domain_pdata,
Laura Abbott532b2df2012-04-12 10:53:48 -0700881 }
882};
883
884struct msm_rtb_platform_data msm8930_rtb_pdata = {
885 .size = SZ_1M,
886};
887
888static int __init msm_rtb_set_buffer_size(char *p)
889{
890 int s;
891
892 s = memparse(p, NULL);
893 msm8930_rtb_pdata.size = ALIGN(s, SZ_4K);
894 return 0;
895}
896early_param("msm_rtb_size", msm_rtb_set_buffer_size);
897
898
899struct platform_device msm8930_rtb_device = {
900 .name = "msm_rtb",
901 .id = -1,
902 .dev = {
903 .platform_data = &msm8930_rtb_pdata,
Laura Abbott0577d7b2012-04-17 11:14:30 -0700904 },
905};