scsi: ufs: fix up regulator operations
Subsystems (2)
Hi,
This patch series tries to clean-up and fix-up regulator operations in ufs driver.
[PATCH 1/2] scsi: ufs: cleanup unused min_uA in struct ufs_vreg
- min_uA in strcut ufs_vreg is not used by any ufs drivers thus remove it.
[PATCH 2/2] scsi: ufs: fix regulator set load and icc-level re-configuration
- Fix up "regulator_set_load" condition and icc_level value during icc_level configuration flow.
Stanley Chu (2):
scsi: ufs: cleanup unused min_uA in struct ufs_vreg
scsi: ufs: fix regulator set load and icc-level configuration
drivers/scsi/ufs/ufs.h | 1 - drivers/scsi/ufs/ufshcd-pltfrm.c | 1 - drivers/scsi/ufs/ufshcd.c | 15 ++++++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-)
cover scsi: ufs: fix up regulator operations
In reply to a message not in the archiveHi,
This patch series tries to clean-up and fix-up regulator operations in ufs driver.
[PATCH 1/2] scsi: ufs: cleanup unused min_uA in struct ufs_vreg
- min_uA in strcut ufs_vreg is not used by any ufs drivers thus remove it.
[PATCH 2/2] scsi: ufs: fix regulator set load and icc-level re-configuration
- Fix up "regulator_set_load" condition and icc_level value during icc_level configuration flow.
Stanley Chu (2):
scsi: ufs: cleanup unused min_uA in struct ufs_vreg
scsi: ufs: fix regulator set load and icc-level configuration
drivers/scsi/ufs/ufs.h | 1 - drivers/scsi/ufs/ufshcd-pltfrm.c | 1 - drivers/scsi/ufs/ufshcd.c | 15 ++++++++++++--- 3 files changed, 12 insertions(+), 5 deletions(-)
Signature · 1 line
2.18.0
PATCH 1/2 scsi: ufs: cleanup unused min_uA in struct ufs_vreg
In reply to a message not in the archivemin_uA in strcut ufs_vreg is not used by any ufs
drivers thus remove it.
--- drivers/scsi/ufs/ufs.h | 1 - drivers/scsi/ufs/ufshcd-pltfrm.c | 1 - 2 files changed, 2 deletions(-)
drivers/scsi/ufs/ufs.h +0 -1
@@ -516,7 +516,6 @@ struct ufs_vreg {bool enabled;int min_uV;int max_uV; -int min_uA;int max_uA; };
drivers/scsi/ufs/ufshcd-pltfrm.c +0 -1
@@ -164,7 +164,6 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name, goto out; } - vreg->min_uA =0 ;if (!strcmp (name,"vcc" )) {if (of_property_read_bool (np,"vcc-supply-1p8" )) { vreg->min_uV =UFS_VREG_VCC_1P8_MIN_UV ;
Signature · 1 line
2.18.0
PATCH 2/2 scsi: ufs: fix regulator set load and icc-level configuration
In reply to a message not in the archiveCurrently if a regulator has "<name>-fixed-regulator" property in device tree, it will skip "max_uA" configuration.
However, "regulator_set_load" operation shall be required on those regulators which specifically configured current limitation, i.e., "max_uA". Otherwise zero max_uA value may cause unexpected behavior when this regulator is enabled or set as high power mode.
Similarly, in icc_level configuration flow, icc_level shall be updated if specified regulator has configured "max_uA", otherwise wrong icc_level may be written to device and cause unexpected results.
--- drivers/scsi/ufs/ufshcd.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
drivers/scsi/ufs/ufshcd.c +12 -3
@@ -6279,19 +6279,19 @@ static u32 ufshcd_find_max_sup_active_icc_level(struct ufs_hba *hba, goto out; } -if (hba->vreg_info.vcc) +if (hba->vreg_info.vcc && hba->vreg_info.vcc->max_uA) icc_level =ufshcd_get_max_icc_level ( hba->vreg_info.vcc->max_uA,POWER_DESC_MAX_ACTV_ICC_LVLS -1 , &desc_buf[PWR_DESC_ACTIVE_LVLS_VCC_0 ]); -if (hba->vreg_info.vccq) +if (hba->vreg_info.vccq && hba->vreg_info.vccq->max_uA) icc_level =ufshcd_get_max_icc_level ( hba->vreg_info.vccq->max_uA, icc_level, &desc_buf[PWR_DESC_ACTIVE_LVLS_VCCQ_0 ]); -if (hba->vreg_info.vccq2) +if (hba->vreg_info.vccq2 && hba->vreg_info.vccq2->max_uA) icc_level = ufshcd_get_max_icc_level( hba->vreg_info.vccq2->max_uA, icc_level,
@@ -6989,6 +6989,15 @@ static int ufshcd_config_vreg_load(struct device *dev, struct ufs_vreg *vreg,if (!vreg)return 0 ; +/* +* "set_load" operation shall be required on those regulators +* which specifically configured current limitation. Otherwise +* zero max_uA may cause unexpected behavior when regulator is +* enabled or set as high power mode. +*/ +if (!vreg->max_uA) +return 0 ; + ret =regulator_set_load (vreg->reg, ua);if (ret <0 ) { dev_err(dev, "%s: %s set load (ua=%d) failed, err=%d\n",
Signature · 1 line
2.18.0