aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Hilman <khilman@ti.com>2011-04-04 20:58:21 -0400
committerKevin Hilman <khilman@ti.com>2011-09-15 15:09:08 -0400
commit667216d6a435a27f5aed64aa30de583ddccc58c8 (patch)
treea846a17520ee46cf9b852ee2ec5755ff88e414e5
parent76ea7424f80350884b4d70ae54cfa51f7f9b2a48 (diff)
OMAP3+: VP: remove omap_vp_runtime_data
Remove the "runtime" VP data in favor of direct programming of VP registers. The VP is in the PRM, which is in the wakeup powerdomain, so there is no need to keep the state dynamically. Fixes to original version from Nishanth Menon <nm@ti.com> Signed-off-by: Kevin Hilman <khilman@ti.com>
-rw-r--r--arch/arm/mach-omap2/voltage.h2
-rw-r--r--arch/arm/mach-omap2/vp.c70
-rw-r--r--arch/arm/mach-omap2/vp.h28
3 files changed, 31 insertions, 69 deletions
diff --git a/arch/arm/mach-omap2/voltage.h b/arch/arm/mach-omap2/voltage.h
index 3e163297682c..d14e0f487333 100644
--- a/arch/arm/mach-omap2/voltage.h
+++ b/arch/arm/mach-omap2/voltage.h
@@ -144,13 +144,11 @@ struct omap_voltdm_pmic {
144 * 144 *
145 * @volt_data : voltage table having the distinct voltages supported 145 * @volt_data : voltage table having the distinct voltages supported
146 * by the domain and other associated per voltage data. 146 * by the domain and other associated per voltage data.
147 * @vp_rt_data : VP data derived at runtime, not predefined
148 * @curr_volt : current voltage for this vdd. 147 * @curr_volt : current voltage for this vdd.
149 * @volt_scale : API to scale the voltage of the vdd. 148 * @volt_scale : API to scale the voltage of the vdd.
150 */ 149 */
151struct omap_vdd_info { 150struct omap_vdd_info {
152 struct omap_volt_data *volt_data; 151 struct omap_volt_data *volt_data;
153 struct omap_vp_runtime_data vp_rt_data;
154 u32 curr_volt; 152 u32 curr_volt;
155 153
156 int (*volt_scale) (struct voltagedomain *voltdm, 154 int (*volt_scale) (struct voltagedomain *voltdm,
diff --git a/arch/arm/mach-omap2/vp.c b/arch/arm/mach-omap2/vp.c
index f68a6db27111..e7d38f67db87 100644
--- a/arch/arm/mach-omap2/vp.c
+++ b/arch/arm/mach-omap2/vp.c
@@ -49,8 +49,8 @@ static void vp_latch_vsel(struct voltagedomain *voltdm)
49void __init omap_vp_init(struct voltagedomain *voltdm) 49void __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 u32 val, sys_clk_rate, timeout, waittime;
53 u32 vp_val, sys_clk_rate, timeout_val, waittime; 53 u32 vddmin, vddmax, vstepmin, vstepmax;
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",
@@ -63,47 +63,39 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
63 /* Divide to avoid overflow */ 63 /* Divide to avoid overflow */
64 sys_clk_rate = voltdm->sys_clk.rate / 1000; 64 sys_clk_rate = voltdm->sys_clk.rate / 1000;
65 65
66 vdd->vp_rt_data.vpconfig_erroroffset = 66 timeout = (sys_clk_rate * voltdm->pmic->vp_timeout_us) / 1000;
67 (voltdm->pmic->vp_erroroffset << 67 vddmin = voltdm->pmic->vp_vddmin;
68 __ffs(voltdm->vp->common->vpconfig_erroroffset_mask)); 68 vddmax = voltdm->pmic->vp_vddmax;
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 69
75 waittime = ((voltdm->pmic->step_size / voltdm->pmic->slew_rate) * 70 waittime = ((voltdm->pmic->step_size / voltdm->pmic->slew_rate) *
76 sys_clk_rate) / 1000; 71 sys_clk_rate) / 1000;
77 vdd->vp_rt_data.vstepmin_smpswaittimemin = waittime; 72 vstepmin = voltdm->pmic->vp_vstepmin;
78 vdd->vp_rt_data.vstepmax_smpswaittimemax = waittime; 73 vstepmax = voltdm->pmic->vp_vstepmax;
79 vdd->vp_rt_data.vstepmin_stepmin = voltdm->pmic->vp_vstepmin; 74
80 vdd->vp_rt_data.vstepmax_stepmax = voltdm->pmic->vp_vstepmax; 75 /*
81 76 * VP_CONFIG: error gain is not set here, it will be updated
82 vp_val = vdd->vp_rt_data.vpconfig_erroroffset | 77 * on each scale, based on OPP.
83 (vdd->vp_rt_data.vpconfig_errorgain << 78 */
84 __ffs(vp->common->vpconfig_errorgain_mask)) | 79 val = (voltdm->pmic->vp_erroroffset <<
80 __ffs(voltdm->vp->common->vpconfig_erroroffset_mask)) |
85 vp->common->vpconfig_timeouten; 81 vp->common->vpconfig_timeouten;
86 voltdm->write(vp_val, vp->vpconfig); 82 voltdm->write(val, vp->vpconfig);
87 83
88 vp_val = ((vdd->vp_rt_data.vstepmin_smpswaittimemin << 84 /* VSTEPMIN */
89 vp->common->vstepmin_smpswaittimemin_shift) | 85 val = (waittime << vp->common->vstepmin_smpswaittimemin_shift) |
90 (vdd->vp_rt_data.vstepmin_stepmin << 86 (vstepmin << vp->common->vstepmin_stepmin_shift);
91 vp->common->vstepmin_stepmin_shift)); 87 voltdm->write(val, vp->vstepmin);
92 voltdm->write(vp_val, vp->vstepmin); 88
93 89 /* VSTEPMAX */
94 vp_val = ((vdd->vp_rt_data.vstepmax_smpswaittimemax << 90 val = (vstepmax << vp->common->vstepmax_stepmax_shift) |
95 vp->common->vstepmax_smpswaittimemax_shift) | 91 (waittime << vp->common->vstepmax_smpswaittimemax_shift);
96 (vdd->vp_rt_data.vstepmax_stepmax << 92 voltdm->write(val, vp->vstepmax);
97 vp->common->vstepmax_stepmax_shift)); 93
98 voltdm->write(vp_val, vp->vstepmax); 94 /* VLIMITTO */
99 95 val = (vddmax << vp->common->vlimitto_vddmax_shift) |
100 vp_val = ((vdd->vp_rt_data.vlimitto_vddmax << 96 (vddmin << vp->common->vlimitto_vddmin_shift) |
101 vp->common->vlimitto_vddmax_shift) | 97 (timeout << vp->common->vlimitto_timeout_shift);
102 (vdd->vp_rt_data.vlimitto_vddmin << 98 voltdm->write(val, vp->vlimitto);
103 vp->common->vlimitto_vddmin_shift) |
104 (vdd->vp_rt_data.vlimitto_timeout <<
105 vp->common->vlimitto_timeout_shift));
106 voltdm->write(vp_val, vp->vlimitto);
107} 99}
108 100
109int omap_vp_update_errorgain(struct voltagedomain *voltdm, 101int omap_vp_update_errorgain(struct voltagedomain *voltdm,
diff --git a/arch/arm/mach-omap2/vp.h b/arch/arm/mach-omap2/vp.h
index bb4c78e0c26f..96bbb23d2de2 100644
--- a/arch/arm/mach-omap2/vp.h
+++ b/arch/arm/mach-omap2/vp.h
@@ -108,34 +108,6 @@ struct omap_vp_instance {
108 bool enabled; 108 bool enabled;
109}; 109};
110 110
111/**
112 * struct omap_vp_runtime_data - VP data populated at runtime by code
113 * @vpconfig_erroroffset: value of ERROROFFSET bitfield in PRM_VP*_CONFIG
114 * @vpconfig_errorgain: value of ERRORGAIN bitfield in PRM_VP*_CONFIG
115 * @vstepmin_smpswaittimemin: value of SMPSWAITTIMEMIN bitfield in PRM_VP*_VSTEPMIN
116 * @vstepmax_smpswaittimemax: value of SMPSWAITTIMEMAX bitfield in PRM_VP*_VSTEPMAX
117 * @vlimitto_timeout: value of TIMEOUT bitfield in PRM_VP*_VLIMITTO
118 * @vstepmin_stepmin: value of VSTEPMIN bitfield in PRM_VP*_VSTEPMIN
119 * @vstepmax_stepmax: value of VSTEPMAX bitfield in PRM_VP*_VSTEPMAX
120 * @vlimitto_vddmin: value of VDDMIN bitfield in PRM_VP*_VLIMITTO
121 * @vlimitto_vddmax: value of VDDMAX bitfield in PRM_VP*_VLIMITTO
122 *
123 * XXX Is this structure really needed? Why not just program the
124 * device directly? They are in PRM space, therefore in the WKUP
125 * powerdomain, so register contents should not be lost in off-mode.
126 */
127struct omap_vp_runtime_data {
128 u32 vpconfig_erroroffset;
129 u16 vpconfig_errorgain;
130 u16 vstepmin_smpswaittimemin;
131 u16 vstepmax_smpswaittimemax;
132 u16 vlimitto_timeout;
133 u8 vstepmin_stepmin;
134 u8 vstepmax_stepmax;
135 u8 vlimitto_vddmin;
136 u8 vlimitto_vddmax;
137};
138
139extern struct omap_vp_instance omap3_vp_mpu; 111extern struct omap_vp_instance omap3_vp_mpu;
140extern struct omap_vp_instance omap3_vp_core; 112extern struct omap_vp_instance omap3_vp_core;
141 113