soc: qcom: spm: Poll for the PMIC_STATE after updating the VCTL register

The PMIC_STATE is expected to move to idle after the VCTL register
value is written to the PMIC.

Also update the PMIC_STATE poll timeout to 500us for all the targets.

CRs-Fixed: 1024714
Change-Id: If9d9875a967179c6ee5fced8f019c01f1a2f0583
Signed-off-by: Anirudh Ghayal <aghayal@codeaurora.org>
Signed-off-by: Maulik Shah <mkshah@codeaurora.org>
This commit is contained in:
Anirudh Ghayal 2016-05-27 20:01:40 +05:30 committed by Maulik Shah
parent 008f057bba
commit e759633f97
3 changed files with 9 additions and 7 deletions

View file

@ -22,7 +22,7 @@
qcom,name = "system-cbf"; /* CBF SAW */
qcom,saw2-ver-reg = <0xFD0>;
qcom,cpu-vctl-list = <&CPU0 &CPU1 &CPU2 &CPU3>;
qcom,vctl-timeout-us = <50>;
qcom,vctl-timeout-us = <500>;
qcom,vctl-port = <0x0>;
qcom,phase-port = <0x1>;
qcom,saw2-avs-ctl = <0x1100>;

View file

@ -20,7 +20,7 @@
qcom,name = "gold-l2"; /* Gold L2 SAW */
qcom,saw2-ver-reg = <0xfd0>;
qcom,cpu-vctl-list = <&CPU4 &CPU5 &CPU6 &CPU7>;
qcom,vctl-timeout-us = <50>;
qcom,vctl-timeout-us = <500>;
qcom,vctl-port = <0x0>;
qcom,phase-port = <0x1>;
qcom,saw2-avs-ctl = <0x1010031>;
@ -36,7 +36,7 @@
qcom,name = "silver-l2"; /* Silver L2 SAW */
qcom,saw2-ver-reg = <0xfd0>;
qcom,cpu-vctl-list = <&CPU0 &CPU1 &CPU2 &CPU3>;
qcom,vctl-timeout-us = <50>;
qcom,vctl-timeout-us = <500>;
qcom,vctl-port = <0x0>;
qcom,phase-port = <0x1>;
qcom,saw2-avs-ctl = <0x1010031>;

View file

@ -231,7 +231,7 @@ uint32_t msm_spm_drv_get_sts_curr_pmic_data(
struct msm_spm_driver_data *dev)
{
msm_spm_drv_load_shadow(dev, MSM_SPM_REG_SAW_PMIC_STS);
return dev->reg_shadow[MSM_SPM_REG_SAW_PMIC_STS] & 0xFF;
return dev->reg_shadow[MSM_SPM_REG_SAW_PMIC_STS] & 0x300FF;
}
static inline void msm_spm_drv_get_saw2_ver(struct msm_spm_driver_data *dev,
@ -532,10 +532,12 @@ int msm_spm_drv_set_vdd(struct msm_spm_driver_data *dev, unsigned int vlevel)
timeout_us = dev->vctl_timeout_us;
/* Confirm the voltage we set was what hardware sent */
do {
new_level = msm_spm_drv_get_sts_curr_pmic_data(dev);
if (new_level == vlevel)
break;
udelay(1);
new_level = msm_spm_drv_get_sts_curr_pmic_data(dev);
/* FSM is idle */
if (((new_level & 0x30000) == 0) &&
((new_level & 0xFF) == vlevel))
break;
} while (--timeout_us);
if (!timeout_us) {
pr_info("Wrong level %#x\n", new_level);