Commit 667216d6 authored by Kevin Hilman's avatar Kevin Hilman

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: default avatarKevin Hilman <khilman@ti.com>
parent 76ea7424
...@@ -144,13 +144,11 @@ struct omap_voltdm_pmic { ...@@ -144,13 +144,11 @@ struct omap_voltdm_pmic {
* *
* @volt_data : voltage table having the distinct voltages supported * @volt_data : voltage table having the distinct voltages supported
* by the domain and other associated per voltage data. * by the domain and other associated per voltage data.
* @vp_rt_data : VP data derived at runtime, not predefined
* @curr_volt : current voltage for this vdd. * @curr_volt : current voltage for this vdd.
* @volt_scale : API to scale the voltage of the vdd. * @volt_scale : API to scale the voltage of the vdd.
*/ */
struct omap_vdd_info { struct omap_vdd_info {
struct omap_volt_data *volt_data; struct omap_volt_data *volt_data;
struct omap_vp_runtime_data vp_rt_data;
u32 curr_volt; u32 curr_volt;
int (*volt_scale) (struct voltagedomain *voltdm, int (*volt_scale) (struct voltagedomain *voltdm,
......
...@@ -49,8 +49,8 @@ static void vp_latch_vsel(struct voltagedomain *voltdm) ...@@ -49,8 +49,8 @@ static void vp_latch_vsel(struct voltagedomain *voltdm)
void __init omap_vp_init(struct voltagedomain *voltdm) void __init omap_vp_init(struct voltagedomain *voltdm)
{ {
struct omap_vp_instance *vp = voltdm->vp; struct omap_vp_instance *vp = voltdm->vp;
struct omap_vdd_info *vdd = voltdm->vdd; u32 val, sys_clk_rate, timeout, waittime;
u32 vp_val, sys_clk_rate, timeout_val, waittime; u32 vddmin, vddmax, vstepmin, vstepmax;
if (!voltdm->read || !voltdm->write) { if (!voltdm->read || !voltdm->write) {
pr_err("%s: No read/write API for accessing vdd_%s regs\n", 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,47 +63,39 @@ void __init omap_vp_init(struct voltagedomain *voltdm)
/* Divide to avoid overflow */ /* Divide to avoid overflow */
sys_clk_rate = voltdm->sys_clk.rate / 1000; sys_clk_rate = voltdm->sys_clk.rate / 1000;
vdd->vp_rt_data.vpconfig_erroroffset = timeout = (sys_clk_rate * voltdm->pmic->vp_timeout_us) / 1000;
(voltdm->pmic->vp_erroroffset << vddmin = voltdm->pmic->vp_vddmin;
__ffs(voltdm->vp->common->vpconfig_erroroffset_mask)); vddmax = voltdm->pmic->vp_vddmax;
timeout_val = (sys_clk_rate * voltdm->pmic->vp_timeout_us) / 1000;
vdd->vp_rt_data.vlimitto_timeout = timeout_val;
vdd->vp_rt_data.vlimitto_vddmin = voltdm->pmic->vp_vddmin;
vdd->vp_rt_data.vlimitto_vddmax = voltdm->pmic->vp_vddmax;
waittime = ((voltdm->pmic->step_size / voltdm->pmic->slew_rate) * waittime = ((voltdm->pmic->step_size / voltdm->pmic->slew_rate) *
sys_clk_rate) / 1000; sys_clk_rate) / 1000;
vdd->vp_rt_data.vstepmin_smpswaittimemin = waittime; vstepmin = voltdm->pmic->vp_vstepmin;
vdd->vp_rt_data.vstepmax_smpswaittimemax = waittime; vstepmax = voltdm->pmic->vp_vstepmax;
vdd->vp_rt_data.vstepmin_stepmin = voltdm->pmic->vp_vstepmin;
vdd->vp_rt_data.vstepmax_stepmax = voltdm->pmic->vp_vstepmax; /*
* VP_CONFIG: error gain is not set here, it will be updated
vp_val = vdd->vp_rt_data.vpconfig_erroroffset | * on each scale, based on OPP.
(vdd->vp_rt_data.vpconfig_errorgain << */
__ffs(vp->common->vpconfig_errorgain_mask)) | val = (voltdm->pmic->vp_erroroffset <<
__ffs(voltdm->vp->common->vpconfig_erroroffset_mask)) |
vp->common->vpconfig_timeouten; vp->common->vpconfig_timeouten;
voltdm->write(vp_val, vp->vpconfig); voltdm->write(val, vp->vpconfig);
vp_val = ((vdd->vp_rt_data.vstepmin_smpswaittimemin << /* VSTEPMIN */
vp->common->vstepmin_smpswaittimemin_shift) | val = (waittime << vp->common->vstepmin_smpswaittimemin_shift) |
(vdd->vp_rt_data.vstepmin_stepmin << (vstepmin << vp->common->vstepmin_stepmin_shift);
vp->common->vstepmin_stepmin_shift)); voltdm->write(val, vp->vstepmin);
voltdm->write(vp_val, vp->vstepmin);
/* VSTEPMAX */
vp_val = ((vdd->vp_rt_data.vstepmax_smpswaittimemax << val = (vstepmax << vp->common->vstepmax_stepmax_shift) |
vp->common->vstepmax_smpswaittimemax_shift) | (waittime << vp->common->vstepmax_smpswaittimemax_shift);
(vdd->vp_rt_data.vstepmax_stepmax << voltdm->write(val, vp->vstepmax);
vp->common->vstepmax_stepmax_shift));
voltdm->write(vp_val, vp->vstepmax); /* VLIMITTO */
val = (vddmax << vp->common->vlimitto_vddmax_shift) |
vp_val = ((vdd->vp_rt_data.vlimitto_vddmax << (vddmin << vp->common->vlimitto_vddmin_shift) |
vp->common->vlimitto_vddmax_shift) | (timeout << vp->common->vlimitto_timeout_shift);
(vdd->vp_rt_data.vlimitto_vddmin << voltdm->write(val, vp->vlimitto);
vp->common->vlimitto_vddmin_shift) |
(vdd->vp_rt_data.vlimitto_timeout <<
vp->common->vlimitto_timeout_shift));
voltdm->write(vp_val, vp->vlimitto);
} }
int omap_vp_update_errorgain(struct voltagedomain *voltdm, int omap_vp_update_errorgain(struct voltagedomain *voltdm,
......
...@@ -108,34 +108,6 @@ struct omap_vp_instance { ...@@ -108,34 +108,6 @@ struct omap_vp_instance {
bool enabled; bool enabled;
}; };
/**
* struct omap_vp_runtime_data - VP data populated at runtime by code
* @vpconfig_erroroffset: value of ERROROFFSET bitfield in PRM_VP*_CONFIG
* @vpconfig_errorgain: value of ERRORGAIN bitfield in PRM_VP*_CONFIG
* @vstepmin_smpswaittimemin: value of SMPSWAITTIMEMIN bitfield in PRM_VP*_VSTEPMIN
* @vstepmax_smpswaittimemax: value of SMPSWAITTIMEMAX bitfield in PRM_VP*_VSTEPMAX
* @vlimitto_timeout: value of TIMEOUT bitfield in PRM_VP*_VLIMITTO
* @vstepmin_stepmin: value of VSTEPMIN bitfield in PRM_VP*_VSTEPMIN
* @vstepmax_stepmax: value of VSTEPMAX bitfield in PRM_VP*_VSTEPMAX
* @vlimitto_vddmin: value of VDDMIN bitfield in PRM_VP*_VLIMITTO
* @vlimitto_vddmax: value of VDDMAX bitfield in PRM_VP*_VLIMITTO
*
* XXX Is this structure really needed? Why not just program the
* device directly? They are in PRM space, therefore in the WKUP
* powerdomain, so register contents should not be lost in off-mode.
*/
struct omap_vp_runtime_data {
u32 vpconfig_erroroffset;
u16 vpconfig_errorgain;
u16 vstepmin_smpswaittimemin;
u16 vstepmax_smpswaittimemax;
u16 vlimitto_timeout;
u8 vstepmin_stepmin;
u8 vstepmax_stepmax;
u8 vlimitto_vddmin;
u8 vlimitto_vddmax;
};
extern struct omap_vp_instance omap3_vp_mpu; extern struct omap_vp_instance omap3_vp_mpu;
extern struct omap_vp_instance omap3_vp_core; extern struct omap_vp_instance omap3_vp_core;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment