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