blob: 257f37276361736f04eb0931592dd972809f0592 [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),
42 MSM_RPM_MAP(8930, TRIGGER_TIMED_0, TRIGGER_TIMED_0, 2),
43 MSM_RPM_MAP(8930, RPM_CTL, RPM_CTL, 1),
44 MSM_RPM_MAP(8930, CXO_CLK, CXO_CLK, 1),
45 MSM_RPM_MAP(8930, PXO_CLK, PXO_CLK, 1),
46 MSM_RPM_MAP(8930, APPS_FABRIC_CLK, APPS_FABRIC_CLK, 1),
47 MSM_RPM_MAP(8930, SYSTEM_FABRIC_CLK, SYSTEM_FABRIC_CLK, 1),
48 MSM_RPM_MAP(8930, MM_FABRIC_CLK, MM_FABRIC_CLK, 1),
49 MSM_RPM_MAP(8930, DAYTONA_FABRIC_CLK, DAYTONA_FABRIC_CLK, 1),
50 MSM_RPM_MAP(8930, SFPB_CLK, SFPB_CLK, 1),
51 MSM_RPM_MAP(8930, CFPB_CLK, CFPB_CLK, 1),
52 MSM_RPM_MAP(8930, MMFPB_CLK, MMFPB_CLK, 1),
53 MSM_RPM_MAP(8930, EBI1_CLK, EBI1_CLK, 1),
54 MSM_RPM_MAP(8930, APPS_FABRIC_CFG_HALT_0,
55 APPS_FABRIC_CFG_HALT, 2),
56 MSM_RPM_MAP(8930, APPS_FABRIC_CFG_CLKMOD_0,
57 APPS_FABRIC_CFG_CLKMOD, 3),
58 MSM_RPM_MAP(8930, APPS_FABRIC_CFG_IOCTL,
59 APPS_FABRIC_CFG_IOCTL, 1),
60 MSM_RPM_MAP(8930, APPS_FABRIC_ARB_0, APPS_FABRIC_ARB, 6),
61 MSM_RPM_MAP(8930, SYS_FABRIC_CFG_HALT_0,
62 SYS_FABRIC_CFG_HALT, 2),
63 MSM_RPM_MAP(8930, SYS_FABRIC_CFG_CLKMOD_0,
64 SYS_FABRIC_CFG_CLKMOD, 3),
65 MSM_RPM_MAP(8930, SYS_FABRIC_CFG_IOCTL,
66 SYS_FABRIC_CFG_IOCTL, 1),
67 MSM_RPM_MAP(8930, SYSTEM_FABRIC_ARB_0,
68 SYSTEM_FABRIC_ARB, 20),
69 MSM_RPM_MAP(8930, MMSS_FABRIC_CFG_HALT_0,
70 MMSS_FABRIC_CFG_HALT, 2),
71 MSM_RPM_MAP(8930, MMSS_FABRIC_CFG_CLKMOD_0,
72 MMSS_FABRIC_CFG_CLKMOD, 3),
73 MSM_RPM_MAP(8930, MMSS_FABRIC_CFG_IOCTL,
74 MMSS_FABRIC_CFG_IOCTL, 1),
75 MSM_RPM_MAP(8930, MM_FABRIC_ARB_0, MM_FABRIC_ARB, 11),
76 MSM_RPM_MAP(8930, PM8038_S1_0, PM8038_S1, 2),
77 MSM_RPM_MAP(8930, PM8038_S2_0, PM8038_S2, 2),
78 MSM_RPM_MAP(8930, PM8038_S3_0, PM8038_S3, 2),
79 MSM_RPM_MAP(8930, PM8038_S4_0, PM8038_S4, 2),
80 MSM_RPM_MAP(8930, PM8038_S5_0, PM8038_S5, 2),
81 MSM_RPM_MAP(8930, PM8038_S6_0, PM8038_S6, 2),
82 MSM_RPM_MAP(8930, PM8038_L1_0, PM8038_L1, 2),
83 MSM_RPM_MAP(8930, PM8038_L2_0, PM8038_L2, 2),
84 MSM_RPM_MAP(8930, PM8038_L3_0, PM8038_L3, 2),
85 MSM_RPM_MAP(8930, PM8038_L4_0, PM8038_L4, 2),
86 MSM_RPM_MAP(8930, PM8038_L5_0, PM8038_L5, 2),
87 MSM_RPM_MAP(8930, PM8038_L6_0, PM8038_L6, 2),
88 MSM_RPM_MAP(8930, PM8038_L7_0, PM8038_L7, 2),
89 MSM_RPM_MAP(8930, PM8038_L8_0, PM8038_L8, 2),
90 MSM_RPM_MAP(8930, PM8038_L9_0, PM8038_L9, 2),
91 MSM_RPM_MAP(8930, PM8038_L10_0, PM8038_L10, 2),
92 MSM_RPM_MAP(8930, PM8038_L11_0, PM8038_L11, 2),
93 MSM_RPM_MAP(8930, PM8038_L12_0, PM8038_L12, 2),
94 MSM_RPM_MAP(8930, PM8038_L13_0, PM8038_L13, 2),
95 MSM_RPM_MAP(8930, PM8038_L14_0, PM8038_L14, 2),
96 MSM_RPM_MAP(8930, PM8038_L15_0, PM8038_L15, 2),
97 MSM_RPM_MAP(8930, PM8038_L16_0, PM8038_L16, 2),
98 MSM_RPM_MAP(8930, PM8038_L17_0, PM8038_L17, 2),
99 MSM_RPM_MAP(8930, PM8038_L18_0, PM8038_L18, 2),
100 MSM_RPM_MAP(8930, PM8038_L19_0, PM8038_L19, 2),
101 MSM_RPM_MAP(8930, PM8038_L20_0, PM8038_L20, 2),
102 MSM_RPM_MAP(8930, PM8038_L21_0, PM8038_L21, 2),
103 MSM_RPM_MAP(8930, PM8038_L22_0, PM8038_L22, 2),
104 MSM_RPM_MAP(8930, PM8038_L23_0, PM8038_L23, 2),
105 MSM_RPM_MAP(8930, PM8038_L24_0, PM8038_L24, 2),
106 MSM_RPM_MAP(8930, PM8038_L25_0, PM8038_L25, 2),
107 MSM_RPM_MAP(8930, PM8038_L26_0, PM8038_L26, 2),
108 MSM_RPM_MAP(8930, PM8038_L27_0, PM8038_L27, 2),
109 MSM_RPM_MAP(8930, PM8038_CLK1_0, PM8038_CLK1, 2),
110 MSM_RPM_MAP(8930, PM8038_CLK2_0, PM8038_CLK2, 2),
111 MSM_RPM_MAP(8930, PM8038_LVS1, PM8038_LVS1, 1),
112 MSM_RPM_MAP(8930, PM8038_LVS2, PM8038_LVS2, 1),
113 MSM_RPM_MAP(8930, NCP_0, NCP, 2),
114 MSM_RPM_MAP(8930, CXO_BUFFERS, CXO_BUFFERS, 1),
115 MSM_RPM_MAP(8930, USB_OTG_SWITCH, USB_OTG_SWITCH, 1),
116 MSM_RPM_MAP(8930, HDMI_SWITCH, HDMI_SWITCH, 1),
117 MSM_RPM_MAP(8930, QDSS_CLK, QDSS_CLK, 1),
118 },
119 .target_status = {
120 MSM_RPM_STATUS_ID_MAP(8930, VERSION_MAJOR),
121 MSM_RPM_STATUS_ID_MAP(8930, VERSION_MINOR),
122 MSM_RPM_STATUS_ID_MAP(8930, VERSION_BUILD),
123 MSM_RPM_STATUS_ID_MAP(8930, SUPPORTED_RESOURCES_0),
124 MSM_RPM_STATUS_ID_MAP(8930, SUPPORTED_RESOURCES_1),
125 MSM_RPM_STATUS_ID_MAP(8930, SUPPORTED_RESOURCES_2),
126 MSM_RPM_STATUS_ID_MAP(8930, RESERVED_SUPPORTED_RESOURCES_0),
127 MSM_RPM_STATUS_ID_MAP(8930, SEQUENCE),
128 MSM_RPM_STATUS_ID_MAP(8930, RPM_CTL),
129 MSM_RPM_STATUS_ID_MAP(8930, CXO_CLK),
130 MSM_RPM_STATUS_ID_MAP(8930, PXO_CLK),
131 MSM_RPM_STATUS_ID_MAP(8930, APPS_FABRIC_CLK),
132 MSM_RPM_STATUS_ID_MAP(8930, SYSTEM_FABRIC_CLK),
133 MSM_RPM_STATUS_ID_MAP(8930, MM_FABRIC_CLK),
134 MSM_RPM_STATUS_ID_MAP(8930, DAYTONA_FABRIC_CLK),
135 MSM_RPM_STATUS_ID_MAP(8930, SFPB_CLK),
136 MSM_RPM_STATUS_ID_MAP(8930, CFPB_CLK),
137 MSM_RPM_STATUS_ID_MAP(8930, MMFPB_CLK),
138 MSM_RPM_STATUS_ID_MAP(8930, EBI1_CLK),
139 MSM_RPM_STATUS_ID_MAP(8930, APPS_FABRIC_CFG_HALT),
140 MSM_RPM_STATUS_ID_MAP(8930, APPS_FABRIC_CFG_CLKMOD),
141 MSM_RPM_STATUS_ID_MAP(8930, APPS_FABRIC_CFG_IOCTL),
142 MSM_RPM_STATUS_ID_MAP(8930, APPS_FABRIC_ARB),
143 MSM_RPM_STATUS_ID_MAP(8930, SYS_FABRIC_CFG_HALT),
144 MSM_RPM_STATUS_ID_MAP(8930, SYS_FABRIC_CFG_CLKMOD),
145 MSM_RPM_STATUS_ID_MAP(8930, SYS_FABRIC_CFG_IOCTL),
146 MSM_RPM_STATUS_ID_MAP(8930, SYSTEM_FABRIC_ARB),
147 MSM_RPM_STATUS_ID_MAP(8930, MMSS_FABRIC_CFG_HALT),
148 MSM_RPM_STATUS_ID_MAP(8930, MMSS_FABRIC_CFG_CLKMOD),
149 MSM_RPM_STATUS_ID_MAP(8930, MMSS_FABRIC_CFG_IOCTL),
150 MSM_RPM_STATUS_ID_MAP(8930, MM_FABRIC_ARB),
151 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S1_0),
152 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S1_1),
153 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S2_0),
154 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S2_1),
155 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S3_0),
156 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S3_1),
157 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S4_0),
158 MSM_RPM_STATUS_ID_MAP(8930, PM8038_S4_1),
159 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L1_0),
160 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L1_1),
161 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L2_0),
162 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L2_1),
163 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L3_0),
164 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L3_1),
165 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L4_0),
166 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L4_1),
167 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L5_0),
168 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L5_1),
169 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L6_0),
170 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L6_1),
171 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L7_0),
172 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L7_1),
173 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L8_0),
174 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L8_1),
175 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L9_0),
176 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L9_1),
177 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L10_0),
178 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L10_1),
179 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L11_0),
180 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L11_1),
181 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L12_0),
182 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L12_1),
183 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L13_0),
184 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L13_1),
185 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L14_0),
186 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L14_1),
187 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L15_0),
188 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L15_1),
189 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L16_0),
190 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L16_1),
191 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L17_0),
192 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L17_1),
193 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L18_0),
194 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L18_1),
195 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L19_0),
196 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L19_1),
197 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L20_0),
198 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L20_1),
199 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L21_0),
200 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L21_1),
201 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L22_0),
202 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L22_1),
203 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L23_0),
204 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L23_1),
205 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L24_0),
206 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L24_1),
207 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L25_0),
208 MSM_RPM_STATUS_ID_MAP(8930, PM8038_L25_1),
209 MSM_RPM_STATUS_ID_MAP(8930, PM8038_CLK1_0),
210 MSM_RPM_STATUS_ID_MAP(8930, PM8038_CLK1_1),
211 MSM_RPM_STATUS_ID_MAP(8930, PM8038_CLK2_0),
212 MSM_RPM_STATUS_ID_MAP(8930, PM8038_CLK2_1),
213 MSM_RPM_STATUS_ID_MAP(8930, PM8038_LVS1),
214 MSM_RPM_STATUS_ID_MAP(8930, PM8038_LVS2),
215 MSM_RPM_STATUS_ID_MAP(8930, NCP_0),
216 MSM_RPM_STATUS_ID_MAP(8930, NCP_1),
217 MSM_RPM_STATUS_ID_MAP(8930, CXO_BUFFERS),
218 MSM_RPM_STATUS_ID_MAP(8930, USB_OTG_SWITCH),
219 MSM_RPM_STATUS_ID_MAP(8930, HDMI_SWITCH),
220 },
221 .target_ctrl_id = {
222 MSM_RPM_CTRL_MAP(8930, VERSION_MAJOR),
223 MSM_RPM_CTRL_MAP(8930, VERSION_MINOR),
224 MSM_RPM_CTRL_MAP(8930, VERSION_BUILD),
225 MSM_RPM_CTRL_MAP(8930, REQ_CTX_0),
226 MSM_RPM_CTRL_MAP(8930, REQ_SEL_0),
227 MSM_RPM_CTRL_MAP(8930, ACK_CTX_0),
228 MSM_RPM_CTRL_MAP(8930, ACK_SEL_0),
229 },
230 .sel_invalidate = MSM_RPM_8930_SEL_INVALIDATE,
231 .sel_notification = MSM_RPM_8930_SEL_NOTIFICATION,
232 .sel_last = MSM_RPM_8930_SEL_LAST,
233 .ver = {3, 0, 0},
234};
235
236struct platform_device msm8930_rpm_device = {
237 .name = "msm_rpm",
238 .id = -1,
239};
240
241static struct msm_rpm_log_platform_data msm_rpm_log_pdata = {
242 .phys_addr_base = 0x0010C000,
243 .reg_offsets = {
244 [MSM_RPM_LOG_PAGE_INDICES] = 0x00000080,
245 [MSM_RPM_LOG_PAGE_BUFFER] = 0x000000A0,
246 },
247 .phys_size = SZ_8K,
248 .log_len = 4096, /* log's buffer length in bytes */
249 .log_len_mask = (4096 >> 2) - 1, /* length mask in units of u32 */
250};
251
252struct platform_device msm8930_rpm_log_device = {
253 .name = "msm_rpm_log",
254 .id = -1,
255 .dev = {
256 .platform_data = &msm_rpm_log_pdata,
257 },
258};
259
260static struct msm_rpmstats_platform_data msm_rpm_stat_pdata = {
261 .phys_addr_base = 0x0010D204,
262 .phys_size = SZ_8K,
263};
264
265struct platform_device msm8930_rpm_stat_device = {
266 .name = "msm_rpm_stat",
267 .id = -1,
268 .dev = {
269 .platform_data = &msm_rpm_stat_pdata,
270 },
271};
272