diff options
Diffstat (limited to 'arch/arm/mach-omap2/vp.c')
-rw-r--r-- | arch/arm/mach-omap2/vp.c | 88 |
1 files changed, 41 insertions, 47 deletions
diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c index a3afcbe741e3..53d6018fa678 100644 --- a/arch/arm/mach-omap2/vp.c +++ b/arch/arm/mach-omap2/vp.c | |||
@@ -14,7 +14,7 @@ static void __init vp_debugfs_init(struct voltagedomain *voltdm); | |||
14 | 14 | ||
15 | static void vp_latch_vsel(struct voltagedomain *voltdm) | 15 | static void vp_latch_vsel(struct voltagedomain *voltdm) |
16 | { | 16 | { |
17 | struct omap_vp_instance_data *vp = voltdm->vdd->vp_data; | 17 | struct omap_vp_instance *vp = voltdm->vp; |
18 | u32 vpconfig; | 18 | u32 vpconfig; |
19 | unsigned long uvdc; | 19 | unsigned long uvdc; |
20 | char vsel; | 20 | char vsel; |
@@ -35,14 +35,14 @@ static void vp_latch_vsel(struct voltagedomain *voltdm) | |||
35 | vsel = voltdm->pmic->uv_to_vsel(uvdc); | 35 | vsel = voltdm->pmic->uv_to_vsel(uvdc); |
36 | 36 | ||
37 | vpconfig = voltdm->read(vp->vpconfig); | 37 | vpconfig = voltdm->read(vp->vpconfig); |
38 | vpconfig &= ~(vp->vp_common->vpconfig_initvoltage_mask | | 38 | vpconfig &= ~(vp->common->vpconfig_initvoltage_mask | |
39 | vp->vp_common->vpconfig_initvdd); | 39 | vp->common->vpconfig_initvdd); |
40 | vpconfig |= vsel << vp->vp_common->vpconfig_initvoltage_shift; | 40 | vpconfig |= vsel << vp->common->vpconfig_initvoltage_shift; |
41 | 41 | ||
42 | voltdm->write(vpconfig, vp->vpconfig); | 42 | voltdm->write(vpconfig, vp->vpconfig); |
43 | 43 | ||
44 | /* Trigger initVDD value copy to voltage processor */ | 44 | /* Trigger initVDD value copy to voltage processor */ |
45 | voltdm->write((vpconfig | vp->vp_common->vpconfig_initvdd), | 45 | voltdm->write((vpconfig | vp->common->vpconfig_initvdd), |
46 | vp->vpconfig); | 46 | vp->vpconfig); |
47 | 47 | ||
48 | /* Clear initVDD copy trigger bit */ | 48 | /* Clear initVDD copy trigger bit */ |
@@ -52,7 +52,7 @@ static void vp_latch_vsel(struct voltagedomain *voltdm) | |||
52 | /* Generic voltage init functions */ | 52 | /* Generic voltage init functions */ |
53 | void __init omap_vp_init(struct voltagedomain *voltdm) | 53 | void __init omap_vp_init(struct voltagedomain *voltdm) |
54 | { | 54 | { |
55 | struct omap_vp_instance_data *vp = voltdm->vdd->vp_data; | 55 | struct omap_vp_instance *vp = voltdm->vp; |
56 | struct omap_vdd_info *vdd = voltdm->vdd; | 56 | struct omap_vdd_info *vdd = voltdm->vdd; |
57 | u32 vp_val; | 57 | u32 vp_val; |
58 | 58 | ||
@@ -64,28 +64,28 @@ void __init omap_vp_init(struct voltagedomain *voltdm) | |||
64 | 64 | ||
65 | vp_val = vdd->vp_rt_data.vpconfig_erroroffset | | 65 | vp_val = vdd->vp_rt_data.vpconfig_erroroffset | |
66 | (vdd->vp_rt_data.vpconfig_errorgain << | 66 | (vdd->vp_rt_data.vpconfig_errorgain << |
67 | vp->vp_common->vpconfig_errorgain_shift) | | 67 | vp->common->vpconfig_errorgain_shift) | |
68 | vp->vp_common->vpconfig_timeouten; | 68 | vp->common->vpconfig_timeouten; |
69 | voltdm->write(vp_val, vp->vpconfig); | 69 | voltdm->write(vp_val, vp->vpconfig); |
70 | 70 | ||
71 | vp_val = ((vdd->vp_rt_data.vstepmin_smpswaittimemin << | 71 | vp_val = ((vdd->vp_rt_data.vstepmin_smpswaittimemin << |
72 | vp->vp_common->vstepmin_smpswaittimemin_shift) | | 72 | vp->common->vstepmin_smpswaittimemin_shift) | |
73 | (vdd->vp_rt_data.vstepmin_stepmin << | 73 | (vdd->vp_rt_data.vstepmin_stepmin << |
74 | vp->vp_common->vstepmin_stepmin_shift)); | 74 | vp->common->vstepmin_stepmin_shift)); |
75 | voltdm->write(vp_val, vp->vstepmin); | 75 | voltdm->write(vp_val, vp->vstepmin); |
76 | 76 | ||
77 | vp_val = ((vdd->vp_rt_data.vstepmax_smpswaittimemax << | 77 | vp_val = ((vdd->vp_rt_data.vstepmax_smpswaittimemax << |
78 | vp->vp_common->vstepmax_smpswaittimemax_shift) | | 78 | vp->common->vstepmax_smpswaittimemax_shift) | |
79 | (vdd->vp_rt_data.vstepmax_stepmax << | 79 | (vdd->vp_rt_data.vstepmax_stepmax << |
80 | vp->vp_common->vstepmax_stepmax_shift)); | 80 | vp->common->vstepmax_stepmax_shift)); |
81 | voltdm->write(vp_val, vp->vstepmax); | 81 | voltdm->write(vp_val, vp->vstepmax); |
82 | 82 | ||
83 | vp_val = ((vdd->vp_rt_data.vlimitto_vddmax << | 83 | vp_val = ((vdd->vp_rt_data.vlimitto_vddmax << |
84 | vp->vp_common->vlimitto_vddmax_shift) | | 84 | vp->common->vlimitto_vddmax_shift) | |
85 | (vdd->vp_rt_data.vlimitto_vddmin << | 85 | (vdd->vp_rt_data.vlimitto_vddmin << |
86 | vp->vp_common->vlimitto_vddmin_shift) | | 86 | vp->common->vlimitto_vddmin_shift) | |
87 | (vdd->vp_rt_data.vlimitto_timeout << | 87 | (vdd->vp_rt_data.vlimitto_timeout << |
88 | vp->vp_common->vlimitto_timeout_shift)); | 88 | vp->common->vlimitto_timeout_shift)); |
89 | voltdm->write(vp_val, vp->vlimitto); | 89 | voltdm->write(vp_val, vp->vlimitto); |
90 | 90 | ||
91 | vp_debugfs_init(voltdm); | 91 | vp_debugfs_init(voltdm); |
@@ -95,7 +95,7 @@ void __init omap_vp_init(struct voltagedomain *voltdm) | |||
95 | int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, | 95 | int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, |
96 | unsigned long target_volt) | 96 | unsigned long target_volt) |
97 | { | 97 | { |
98 | struct omap_vp_instance_data *vp = voltdm->vdd->vp_data; | 98 | struct omap_vp_instance *vp = voltdm->vp; |
99 | u32 vpconfig; | 99 | u32 vpconfig; |
100 | u8 target_vsel, current_vsel; | 100 | u8 target_vsel, current_vsel; |
101 | int ret, timeout = 0; | 101 | int ret, timeout = 0; |
@@ -109,8 +109,8 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, | |||
109 | * is <3us | 109 | * is <3us |
110 | */ | 110 | */ |
111 | while (timeout++ < VP_TRANXDONE_TIMEOUT) { | 111 | while (timeout++ < VP_TRANXDONE_TIMEOUT) { |
112 | vp->vp_common->ops->clear_txdone(vp->id); | 112 | vp->common->ops->clear_txdone(vp->id); |
113 | if (!vp->vp_common->ops->check_txdone(vp->id)) | 113 | if (!vp->common->ops->check_txdone(vp->id)) |
114 | break; | 114 | break; |
115 | udelay(1); | 115 | udelay(1); |
116 | } | 116 | } |
@@ -122,19 +122,19 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, | |||
122 | 122 | ||
123 | /* Configure for VP-Force Update */ | 123 | /* Configure for VP-Force Update */ |
124 | vpconfig = voltdm->read(vp->vpconfig); | 124 | vpconfig = voltdm->read(vp->vpconfig); |
125 | vpconfig &= ~(vp->vp_common->vpconfig_initvdd | | 125 | vpconfig &= ~(vp->common->vpconfig_initvdd | |
126 | vp->vp_common->vpconfig_forceupdate | | 126 | vp->common->vpconfig_forceupdate | |
127 | vp->vp_common->vpconfig_initvoltage_mask); | 127 | vp->common->vpconfig_initvoltage_mask); |
128 | vpconfig |= ((target_vsel << | 128 | vpconfig |= ((target_vsel << |
129 | vp->vp_common->vpconfig_initvoltage_shift)); | 129 | vp->common->vpconfig_initvoltage_shift)); |
130 | voltdm->write(vpconfig, vp->vpconfig); | 130 | voltdm->write(vpconfig, vp->vpconfig); |
131 | 131 | ||
132 | /* Trigger initVDD value copy to voltage processor */ | 132 | /* Trigger initVDD value copy to voltage processor */ |
133 | vpconfig |= vp->vp_common->vpconfig_initvdd; | 133 | vpconfig |= vp->common->vpconfig_initvdd; |
134 | voltdm->write(vpconfig, vp->vpconfig); | 134 | voltdm->write(vpconfig, vp->vpconfig); |
135 | 135 | ||
136 | /* Force update of voltage */ | 136 | /* Force update of voltage */ |
137 | vpconfig |= vp->vp_common->vpconfig_forceupdate; | 137 | vpconfig |= vp->common->vpconfig_forceupdate; |
138 | voltdm->write(vpconfig, vp->vpconfig); | 138 | voltdm->write(vpconfig, vp->vpconfig); |
139 | 139 | ||
140 | /* | 140 | /* |
@@ -142,7 +142,7 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, | |||
142 | * Depends on SMPSWAITTIMEMIN/MAX and voltage change | 142 | * Depends on SMPSWAITTIMEMIN/MAX and voltage change |
143 | */ | 143 | */ |
144 | timeout = 0; | 144 | timeout = 0; |
145 | omap_test_timeout(vp->vp_common->ops->check_txdone(vp->id), | 145 | omap_test_timeout(vp->common->ops->check_txdone(vp->id), |
146 | VP_TRANXDONE_TIMEOUT, timeout); | 146 | VP_TRANXDONE_TIMEOUT, timeout); |
147 | if (timeout >= VP_TRANXDONE_TIMEOUT) | 147 | if (timeout >= VP_TRANXDONE_TIMEOUT) |
148 | pr_err("%s: vdd_%s TRANXDONE timeout exceeded." | 148 | pr_err("%s: vdd_%s TRANXDONE timeout exceeded." |
@@ -157,8 +157,8 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, | |||
157 | */ | 157 | */ |
158 | timeout = 0; | 158 | timeout = 0; |
159 | while (timeout++ < VP_TRANXDONE_TIMEOUT) { | 159 | while (timeout++ < VP_TRANXDONE_TIMEOUT) { |
160 | vp->vp_common->ops->clear_txdone(vp->id); | 160 | vp->common->ops->clear_txdone(vp->id); |
161 | if (!vp->vp_common->ops->check_txdone(vp->id)) | 161 | if (!vp->common->ops->check_txdone(vp->id)) |
162 | break; | 162 | break; |
163 | udelay(1); | 163 | udelay(1); |
164 | } | 164 | } |
@@ -170,10 +170,10 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, | |||
170 | 170 | ||
171 | vpconfig = voltdm->read(vp->vpconfig); | 171 | vpconfig = voltdm->read(vp->vpconfig); |
172 | /* Clear initVDD copy trigger bit */ | 172 | /* Clear initVDD copy trigger bit */ |
173 | vpconfig &= ~vp->vp_common->vpconfig_initvdd; | 173 | vpconfig &= ~vp->common->vpconfig_initvdd; |
174 | voltdm->write(vpconfig, vp->vpconfig); | 174 | voltdm->write(vpconfig, vp->vpconfig); |
175 | /* Clear force bit */ | 175 | /* Clear force bit */ |
176 | vpconfig &= ~vp->vp_common->vpconfig_forceupdate; | 176 | vpconfig &= ~vp->common->vpconfig_forceupdate; |
177 | voltdm->write(vpconfig, vp->vpconfig); | 177 | voltdm->write(vpconfig, vp->vpconfig); |
178 | 178 | ||
179 | return 0; | 179 | return 0; |
@@ -187,8 +187,7 @@ int omap_vp_forceupdate_scale(struct voltagedomain *voltdm, | |||
187 | */ | 187 | */ |
188 | unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm) | 188 | unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm) |
189 | { | 189 | { |
190 | struct omap_vp_instance_data *vp = voltdm->vdd->vp_data; | 190 | struct omap_vp_instance *vp = voltdm->vp; |
191 | struct omap_vdd_info *vdd; | ||
192 | u8 curr_vsel; | 191 | u8 curr_vsel; |
193 | 192 | ||
194 | if (!voltdm || IS_ERR(voltdm)) { | 193 | if (!voltdm || IS_ERR(voltdm)) { |
@@ -196,7 +195,6 @@ unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm) | |||
196 | return 0; | 195 | return 0; |
197 | } | 196 | } |
198 | 197 | ||
199 | vdd = voltdm->vdd; | ||
200 | if (!voltdm->read) { | 198 | if (!voltdm->read) { |
201 | pr_err("%s: No read API for reading vdd_%s regs\n", | 199 | pr_err("%s: No read API for reading vdd_%s regs\n", |
202 | __func__, voltdm->name); | 200 | __func__, voltdm->name); |
@@ -223,8 +221,7 @@ unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm) | |||
223 | */ | 221 | */ |
224 | void omap_vp_enable(struct voltagedomain *voltdm) | 222 | void omap_vp_enable(struct voltagedomain *voltdm) |
225 | { | 223 | { |
226 | struct omap_vp_instance_data *vp; | 224 | struct omap_vp_instance *vp; |
227 | struct omap_vdd_info *vdd; | ||
228 | u32 vpconfig; | 225 | u32 vpconfig; |
229 | 226 | ||
230 | if (!voltdm || IS_ERR(voltdm)) { | 227 | if (!voltdm || IS_ERR(voltdm)) { |
@@ -232,8 +229,7 @@ void omap_vp_enable(struct voltagedomain *voltdm) | |||
232 | return; | 229 | return; |
233 | } | 230 | } |
234 | 231 | ||
235 | vdd = voltdm->vdd; | 232 | vp = voltdm->vp; |
236 | vp = voltdm->vdd->vp_data; | ||
237 | if (!voltdm->read || !voltdm->write) { | 233 | if (!voltdm->read || !voltdm->write) { |
238 | pr_err("%s: No read/write API for accessing vdd_%s regs\n", | 234 | pr_err("%s: No read/write API for accessing vdd_%s regs\n", |
239 | __func__, voltdm->name); | 235 | __func__, voltdm->name); |
@@ -241,16 +237,16 @@ void omap_vp_enable(struct voltagedomain *voltdm) | |||
241 | } | 237 | } |
242 | 238 | ||
243 | /* If VP is already enabled, do nothing. Return */ | 239 | /* If VP is already enabled, do nothing. Return */ |
244 | if (vdd->vp_enabled) | 240 | if (vp->enabled) |
245 | return; | 241 | return; |
246 | 242 | ||
247 | vp_latch_vsel(voltdm); | 243 | vp_latch_vsel(voltdm); |
248 | 244 | ||
249 | /* Enable VP */ | 245 | /* Enable VP */ |
250 | vpconfig = voltdm->read(vp->vpconfig); | 246 | vpconfig = voltdm->read(vp->vpconfig); |
251 | vpconfig |= vp->vp_common->vpconfig_vpenable; | 247 | vpconfig |= vp->common->vpconfig_vpenable; |
252 | voltdm->write(vpconfig, vp->vpconfig); | 248 | voltdm->write(vpconfig, vp->vpconfig); |
253 | vdd->vp_enabled = true; | 249 | vp->enabled = true; |
254 | } | 250 | } |
255 | 251 | ||
256 | /** | 252 | /** |
@@ -262,8 +258,7 @@ void omap_vp_enable(struct voltagedomain *voltdm) | |||
262 | */ | 258 | */ |
263 | void omap_vp_disable(struct voltagedomain *voltdm) | 259 | void omap_vp_disable(struct voltagedomain *voltdm) |
264 | { | 260 | { |
265 | struct omap_vp_instance_data *vp; | 261 | struct omap_vp_instance *vp; |
266 | struct omap_vdd_info *vdd; | ||
267 | u32 vpconfig; | 262 | u32 vpconfig; |
268 | int timeout; | 263 | int timeout; |
269 | 264 | ||
@@ -272,8 +267,7 @@ void omap_vp_disable(struct voltagedomain *voltdm) | |||
272 | return; | 267 | return; |
273 | } | 268 | } |
274 | 269 | ||
275 | vdd = voltdm->vdd; | 270 | vp = voltdm->vp; |
276 | vp = voltdm->vdd->vp_data; | ||
277 | if (!voltdm->read || !voltdm->write) { | 271 | if (!voltdm->read || !voltdm->write) { |
278 | pr_err("%s: No read/write API for accessing vdd_%s regs\n", | 272 | pr_err("%s: No read/write API for accessing vdd_%s regs\n", |
279 | __func__, voltdm->name); | 273 | __func__, voltdm->name); |
@@ -281,7 +275,7 @@ void omap_vp_disable(struct voltagedomain *voltdm) | |||
281 | } | 275 | } |
282 | 276 | ||
283 | /* If VP is already disabled, do nothing. Return */ | 277 | /* If VP is already disabled, do nothing. Return */ |
284 | if (!vdd->vp_enabled) { | 278 | if (!vp->enabled) { |
285 | pr_warning("%s: Trying to disable VP for vdd_%s when" | 279 | pr_warning("%s: Trying to disable VP for vdd_%s when" |
286 | "it is already disabled\n", __func__, voltdm->name); | 280 | "it is already disabled\n", __func__, voltdm->name); |
287 | return; | 281 | return; |
@@ -289,7 +283,7 @@ void omap_vp_disable(struct voltagedomain *voltdm) | |||
289 | 283 | ||
290 | /* Disable VP */ | 284 | /* Disable VP */ |
291 | vpconfig = voltdm->read(vp->vpconfig); | 285 | vpconfig = voltdm->read(vp->vpconfig); |
292 | vpconfig &= ~vp->vp_common->vpconfig_vpenable; | 286 | vpconfig &= ~vp->common->vpconfig_vpenable; |
293 | voltdm->write(vpconfig, vp->vpconfig); | 287 | voltdm->write(vpconfig, vp->vpconfig); |
294 | 288 | ||
295 | /* | 289 | /* |
@@ -302,7 +296,7 @@ void omap_vp_disable(struct voltagedomain *voltdm) | |||
302 | pr_warning("%s: vdd_%s idle timedout\n", | 296 | pr_warning("%s: vdd_%s idle timedout\n", |
303 | __func__, voltdm->name); | 297 | __func__, voltdm->name); |
304 | 298 | ||
305 | vdd->vp_enabled = false; | 299 | vp->enabled = false; |
306 | 300 | ||
307 | return; | 301 | return; |
308 | } | 302 | } |
@@ -311,7 +305,7 @@ void omap_vp_disable(struct voltagedomain *voltdm) | |||
311 | static int vp_volt_debug_get(void *data, u64 *val) | 305 | static int vp_volt_debug_get(void *data, u64 *val) |
312 | { | 306 | { |
313 | struct voltagedomain *voltdm = (struct voltagedomain *)data; | 307 | struct voltagedomain *voltdm = (struct voltagedomain *)data; |
314 | struct omap_vp_instance_data *vp = voltdm->vdd->vp_data; | 308 | struct omap_vp_instance *vp = voltdm->vp; |
315 | struct omap_vdd_info *vdd = voltdm->vdd; | 309 | struct omap_vdd_info *vdd = voltdm->vdd; |
316 | u8 vsel; | 310 | u8 vsel; |
317 | 311 | ||