diff mbox series

[RESEND,v3,4/5] scsi: ufs: Change "<name>-max-microamp" to non-mandatory property

Message ID 1553680707-28579-5-git-send-email-stanley.chu@mediatek.com (mailing list archive)
State New, archived
Headers show
Series scsi: ufs: Fix regulator operations and remove "<name>-fixed-regulator" device tree property | expand

Commit Message

Stanley Chu March 27, 2019, 9:58 a.m. UTC
In dt-bindings for ufs, "<name>-max-microamp" property indicates
current limit and is mandatory if "<name>-fixed-regulator" is not
defined on a specified regulator.

However, in some platforms, regulators without "<name>-fixed-regulator"
property may not need to define their current limit because they may
want to define voltage range only for proper voltage switching in
different power modes, especially for vcc, vccq or vccq2.

Currently missing "<name>-max-microamp" property in device tree will
lead to initialization fail currently, thus such limitation shall be
resolved to tolerate this kind of regulators.

After resolving this, regulators without "<name>-max-microamp"
property will have undefined "max current" value, i.e., zero value
in "max_uA" field in struct ufs_vreg. Because we do bypass current
switching operation (by regulator_set_load) in case of undefined
current limit, this patch shall be safe.

Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
---
 drivers/scsi/ufs/ufshcd-pltfrm.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

Comments

Avri Altman March 27, 2019, 10:48 a.m. UTC | #1
> 
> In dt-bindings for ufs, "<name>-max-microamp" property indicates
> current limit and is mandatory if "<name>-fixed-regulator" is not
> defined on a specified regulator.
> 
> However, in some platforms, regulators without "<name>-fixed-regulator"
> property may not need to define their current limit because they may
> want to define voltage range only for proper voltage switching in
> different power modes, especially for vcc, vccq or vccq2.
> 
> Currently missing "<name>-max-microamp" property in device tree will
> lead to initialization fail currently, thus such limitation shall be
lead initialization to fail, thus ...

> resolved to tolerate this kind of regulators.
> 
> After resolving this, regulators without "<name>-max-microamp"
> property will have undefined "max current" value, i.e., zero value
> in "max_uA" field in struct ufs_vreg. Because we do bypass current
> switching operation (by regulator_set_load) in case of undefined
> current limit, this patch shall be safe.
> 
> Signed-off-by: Stanley Chu <stanley.chu@mediatek.com>
Reviewed-by: Avri Altman <avri.altman@wdc.com>

You might want to cc some platform guys, e.g. Evan Green and/or Codeaurora guys,
To take a look.

Thanks,
Avri
diff mbox series

Patch

diff --git a/drivers/scsi/ufs/ufshcd-pltfrm.c b/drivers/scsi/ufs/ufshcd-pltfrm.c
index 32cf8c56f029..2420e6962219 100644
--- a/drivers/scsi/ufs/ufshcd-pltfrm.c
+++ b/drivers/scsi/ufs/ufshcd-pltfrm.c
@@ -157,11 +157,9 @@  static int ufshcd_populate_vreg(struct device *dev, const char *name,
 		goto out;
 
 	snprintf(prop_name, MAX_PROP_SIZE, "%s-max-microamp", name);
-	ret = of_property_read_u32(np, prop_name, &vreg->max_uA);
-	if (ret) {
-		dev_err(dev, "%s: unable to find %s err %d\n",
-				__func__, prop_name, ret);
-		goto out;
+	if (of_property_read_u32(np, prop_name, &vreg->max_uA)) {
+		dev_info(dev, "%s: unable to find %s\n", __func__, prop_name);
+		vreg->max_uA = 0;
 	}
 
 	if (!strcmp(name, "vcc")) {