Merge "usb: phy: qusb: Support specifying vdda33 levels from device tree"
This commit is contained in:
commit
c9c69ae5d8
2 changed files with 29 additions and 4 deletions
|
@ -212,6 +212,8 @@ Optional properties:
|
|||
- qcom,hold-reset: Indicates that hold QUSB PHY into reset state.
|
||||
- qcom,phy-clk-scheme: Should be one of "cml" or "cmos" if ref_clk_addr is provided.
|
||||
- qcom,major-rev: provide major revision number to differentiate power up sequence. default is 2.0
|
||||
- qcom,vdda33-voltage-level: A list of three integer values (min, op, max) representing
|
||||
specific voltages (in microvolts) used for the vdda33 supply.
|
||||
|
||||
Example:
|
||||
qusb_phy: qusb@f9b39000 {
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Add table
Reference in a new issue