Commit bea30ed6 authored by Todd Poynor's avatar Todd Poynor Committed by Kevin Hilman

OMAP: VP: Explicitly mask VPVOLTAGE field

Reading the VPVOLTAGE field of PRM_VP_*_VOLTAGE registers currently
relies on a u32 -> u8 conversion to mask off the FORCEUPDATEWAIT field
in the upper bits.  Make this explicit using the mask symbol
already defined, added as a new field in struct omap_vp_common.
Signed-off-by: default avatarTodd Poynor <toddpoynor@google.com>
Signed-off-by: default avatarKevin Hilman <khilman@ti.com>
parent 0f01565a
...@@ -227,7 +227,8 @@ unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm) ...@@ -227,7 +227,8 @@ unsigned long omap_vp_get_curr_volt(struct voltagedomain *voltdm)
return 0; return 0;
} }
curr_vsel = voltdm->read(vp->voltage); curr_vsel = (voltdm->read(vp->voltage) & vp->common->vpvoltage_mask)
>> __ffs(vp->common->vpvoltage_mask);
if (!voltdm->pmic || !voltdm->pmic->vsel_to_uv) { if (!voltdm->pmic || !voltdm->pmic->vsel_to_uv) {
pr_warning("%s: PMIC function to convert vsel to voltage" pr_warning("%s: PMIC function to convert vsel to voltage"
......
...@@ -63,6 +63,7 @@ struct omap_vp_ops { ...@@ -63,6 +63,7 @@ struct omap_vp_ops {
* @vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg * @vlimitto_vddmin_shift: VDDMIN field shift in PRM_VP*_VLIMITTO reg
* @vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg * @vlimitto_vddmax_shift: VDDMAX field shift in PRM_VP*_VLIMITTO reg
* @vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg * @vlimitto_timeout_shift: TIMEOUT field shift in PRM_VP*_VLIMITTO reg
* @vpvoltage_mask: VPVOLTAGE field mask in PRM_VP*_VOLTAGE reg
*/ */
struct omap_vp_common { struct omap_vp_common {
u32 vpconfig_erroroffset_mask; u32 vpconfig_erroroffset_mask;
...@@ -79,6 +80,7 @@ struct omap_vp_common { ...@@ -79,6 +80,7 @@ struct omap_vp_common {
u8 vlimitto_vddmin_shift; u8 vlimitto_vddmin_shift;
u8 vlimitto_vddmax_shift; u8 vlimitto_vddmax_shift;
u8 vlimitto_timeout_shift; u8 vlimitto_timeout_shift;
u8 vpvoltage_mask;
const struct omap_vp_ops *ops; const struct omap_vp_ops *ops;
}; };
......
...@@ -51,6 +51,8 @@ static const struct omap_vp_common omap3_vp_common = { ...@@ -51,6 +51,8 @@ static const struct omap_vp_common omap3_vp_common = {
.vlimitto_vddmin_shift = OMAP3430_VDDMIN_SHIFT, .vlimitto_vddmin_shift = OMAP3430_VDDMIN_SHIFT,
.vlimitto_vddmax_shift = OMAP3430_VDDMAX_SHIFT, .vlimitto_vddmax_shift = OMAP3430_VDDMAX_SHIFT,
.vlimitto_timeout_shift = OMAP3430_TIMEOUT_SHIFT, .vlimitto_timeout_shift = OMAP3430_TIMEOUT_SHIFT,
.vpvoltage_mask = OMAP3430_VPVOLTAGE_MASK,
.ops = &omap3_vp_ops, .ops = &omap3_vp_ops,
}; };
......
...@@ -51,6 +51,7 @@ static const struct omap_vp_common omap4_vp_common = { ...@@ -51,6 +51,7 @@ static const struct omap_vp_common omap4_vp_common = {
.vlimitto_vddmin_shift = OMAP4430_VDDMIN_SHIFT, .vlimitto_vddmin_shift = OMAP4430_VDDMIN_SHIFT,
.vlimitto_vddmax_shift = OMAP4430_VDDMAX_SHIFT, .vlimitto_vddmax_shift = OMAP4430_VDDMAX_SHIFT,
.vlimitto_timeout_shift = OMAP4430_TIMEOUT_SHIFT, .vlimitto_timeout_shift = OMAP4430_TIMEOUT_SHIFT,
.vpvoltage_mask = OMAP4430_VPVOLTAGE_MASK,
.ops = &omap4_vp_ops, .ops = &omap4_vp_ops,
}; };
......
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