summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorJack Pham <jackp@codeaurora.org>2017-04-20 18:52:28 -0700
committerHemant Kumar <hemantk@codeaurora.org>2017-05-16 14:04:05 -0700
commit1974aed8292dd68f8680d92411601b5a13f600db (patch)
treee893a68805a0d7813394cae59738cd20b6c4e289 /drivers
parent0bdf562cc7f3e4c86f18fc98d5737bcac5e69c5f (diff)
usb: phy: qusb: Support specifying vdda33 levels from device tree
The specific voltage levels for the vdda33 regulator may vary depending on the target. Add an optional device tree property to allow specifying a 3-tuple of voltages for minimum, operating and maximum voltage levels. The minimum level is used when simply powering on, whereas the operating level is used when initializing the PHY. Change-Id: Ia5d301efdb6964434a01264e7aa19421a41e98ca Signed-off-by: Jack Pham <jackp@codeaurora.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/usb/phy/phy-msm-qusb-v2.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/drivers/usb/phy/phy-msm-qusb-v2.c b/drivers/usb/phy/phy-msm-qusb-v2.c
index 6fb91134b0c5..5df091a5454b 100644
--- a/drivers/usb/phy/phy-msm-qusb-v2.c
+++ b/drivers/usb/phy/phy-msm-qusb-v2.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014-2016, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2014-2017, The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -90,6 +90,7 @@ struct qusb_phy {
struct regulator *vdda18;
struct regulator *vdda12;
int vdd_levels[3]; /* none, low, high */
+ int vdda33_levels[3];
int init_seq_len;
int *qusb_phy_init_seq;
int host_init_seq_len;
@@ -236,8 +237,8 @@ static int qusb_phy_enable_power(struct qusb_phy *qphy, bool on,
goto disable_vdda18;
}
- ret = regulator_set_voltage(qphy->vdda33, QUSB2PHY_3P3_VOL_MIN,
- QUSB2PHY_3P3_VOL_MAX);
+ ret = regulator_set_voltage(qphy->vdda33, qphy->vdda33_levels[0],
+ qphy->vdda33_levels[2]);
if (ret) {
dev_err(qphy->phy.dev,
"Unable to set voltage for vdda33:%d\n", ret);
@@ -262,7 +263,7 @@ disable_vdda33:
dev_err(qphy->phy.dev, "Unable to disable vdda33:%d\n", ret);
unset_vdd33:
- ret = regulator_set_voltage(qphy->vdda33, 0, QUSB2PHY_3P3_VOL_MAX);
+ ret = regulator_set_voltage(qphy->vdda33, 0, qphy->vdda33_levels[2]);
if (ret)
dev_err(qphy->phy.dev,
"Unable to set (0) voltage for vdda33:%d\n", ret);
@@ -455,6 +456,15 @@ static int qusb_phy_init(struct usb_phy *phy)
if (ret)
return ret;
+ /* bump up vdda33 voltage to operating level*/
+ ret = regulator_set_voltage(qphy->vdda33, qphy->vdda33_levels[1],
+ qphy->vdda33_levels[2]);
+ if (ret) {
+ dev_err(qphy->phy.dev,
+ "Unable to set voltage for vdda33:%d\n", ret);
+ return ret;
+ }
+
qusb_phy_enable_clocks(qphy, true);
/* Perform phy reset */
@@ -1016,6 +1026,19 @@ static int qusb_phy_probe(struct platform_device *pdev)
return ret;
}
+ ret = of_property_read_u32_array(dev->of_node,
+ "qcom,vdda33-voltage-level",
+ (u32 *) qphy->vdda33_levels,
+ ARRAY_SIZE(qphy->vdda33_levels));
+ if (ret == -EINVAL) {
+ qphy->vdda33_levels[0] = QUSB2PHY_3P3_VOL_MIN;
+ qphy->vdda33_levels[1] = QUSB2PHY_3P3_VOL_MIN;
+ qphy->vdda33_levels[2] = QUSB2PHY_3P3_VOL_MAX;
+ } else if (ret) {
+ dev_err(dev, "error reading qcom,vdda33-voltage-level property\n");
+ return ret;
+ }
+
qphy->vdd = devm_regulator_get(dev, "vdd");
if (IS_ERR(qphy->vdd)) {
dev_err(dev, "unable to get vdd supply\n");