mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-13 00:00:00 -04:00
scsi: ufs: Read device tree to find UFS's Vcc voltage level
This change allows selecting the UFS Vcc voltage level by setting the UFS's entry vcc-voltage-level in the device tree. If UFS's Vcc voltage level setting is not found in the device tree, use default values provided by the driver. Change-Id: Ifc6856d63b672ed6b178f45fd5f139cb2fa56f15 Signed-off-by: Bao D. Nguyen <nguyenb@codeaurora.org>
This commit is contained in:
parent
0ea391bae1
commit
40d7d6b3ab
1 changed files with 12 additions and 3 deletions
|
|
@ -129,10 +129,11 @@ out:
|
|||
static int ufshcd_populate_vreg(struct device *dev, const char *name,
|
||||
struct ufs_vreg **out_vreg)
|
||||
{
|
||||
int ret = 0;
|
||||
int len, ret = 0;
|
||||
char prop_name[MAX_PROP_SIZE];
|
||||
struct ufs_vreg *vreg = NULL;
|
||||
struct device_node *np = dev->of_node;
|
||||
const __be32 *prop;
|
||||
|
||||
if (!np) {
|
||||
dev_err(dev, "%s: non DT initialization\n", __func__);
|
||||
|
|
@ -162,8 +163,16 @@ static int ufshcd_populate_vreg(struct device *dev, const char *name,
|
|||
vreg->min_uV = UFS_VREG_VCC_1P8_MIN_UV;
|
||||
vreg->max_uV = UFS_VREG_VCC_1P8_MAX_UV;
|
||||
} else {
|
||||
vreg->min_uV = UFS_VREG_VCC_MIN_UV;
|
||||
vreg->max_uV = UFS_VREG_VCC_MAX_UV;
|
||||
prop = of_get_property(np, "vcc-voltage-level", &len);
|
||||
if (!prop || (len != (2 * sizeof(__be32)))) {
|
||||
dev_warn(dev, "%s vcc-voltage-level property.\n",
|
||||
prop ? "invalid format" : "no");
|
||||
vreg->min_uV = UFS_VREG_VCC_MIN_UV;
|
||||
vreg->max_uV = UFS_VREG_VCC_MAX_UV;
|
||||
} else {
|
||||
vreg->min_uV = be32_to_cpup(&prop[0]);
|
||||
vreg->max_uV = be32_to_cpup(&prop[1]);
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(name, "vccq")) {
|
||||
vreg->min_uV = UFS_VREG_VCCQ_MIN_UV;
|
||||
|
|
|
|||
Loading…
Reference in a new issue