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