blob: 0ad25c0ec21b47b395f42399de6701f06462dfbb [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>
16#include <mach/msm_iomap.h>
17#include <mach/irqs-8930.h>
18#include <mach/rpm.h>
19
20#include "devices.h"
21#include "rpm_log.h"
22#include "rpm_stats.h"
23
24#ifdef CONFIG_MSM_MPM
25#include "mpm.h"
26#endif
27
28struct msm_rpm_platform_data msm8930_rpm_data __initdata = {
29 .reg_base_addrs = {
30 [MSM_RPM_PAGE_STATUS] = MSM_RPM_BASE,
31 [MSM_RPM_PAGE_CTRL] = MSM_RPM_BASE + 0x400,
32 [MSM_RPM_PAGE_REQ] = MSM_RPM_BASE + 0x600,
33 [MSM_RPM_PAGE_ACK] = MSM_RPM_BASE + 0xa00,
34 },
35 .irq_ack = RPM_APCC_CPU0_GP_HIGH_IRQ,
36 .ipc_rpm_reg = MSM_APCS_GCC_BASE + 0x008,
37 .ipc_rpm_val = 4,
38 .target_id = {
39 MSM_RPM_MAP(8930, NOTIFICATION_CONFIGURED_0, NOTIFICATION, 4),
40 MSM_RPM_MAP(8930, NOTIFICATION_REGISTERED_0, NOTIFICATION, 4),
41 MSM_RPM_MAP(8930, INVALIDATE_0, INVALIDATE, 8),
Mahesh Sivasubramanianef2a0fa2012-01-24 15:57:01 -070042 MSM_RPM_MAP(8960, TRIGGER_TIMED_TO, TRIGGER_TIMED, 1),
43 MSM_RPM_MAP(8960, TRIGGER_TIMED_SCLK_COUNT, TRIGGER_TIMED, 1),
Praveen Chidambaram78499012011-11-01 17:15:17 -060044 MSM_RPM_MAP(8930, RPM_CTL, RPM_CTL, 1),
45 MSM_RPM_MAP(8930, CXO_CLK, CXO_CLK, 1),
46 MSM_RPM_MAP(8930, PXO_CLK, PXO_CLK, 1),
47 MSM_RPM_MAP(8930, APPS_FABRIC_CLK, APPS_FABRIC_CLK, 1),
48 MSM_RPM_MAP(8930, SYSTEM_FABRIC_CLK, SYSTEM_FABRIC_CLK, 1),
49 MSM_RPM_MAP(8930, MM_FABRIC_CLK, MM_FABRIC_CLK, 1),
50 MSM_RPM_MAP(8930, DAYTONA_FABRIC_CLK, DAYTONA_FABRIC_CLK, 1),
51 MSM_RPM_MAP(8930, SFPB_CLK, SFPB_CLK, 1),
52 MSM_RPM_MAP(8930, CFPB_CLK, CFPB_CLK, 1),
53 MSM_RPM_MAP(8930, MMFPB_CLK, MMFPB_CLK, 1),
54 MSM_RPM_MAP(8930, EBI1_CLK, EBI1_CLK, 1),
55 MSM_RPM_MAP(8930, APPS_FABRIC_CFG_HALT_0,
56 APPS_FABRIC_CFG_HALT, 2),
57 MSM_RPM_MAP(8930, APPS_FABRIC_CFG_CLKMOD_0,
58 APPS_FABRIC_CFG_CLKMOD, 3),
59 MSM_RPM_MAP(8930, APPS_FABRIC_CFG_IOCTL,
60 APPS_FABRIC_CFG_IOCTL, 1),
Mahesh Sivasubramanianef2a0fa2012-01-24 15:57:01 -070061 MSM_RPM_MAP(8930, APPS_FABRIC_ARB_0, APPS_FABRIC_ARB, 12),
Praveen Chidambaram78499012011-11-01 17:15:17 -060062 MSM_RPM_MAP(8930, SYS_FABRIC_CFG_HALT_0,
63 SYS_FABRIC_CFG_HALT, 2),
64 MSM_RPM_MAP(8930, SYS_FABRIC_CFG_CLKMOD_0,
65 SYS_FABRIC_CFG_CLKMOD, 3),
66 MSM_RPM_MAP(8930, SYS_FABRIC_CFG_IOCTL,
67 SYS_FABRIC_CFG_IOCTL, 1),
68 MSM_RPM_MAP(8930, SYSTEM_FABRIC_ARB_0,
Mahesh Sivasubramanianef2a0fa2012-01-24 15:57:01 -070069 SYSTEM_FABRIC_ARB, 29),
Praveen Chidambaram78499012011-11-01 17:15:17 -060070 MSM_RPM_MAP(8930, MMSS_FABRIC_CFG_HALT_0,
71 MMSS_FABRIC_CFG_HALT, 2),
72 MSM_RPM_MAP(8930, MMSS_FABRIC_CFG_CLKMOD_0,
73 MMSS_FABRIC_CFG_CLKMOD, 3),
74 MSM_RPM_MAP(8930, MMSS_FABRIC_CFG_IOCTL,
75 MMSS_FABRIC_CFG_IOCTL, 1),
Mahesh Sivasubramanianef2a0fa2012-01-24 15:57:01 -070076 MSM_RPM_MAP(8930, MM_FABRIC_ARB_0, MM_FABRIC_ARB, 23),
Praveen Chidambaram78499012011-11-01 17:15:17 -060077 MSM_RPM_MAP(8930, PM8038_S1_0, PM8038_S1, 2),
78 MSM_RPM_MAP(8930, PM8038_S2_0, PM8038_S2, 2),
79 MSM_RPM_MAP(8930, PM8038_S3_0, PM8038_S3, 2),
80 MSM_RPM_MAP(8930, PM8038_S4_0, PM8038_S4, 2),
81 MSM_RPM_MAP(8930, PM8038_S5_0, PM8038_S5, 2),
82 MSM_RPM_MAP(8930, PM8038_S6_0, PM8038_S6, 2),
83 MSM_RPM_MAP(8930, PM8038_L1_0, PM8038_L1, 2),
84 MSM_RPM_MAP(8930, PM8038_L2_0, PM8038_L2, 2),
85 MSM_RPM_MAP(8930, PM8038_L3_0, PM8038_L3, 2),
86 MSM_RPM_MAP(8930, PM8038_L4_0, PM8038_L4, 2),
87 MSM_RPM_MAP(8930, PM8038_L5_0, PM8038_L5, 2),
88 MSM_RPM_MAP(8930, PM8038_L6_0, PM8038_L6, 2),
89 MSM_RPM_MAP(8930, PM8038_L7_0, PM8038_L7, 2),
90 MSM_RPM_MAP(8930, PM8038_L8_0, PM8038_L8, 2),
91 MSM_RPM_MAP(8930, PM8038_L9_0, PM8038_L9, 2),
92 MSM_RPM_MAP(8930, PM8038_L10_0, PM8038_L10, 2),
93 MSM_RPM_MAP(8930, PM8038_L11_0, PM8038_L11, 2),
94 MSM_RPM_MAP(8930, PM8038_L12_0, PM8038_L12, 2),
95 MSM_RPM_MAP(8930, PM8038_L13_0, PM8038_L13, 2),
96 MSM_RPM_MAP(8930, PM8038_L14_0, PM8038_L14, 2),
97 MSM_RPM_MAP(8930, PM8038_L15_0, PM8038_L15, 2),
98 MSM_RPM_MAP(8930, PM8038_L16_0, PM8038_L16, 2),
99 MSM_RPM_MAP(8930, PM8038_L17_0, PM8038_L17, 2),
100 MSM_RPM_MAP(8930, PM8038_L18_0, PM8038_L18, 2),
101 MSM_RPM_MAP(8930, PM8038_L19_0, PM8038_L19, 2),
102 MSM_RPM_MAP(8930, PM8038_L20_0, PM8038_L20, 2),
103 MSM_RPM_MAP(8930, PM8038_L21_0, PM8038_L21, 2),
104 MSM_RPM_MAP(8930, PM8038_L22_0, PM8038_L22, 2),
105 MSM_RPM_MAP(8930, PM8038_L23_0, PM8038_L23, 2),
106 MSM_RPM_MAP(8930, PM8038_L24_0, PM8038_L24, 2),
107 MSM_RPM_MAP(8930, PM8038_L25_0, PM8038_L25, 2),
108 MSM_RPM_MAP(8930, PM8038_L26_0, PM8038_L26, 2),
109 MSM_RPM_MAP(8930, PM8038_L27_0, PM8038_L27, 2),
110 MSM_RPM_MAP(8930, PM8038_CLK1_0, PM8038_CLK1, 2),
111 MSM_RPM_MAP(8930, PM8038_CLK2_0, PM8038_CLK2, 2),
112 MSM_RPM_MAP(8930, PM8038_LVS1, PM8038_LVS1, 1),
113 MSM_RPM_MAP(8930, PM8038_LVS2, PM8038_LVS2, 1),
114 MSM_RPM_MAP(8930, NCP_0, NCP, 2),
115 MSM_RPM_MAP(8930, CXO_BUFFERS, CXO_BUFFERS, 1),
116 MSM_RPM_MAP(8930, USB_OTG_SWITCH, USB_OTG_SWITCH, 1),
117 MSM_RPM_MAP(8930, HDMI_SWITCH, HDMI_SWITCH, 1),
118 MSM_RPM_MAP(8930, QDSS_CLK, QDSS_CLK, 1),
Mahesh Sivasubramanian9e52ce42012-02-01 16:00:19 -0700119 MSM_RPM_MAP(8930, VOLTAGE_CORNER, VOLTAGE_CORNER, 1),
Praveen Chidambaram78499012011-11-01 17:15:17 -0600120 },
121 .target_status = {
122 MSM_RPM_STATUS_ID_MAP(8930, VERSION_MAJOR),
123 MSM_RPM_STATUS_ID_MAP(8930, VERSION_MINOR),
124 MSM_RPM_STATUS_ID_MAP(8930, VERSION_BUILD),
125 MSM_RPM_STATUS_ID_MAP(8930, SUPPORTED_RESOURCES_0),
126 MSM_RPM_STATUS_ID_MAP(8930, SUPPORTED_RESOURCES_1),
127 MSM_RPM_STATUS_ID_MAP(8930, SUPPORTED_RESOURCES_2),
128 MSM_RPM_STATUS_ID_MAP(8930, RESERVED_SUPPORTED_RESOURCES_0),
129 MSM_RPM_STATUS_ID_MAP(8930, SEQUENCE),
130 MSM_RPM_STATUS_ID_MAP(8930, RPM_CTL),
131 MSM_RPM_STATUS_ID_MAP(8930, CXO_CLK),
132 MSM_RPM_STATUS_ID_MAP(8930, PXO_CLK),
133 MSM_RPM_STATUS_ID_MAP(8930, APPS_FABRIC_CLK),
134 MSM_RPM_STATUS_ID_MAP(8930, SYSTEM_FABRIC_CLK),
135 MSM_RPM_STATUS_ID_MAP(8930, MM_FABRIC_CLK),
136 MSM_RPM_STATUS_ID_MAP(8930, DAYTONA_FABRIC_CLK),
137 MSM_RPM_STATUS_ID_MAP(8930, SFPB_CLK),
138 MSM_RPM_STATUS_ID_MAP(8930, CFPB_CLK),
139 MSM_RPM_STATUS_ID_MAP(8930, MMFPB_CLK),
140 MSM_RPM_STATUS_ID_MAP(8930, EBI1_CLK),
141 MSM_RPM_STATUS_ID_MAP(8930, APPS_FABRIC_CFG_HALT),
142 MSM_RPM_STATUS_ID_MAP(8930, APPS_FABRIC_CFG_CLKMOD),
143 MSM_RPM_STATUS_ID_MAP(8930, APPS_FABRIC_CFG_IOCTL),
144 MSM_RPM_STATUS_ID_MAP(8930, APPS_FABRIC_ARB),
145 MSM_RPM_STATUS_ID_MAP(8930, SYS_FABRIC_CFG_HALT),
146 MSM_RPM_STATUS_ID_MAP(8930, SYS_FABRIC_CFG_CLKMOD),
147 MSM_RPM_STATUS_ID_MAP(8930, SYS_FABRIC_CFG_IOCTL),
148 MSM_RPM_STATUS_ID_MAP(8930, SYSTEM_FABRIC_ARB),
149 MSM_RPM_STATUS_ID_MAP(8930, MMSS_FABRIC_CFG_HALT),
150 MSM_RPM_STATUS_ID_MAP(8930, MMSS_FABRIC_CFG_CLKMOD),
151 MSM_RPM_STATUS_ID_MAP(8930, MMSS_FABRIC_CFG_IOCTL),
152 MSM_RPM_STATUS_ID_MAP(8930, MM_FABRIC_ARB),
153 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S1_0),
154 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S1_1),
155 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S2_0),
156 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S2_1),
157 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S3_0),
158 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S3_1),
159 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S4_0),
160 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S4_1),
161 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L1_0),
162 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L1_1),
163 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L2_0),
164 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L2_1),
165 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L3_0),
166 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L3_1),
167 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L4_0),
168 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L4_1),
169 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L5_0),
170 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L5_1),
171 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L6_0),
172 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L6_1),
173 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L7_0),
174 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L7_1),
175 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L8_0),
176 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L8_1),
177 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L9_0),
178 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L9_1),
179 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L10_0),
180 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L10_1),
181 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L11_0),
182 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L11_1),
183 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L12_0),
184 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L12_1),
185 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L13_0),
186 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L13_1),
187 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L14_0),
188 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L14_1),
189 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L15_0),
190 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L15_1),
191 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L16_0),
192 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L16_1),
193 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L17_0),
194 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L17_1),
195 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L18_0),
196 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L18_1),
197 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L19_0),
198 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L19_1),
199 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L20_0),
200 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L20_1),
201 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L21_0),
202 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L21_1),
203 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L22_0),
204 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L22_1),
205 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L23_0),
206 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L23_1),
207 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L24_0),
208 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L24_1),
209 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L25_0),
210 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L25_1),
211 MSM_RPM_STATUS_ID_MAP(8930, PM8038_CLK1_0),
212 MSM_RPM_STATUS_ID_MAP(8930, PM8038_CLK1_1),
213 MSM_RPM_STATUS_ID_MAP(8930, PM8038_CLK2_0),
214 MSM_RPM_STATUS_ID_MAP(8930, PM8038_CLK2_1),
215 MSM_RPM_STATUS_ID_MAP(8930, PM8038_LVS1),
216 MSM_RPM_STATUS_ID_MAP(8930, PM8038_LVS2),
217 MSM_RPM_STATUS_ID_MAP(8930, NCP_0),
218 MSM_RPM_STATUS_ID_MAP(8930, NCP_1),
219 MSM_RPM_STATUS_ID_MAP(8930, CXO_BUFFERS),
220 MSM_RPM_STATUS_ID_MAP(8930, USB_OTG_SWITCH),
221 MSM_RPM_STATUS_ID_MAP(8930, HDMI_SWITCH),
Mahesh Sivasubramanianef2a0fa2012-01-24 15:57:01 -0700222 MSM_RPM_STATUS_ID_MAP(8930, QDSS_CLK),
Mahesh Sivasubramanian9e52ce42012-02-01 16:00:19 -0700223 MSM_RPM_STATUS_ID_MAP(8930, VOLTAGE_CORNER),
Praveen Chidambaram78499012011-11-01 17:15:17 -0600224 },
225 .target_ctrl_id = {
226 MSM_RPM_CTRL_MAP(8930, VERSION_MAJOR),
227 MSM_RPM_CTRL_MAP(8930, VERSION_MINOR),
228 MSM_RPM_CTRL_MAP(8930, VERSION_BUILD),
229 MSM_RPM_CTRL_MAP(8930, REQ_CTX_0),
230 MSM_RPM_CTRL_MAP(8930, REQ_SEL_0),
231 MSM_RPM_CTRL_MAP(8930, ACK_CTX_0),
232 MSM_RPM_CTRL_MAP(8930, ACK_SEL_0),
233 },
234 .sel_invalidate = MSM_RPM_8930_SEL_INVALIDATE,
235 .sel_notification = MSM_RPM_8930_SEL_NOTIFICATION,
236 .sel_last = MSM_RPM_8930_SEL_LAST,
237 .ver = {3, 0, 0},
238};
239
240struct platform_device msm8930_rpm_device = {
241 .name = "msm_rpm",
242 .id = -1,
243};
244
245static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
246 .phys_addr_base = 0x0010C000,
247 .reg_offsets = {
248 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
249 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
250 },
251 .phys_size = SZ_8K,
252 .log_len = 4096, /* log's buffer length in bytes */
253 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
254};
255
256struct platform_device msm8930_rpm_log_device = {
257 .name = "msm_rpm_log",
258 .id = -1,
259 .dev = {
260 .platform_data = &msm_rpm_log_pdata,
261 },
262};
263
264static struct msm_rpmstats_platform_data msm_rpm_stat_pdata = {
265 .phys_addr_base = 0x0010D204,
266 .phys_size = SZ_8K,
267};
268
269struct platform_device msm8930_rpm_stat_device = {
270 .name = "msm_rpm_stat",
271 .id = -1,
272 .dev = {
273 .platform_data = &msm_rpm_stat_pdata,
274 },
275};
276