diff options
author | Ajay Agarwal <ajaya@codeaurora.org> | 2018-07-25 12:25:16 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2018-07-31 00:22:33 -0700 |
commit | 53324ddb60cb797ce6cbed007b12cc06865de5a3 (patch) | |
tree | 0531865d6bf6d26fb3a603b4dd1b1538c7fb1c44 /drivers/usb/phy | |
parent | b77f7d2943c32fe942bd0defbbc399e7074294f9 (diff) |
usb: phy-msm-ssusb-qmp: Make vls_clamp_reg as optional
Currently the SSUSB QMP PHY driver mandates that vls_clamp_reg be
passed from the DTSI. But this register cannot be accessed on a
platform on which Linux is a guest OS. This can lead to errors
when trying to enable autonomous mode. Work around this situation
by making the vls_clamp_reg property as optional.
Change-Id: Idb103d9b7bda717a5f12689951a7452c46aa76dd
Signed-off-by: Ajay Agarwal <ajaya@codeaurora.org>
Diffstat (limited to 'drivers/usb/phy')
-rw-r--r-- | drivers/usb/phy/phy-msm-ssusb-qmp.c | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/usb/phy/phy-msm-ssusb-qmp.c b/drivers/usb/phy/phy-msm-ssusb-qmp.c index 3ffb20c4a207..d1b6f1df860d 100644 --- a/drivers/usb/phy/phy-msm-ssusb-qmp.c +++ b/drivers/usb/phy/phy-msm-ssusb-qmp.c @@ -473,11 +473,13 @@ static int msm_ssphy_qmp_set_suspend(struct usb_phy *uphy, int suspend) } if (suspend) { - if (phy->cable_connected) - msm_ssusb_qmp_enable_autonomous(phy, 1); - else + if (phy->cable_connected) { + if (phy->vls_clamp_reg) + msm_ssusb_qmp_enable_autonomous(phy, 1); + } else { writel_relaxed(0x00, phy->base + phy->phy_reg[USB3_PHY_POWER_DOWN_CONTROL]); + } /* Make sure above write completed with PHY */ wmb(); @@ -509,7 +511,8 @@ static int msm_ssphy_qmp_set_suspend(struct usb_phy *uphy, int suspend) writel_relaxed(0x01, phy->base + phy->phy_reg[USB3_PHY_POWER_DOWN_CONTROL]); } else { - msm_ssusb_qmp_enable_autonomous(phy, 0); + if (phy->vls_clamp_reg) + msm_ssusb_qmp_enable_autonomous(phy, 0); } /* Make sure that above write completed with PHY */ @@ -648,13 +651,13 @@ static int msm_ssphy_qmp_probe(struct platform_device *pdev) res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "vls_clamp_reg"); if (!res) { - dev_err(dev, "failed getting vls_clamp_reg\n"); - return -ENODEV; - } - phy->vls_clamp_reg = devm_ioremap_resource(dev, res); - if (IS_ERR(phy->vls_clamp_reg)) { - dev_err(dev, "couldn't find vls_clamp_reg address.\n"); - return PTR_ERR(phy->vls_clamp_reg); + dev_dbg(dev, "vls_clamp_reg not passed\n"); + } else { + phy->vls_clamp_reg = devm_ioremap_resource(dev, res); + if (IS_ERR(phy->vls_clamp_reg)) { + dev_err(dev, "couldn't find vls_clamp_reg address.\n"); + return PTR_ERR(phy->vls_clamp_reg); + } } res = platform_get_resource_byname(pdev, IORESOURCE_MEM, |