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