aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/vp.c
diff options
context:
space:
mode:
authorKevin Hilman <khilman@ti.com>2011-07-14 14:10:27 -0400
committerKevin Hilman <khilman@ti.com>2011-09-15 15:09:08 -0400
commit6f56727383ca3233f40af5e792a08bf07b18f5fd (patch)
tree6fe096119bada3358ceb4dd6b64696616cbc7ce4 /arch/arm/mach-omap2/vp.c
parent0e2f3d9cb8f3c6464ac24c489fa713699c037dd4 (diff)
OMAP3+: VP: move timing calculation/config into VP init
Move VP timing calcluation (based on sys clock) and register programming into VP init. Signed-off-by: Kevin Hilman <khilman@ti.com>
Diffstat (limited to 'arch/arm/mach-omap2/vp.c')
-rw-r--r--arch/arm/mach-omap2/vp.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c
index 297d094263aa..ea61a47bd199 100644
--- a/arch/arm/mach-omap2/vp.c
+++ b/arch/arm/mach-omap2/vp.c
@@ -50,7 +50,7 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
50{ 50{
51 struct omap_vp_instance *vp = voltdm->vp; 51 struct omap_vp_instance *vp = voltdm->vp;
52 struct omap_vdd_info *vdd = voltdm->vdd; 52 struct omap_vdd_info *vdd = voltdm->vdd;
53 u32 vp_val; 53 u32 vp_val, sys_clk_rate, timeout_val, waittime;
54 54
55 if (!voltdm->read || !voltdm->write) { 55 if (!voltdm->read || !voltdm->write) {
56 pr_err("%s: No read/write API for accessing vdd_%s regs\n", 56 pr_err("%s: No read/write API for accessing vdd_%s regs\n",
@@ -58,6 +58,27 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
58 return; 58 return;
59 } 59 }
60 60
61 vp->enabled = false;
62
63 /* Divide to avoid overflow */
64 sys_clk_rate = voltdm->sys_clk.rate / 1000;
65
66 vdd->vp_rt_data.vpconfig_erroroffset =
67 (voltdm->pmic->vp_erroroffset <<
68 __ffs(voltdm->vp->common->vpconfig_erroroffset_mask));
69
70 timeout_val = (sys_clk_rate * voltdm->pmic->vp_timeout_us) / 1000;
71 vdd->vp_rt_data.vlimitto_timeout = timeout_val;
72 vdd->vp_rt_data.vlimitto_vddmin = voltdm->pmic->vp_vddmin;
73 vdd->vp_rt_data.vlimitto_vddmax = voltdm->pmic->vp_vddmax;
74
75 waittime = ((voltdm->pmic->step_size / voltdm->pmic->slew_rate) *
76 sys_clk_rate) / 1000;
77 vdd->vp_rt_data.vstepmin_smpswaittimemin = waittime;
78 vdd->vp_rt_data.vstepmax_smpswaittimemax = waittime;
79 vdd->vp_rt_data.vstepmin_stepmin = voltdm->pmic->vp_vstepmin;
80 vdd->vp_rt_data.vstepmax_stepmax = voltdm->pmic->vp_vstepmax;
81
61 vp_val = vdd->vp_rt_data.vpconfig_erroroffset | 82 vp_val = vdd->vp_rt_data.vpconfig_erroroffset |
62 (vdd->vp_rt_data.vpconfig_errorgain << 83 (vdd->vp_rt_data.vpconfig_errorgain <<
63 __ffs(vp->common->vpconfig_errorgain_mask)) | 84 __ffs(vp->common->vpconfig_errorgain_mask)) |