Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 047f2cab authored by Ziqi Chen's avatar Ziqi Chen Committed by Gerrit - the friendly Code Review server
Browse files

scsi: ufs: obtain VCCQ2 voltage level from DT prior to hard code



Some Vendor has their specific VCCQ2 voltage range which is different
with universal UFS spec. So we need to read VCCQ2 voltage level from
DT prior to from hard code.

Change-Id: I08a01fded6e2431c76110fe5b9e1e71f86177a63
Signed-off-by: default avatarZiqi Chen <ziqichen@codeaurora.org>
parent 5dafdac0
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -27,6 +27,8 @@ Optional properties:
                          Should be specified in pairs (min, max), units uV.
- vccq-supply           : phandle to VCCQ supply regulator node
- vccq2-supply          : phandle to VCCQ2 supply regulator node
- vccq2-voltage-level   : specifies voltage levels for VCCQ2 supply.
                          Should be specified in pairs (min, max), units uV.
- vcc-supply-1p8        : For embedded UFS devices, valid VCC range is 1.7-1.95V
                          or 2.7-3.6V. This boolean property when set, specifies
			  to use low voltage range of 1.7-1.95V. Note for external
+10 −2
Original line number Diff line number Diff line
@@ -202,8 +202,16 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name,
		vreg->min_uV = UFS_VREG_VCCQ_MIN_UV;
		vreg->max_uV = UFS_VREG_VCCQ_MAX_UV;
	} else if (!strcmp(name, "vccq2")) {
		prop = of_get_property(np, "vccq2-voltage-level", &len);
		if (!prop || (len != (2 * sizeof(__be32)))) {
			dev_warn(dev, "%s vccq2-voltage-level property.\n",
				prop ? "invalid format" : "no");
			vreg->min_uV = UFS_VREG_VCCQ2_MIN_UV;
			vreg->max_uV = UFS_VREG_VCCQ2_MAX_UV;
		} else {
			vreg->min_uV = be32_to_cpup(&prop[0]);
			vreg->max_uV = be32_to_cpup(&prop[1]);
		}
	}

	goto out;